Changeset 123

Show
Ignore:
Timestamp:
04/16/08 08:01:47 (4 years ago)
Author:
phil
Message:

rdfalchemy added identifier to create_engine (for sleepycat only right now)

Location:
rdfalchemy/trunk/rdfalchemy
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • rdfalchemy/trunk/rdfalchemy/engine/__init__.py

    r110 r123  
    33import urllib 
    44 
    5 def create_engine(url='', create=False): 
     5def create_engine(url='', identifier="", create=False): 
    66    """ 
    77    :returns: returns an open rdflib ConjunctiveGraph 
    88 
    99    :param url: a string of the url 
     10    :param identifier: URIRef of the default context for writing 
    1011    e.g.: 
    1112       
     
    1415      - create_engine('zodb:///var/rdflib/Data.fs') 
    1516      - 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')             
    1619     
    1720    for zodb: 
     
    2629    elif url.lower().startswith('mysql://'): 
    2730        from rdflib import ConjunctiveGraph 
    28         db = ConjunctiveGraph('MySQL') 
     31        db = ConjunctiveGraph('MySQL',identifier) 
    2932        schema,opts = _parse_rfc1738_args(url) 
    3033        openstr= 'db=%(database)s,host=%(host)s,user=%(username)s'%opts 
     
    3235    elif url.lower().startswith('sleepycat://'): 
    3336        from rdflib import ConjunctiveGraph 
    34         db = ConjunctiveGraph('Sleepycat') 
     37        db = ConjunctiveGraph('Sleepycat',identifier=identifier) 
    3538        openstr = os.path.abspath(os.path.expanduser(url[12:])) 
    36         db.open(openstr) #,create=create)  
     39        db.open(openstr,create=create) 
    3740    elif url.lower().startswith('zodb://'): 
    3841        import ZODB 
  • rdfalchemy/trunk/rdfalchemy/sparql.py

    r122 r123  
    8989        url = self.url+"?"+urlencode(query) 
    9090        req = Request(url) 
    91         log.debug("Request: %s" % req.get_full_url()) 
    9291        req.add_header('Accept','application/rdf+xml') 
    93         log.debug("opening url: %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()))         
    9493        subgraph = ConjunctiveGraph('IOMemory') 
    9594        subgraph.parse(urlopen(req))