Created
August 2, 2013 17:49
-
-
Save jboecker/6141871 to your computer and use it in GitHub Desktop.
rdflib-sqlalchemy test case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rdflib.plugins.memory.IOMemory object at 0x2370310> namespaces after creation: | |
[('xml', rdflib.term.URIRef(u'http://www.w3.org/XML/1998/namespace')), | |
('rdf', rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')), | |
('xsd', rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#')), | |
('rdfs', rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#'))] | |
('<rdflib.plugins.memory.IOMemory object at 0x2370310>', 'namespaces after loop:') | |
[('xml', rdflib.term.URIRef(u'http://www.w3.org/XML/1998/namespace')), | |
('rdf', rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')), | |
('ex', rdflib.term.URIRef(u'http://example.com/ns/ex#')), | |
('xsd', rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#')), | |
('rdfs', rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#'))] | |
<Partitioned SQL N3 Store> namespaces after creation: | |
[(u'xml', rdflib.term.URIRef(u'http://www.w3.org/XML/1998/namespace')), | |
(u'rdf', rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')), | |
(u'rdfs', rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#')), | |
(u'xsd', rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#'))] | |
<Partitioned SQL N3 Store> namespaces after loop: | |
[(u'xml', rdflib.term.URIRef(u'http://www.w3.org/XML/1998/namespace')), | |
(u'rdf', rdflib.term.URIRef(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')), | |
(u'rdfs', rdflib.term.URIRef(u'http://www.w3.org/2000/01/rdf-schema#')), | |
(u'xsd', rdflib.term.URIRef(u'http://www.w3.org/2001/XMLSchema#')), | |
(u'ex', rdflib.term.URIRef(u'http://example.com/ns/ex#')), | |
(u'ex1', rdflib.term.URIRef(u'http://example.com/ns/ex#')), | |
(u'ex2', rdflib.term.URIRef(u'http://example.com/ns/ex#')), | |
(u'ex3', rdflib.term.URIRef(u'http://example.com/ns/ex#')), | |
(u'ex4', rdflib.term.URIRef(u'http://example.com/ns/ex#'))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rdflib import Graph, URIRef, plugin | |
from rdflib.store import Store | |
from pprint import pprint | |
g1 = Graph() | |
print(repr(g1.store) + " namespaces after creation:") | |
pprint(list(g1.namespaces())) | |
for i in range(5): | |
g1.bind("ex", 'http://example.com/ns/ex#') | |
print("") | |
print(repr(g1.store), "namespaces after loop:") | |
pprint(list(g1.namespaces())) | |
print("\n") | |
store = plugin.get("SQLAlchemy", Store)() | |
g2 = Graph(store) | |
g2.open("sqlite://", create=True) | |
print(repr(g2.store) + " namespaces after creation:") | |
pprint(list(g2.namespaces())) | |
for i in range(5): | |
g2.bind("ex", 'http://example.com/ns/ex#') | |
print("") | |
print repr(g2.store), "namespaces after loop:" | |
pprint(list(g2.namespaces())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment