Changeset 123
- Timestamp:
- 04/16/08 08:01:47 (4 years ago)
- Location:
- rdfalchemy/trunk/rdfalchemy
- Files:
-
- 2 modified
-
engine/__init__.py (modified) (4 diffs)
-
sparql.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rdfalchemy/trunk/rdfalchemy/engine/__init__.py
r110 r123 3 3 import urllib 4 4 5 def create_engine(url='', create=False):5 def create_engine(url='', identifier="", create=False): 6 6 """ 7 7 :returns: returns an open rdflib ConjunctiveGraph 8 8 9 9 :param url: a string of the url 10 :param identifier: URIRef of the default context for writing 10 11 e.g.: 11 12 … … 14 15 - create_engine('zodb:///var/rdflib/Data.fs') 15 16 - create_engine('zodb://localhost:8672') 17 - create_engine('sesame://www.example.com:8080/openrdf-sesame/repositories/Test') 18 - create_engine('sparql://www.example.com:2020/sparql') 16 19 17 20 for zodb: … … 26 29 elif url.lower().startswith('mysql://'): 27 30 from rdflib import ConjunctiveGraph 28 db = ConjunctiveGraph('MySQL' )31 db = ConjunctiveGraph('MySQL',identifier) 29 32 schema,opts = _parse_rfc1738_args(url) 30 33 openstr= 'db=%(database)s,host=%(host)s,user=%(username)s'%opts … … 32 35 elif url.lower().startswith('sleepycat://'): 33 36 from rdflib import ConjunctiveGraph 34 db = ConjunctiveGraph('Sleepycat' )37 db = ConjunctiveGraph('Sleepycat',identifier=identifier) 35 38 openstr = os.path.abspath(os.path.expanduser(url[12:])) 36 db.open(openstr ) #,create=create)39 db.open(openstr,create=create) 37 40 elif url.lower().startswith('zodb://'): 38 41 import ZODB -
rdfalchemy/trunk/rdfalchemy/sparql.py
r122 r123 89 89 url = self.url+"?"+urlencode(query) 90 90 req = Request(url) 91 log.debug("Request: %s" % req.get_full_url())92 91 req.add_header('Accept','application/rdf+xml') 93 log.debug(" openingurl: %s\n with headers: %s" % (req.get_full_url(), req.header_items()))92 log.debug("Request url: %s\n with headers: %s" % (req.get_full_url(), req.header_items())) 94 93 subgraph = ConjunctiveGraph('IOMemory') 95 94 subgraph.parse(urlopen(req))
