from rdflib import Dataset, Literal, URIRef, Namespace from rdflib import ConjunctiveGraph, Graph, BNode from rdflib.plugins.memory import IOMemory from rdflib.namespace import DC, FOAF, OWL attrs = Namespace('http://api.datawi.re/attributes/') default_ctx = URIRef('http://api.datawi.re') store = IOMemory() store.bind('attrs', attrs) bn = URIRef('mailto:[email protected]') ig = Graph(store, identifier=default_ctx) # ig.bind('attr', attrs) # ig.add((bn, attrs.label, Literal('Test of the thing'))) # context = {'x': types} # print('-' * 72) # print(g.serialize(format='turtle', indent=2)) other_ctx = URIRef('urn:f****d') xg = Graph(store, identifier=other_ctx) # g.default_context = Graph(identifier=URIRef('http://api.datawi.re')) # g.bind('types', types) # xg.add((bn, attrs.label, Literal('Test of the thing'))) a = URIRef('http://pudo.org/test') xg.add((a, DC.title, Literal('Test value'))) b = URIRef('http://datawi.re/test')
def get_store(): store = IOMemory() for alias, ns in NAMESPACES.items(): store.bind(alias, ns) return store