Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Gueret <christophe.gueret@gmail.com>2011-09-26 06:26:45 (GMT)
committer Christophe Gueret <christophe.gueret@gmail.com>2011-09-26 06:26:45 (GMT)
commitb44e149a4b5e8bd257633c1d45a3346a6fcff859 (patch)
treeec1d8a06e40c87003a7eb4aa3e8bc5ca593a979d
parent0b527cf1d1a2cb24a875eaab4398f58c6a5ca0bf (diff)
Initial code for triple store interface
-rwxr-xr-xbin/datastore-service.py2
-rw-r--r--src/semanticxo/datastore.py39
2 files changed, 40 insertions, 1 deletions
diff --git a/bin/datastore-service.py b/bin/datastore-service.py
index e1d2c21..419321c 100755
--- a/bin/datastore-service.py
+++ b/bin/datastore-service.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python2
import os
import sys
-sys.path.append(os.getcwd()+'/../src')
+sys.path.append(os.path.join(os.path.expanduser('~'), 'Code/SemanticXO/datastore/src'))
import signal
import logging
diff --git a/src/semanticxo/datastore.py b/src/semanticxo/datastore.py
new file mode 100644
index 0000000..191c0e0
--- /dev/null
+++ b/src/semanticxo/datastore.py
@@ -0,0 +1,39 @@
+'''
+Created on 24 Sep 2011
+
+@author: cgueret
+'''
+from rdflib import ConjunctiveGraph, RDF, URIRef, Namespace, Literal
+
+OLPC = Namespace("http://example.org/")
+
+class TripleStoreObject(object):
+ pass
+
+class TripleStore(object):
+ '''
+ The TripleStore is a generic object interface with a triple store
+ '''
+ def __init__(self, params):
+ '''
+ Constructor of the TripleStore
+ if an hostname is indicated, query the triple store of that machine
+ instead of the one at localhost
+ '''
+ hostname = 'localhost'
+ if 'hostname' in params.keys():
+ hostname = params['hostname']
+ self.store_url = 'http://%s:8080/' % hostname
+ self.device_uid = 'ABC1234567890' #TODO find how to get the serial number
+
+ def _get_resource(self, uid):
+ '''
+ Return the URI associated to a particular UID
+ '''
+ return URIRef(OLPC['resource/%s' % uid])
+
+ def get_object(self, uid):
+ '''
+ Get a specific object associated to this UID
+ '''
+ \ No newline at end of file