from rdflib import Namespace from rdflib import URIRef from rdflib import BNode from rdflib import RDFS, RDF, OWL, XSD from api import BASE_GRAPH_URI, SCHEMA_GRAPH_URI, USER_GRAPH_URI, DATABASE_STORE, _get_db_config_string import rdflib_sparql from rdflib_sparql.processor import processUpdate rdflib_sparql.SPARQL_LOAD_GRAPHS = False SCHEMA = Namespace(SCHEMA_GRAPH_URI) store = plugin.get(DATABASE_STORE, Store)(identifier='rdfstore') rt = store.open(_get_db_config_string(), create=False) assert rt == VALID_STORE,"The underlying store is corrupted" citg = ConjunctiveGraph(store, identifier=URIRef(BASE_GRAPH_URI)) sg = Graph(store, identifier=URIRef(SCHEMA_GRAPH_URI)) g = sg USER = Namespace(str(USER_GRAPH_URI).format(userId=2)) ug = Graph(store, identifier=URIRef(USER)) # # query for all graphs # query = '''
''' Created on Mar 7, 2013 @author: howard ''' from rdflib import ConjunctiveGraph from rdflib import plugin from rdflib.store import Store from rdflib.store import VALID_STORE from rdflib import URIRef from api import BASE_GRAPH_URI, DATABASE_STORE, _get_db_config_string store = plugin.get(DATABASE_STORE, Store)(identifier='rdfstore') rt = store.open(_get_db_config_string(), create=True) assert rt == VALID_STORE,"The underlying store is corrupted" citg = ConjunctiveGraph(store, identifier=URIRef(BASE_GRAPH_URI)) citg.commit() citg.close()