Changeset 127

Show
Ignore:
Timestamp:
05/02/08 17:22:17 (4 years ago)
Author:
phil
Message:

This update to rdfalchemy moves some functions in to a sub-module and has the beginings of a sparql script
It adds some unit tests (for initBinding)

Breaking your Programs:

This update could break your code if you:


from rdfalchemy.sesame2 import SesameGraph?


you now need to import from rdfalchemy.sparql.sesame2
allows for jython or other sesame graph implimentations not dependent on the http sparql endpoint


you should probably be using create_engine instead

Location:
rdfalchemy/trunk
Files:
6 added
1 removed
8 modified

Legend:

Unmodified
Added
Removed
  • rdfalchemy/trunk/rdfalchemy/descriptors.py

    r116 r127  
    88""" 
    99 
    10 from rdflib import URIRef, BNode, Namespace, RDF 
     10from rdflib import URIRef, BNode, Namespace 
    1111from rdflib.Identifier import Identifier  
    1212from rdfalchemy import rdfSubject, Literal  
     
    1414 
    1515import logging 
     16 
     17__all__=["rdfSingle","rdfMultiple","rdfList","rdfContainer"] 
     18 
    1619#console = logging.StreamHandler() 
    1720#formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') 
    1821#console.setFormatter(formatter) 
    19  
    2022log=logging.getLogger(__name__) 
    2123#log.setLevel(logging.DEBUG) 
     
    297299            first=obj.db.value(base, RDF['_%d'%i]) 
    298300 
    299         val=[((isinstance(v,BNode) or isinstance(v,URIRef)) and self.range_class(v) or v.toPython()) for v in members] 
     301        val=[(isinstance(v,(BNode,URIRef)) and self.range_class(v) or v.toPython()) for v in members] 
    300302        obj.__dict__[self.name] = val 
    301303        return val 
  • rdfalchemy/trunk/rdfalchemy/engine/__init__.py

    r124 r127  
    6363        db=root['rdflib'] 
    6464    elif url.lower().startswith('sesame://'): 
    65         from rdfalchemy.sesame2 import SesameGraph 
     65        from rdfalchemy.sparql.sesame2 import SesameGraph 
    6666        db = SesameGraph("http://"+url[9:]) 
    6767    elif url.lower().startswith('sparql://'): 
  • rdfalchemy/trunk/rdfalchemy/__init__.py

    r107 r127  
    1 from rdflib import Namespace 
     1from rdflib import URIRef, BNode, Namespace, RDF 
    22from rdfalchemy.Literal import Literal 
    33from rdfalchemy.rdfSubject import rdfSubject 
  • rdfalchemy/trunk/rdfalchemy/Literal.py

    r124 r127  
    1616 
    1717################################################################################ 
    18 # Let's fix the logging.  this seems like a log of work... 
    19 # all that it does is not log rebinding errors  
    20 # We know about them ... and they confuse type citizenry 
     18# Let's fix the logging.  This seems like a lot of work... 
     19# all that it does is not log rebinding errors.  
     20# We know already about them ... and the warnings confuse the citizenry. 
    2121_log = logging.getLogger("rdflib") 
    2222if not _log.handlers: 
  • rdfalchemy/trunk/rdfalchemy/orm.py

    r98 r127  
    4444#def mapBase(baseclass): 
    4545#    """This maps all classes below baseclass as in mapper() 
    46 #    AND puts the dict of {rdf_type: mapped_class}  in an baseclass.type2class attribute""" 
    47 #    baseclass.type2class = mapper(allsub(baseclass)) 
     46#    AND puts the dict of {rdf_type: mapped_class}  in an baseclass._type2class attribute""" 
     47#    baseclass._type2class = mapper(*allsub(baseclass)) 
    4848     
  • rdfalchemy/trunk/rdfalchemy/rdfSubject.py

    r121 r127  
    5454        """The constructor tries hard to do return you an rdfSubject 
    5555 
    56         :param resUri: the *resource uri* can be one of 
     56        :param resUri: the "resource uri". If `None` then create an instance with a BNode resUri. 
     57        Can be given as one of 
    5758 
    5859           * an instance of an rdfSubject 
     
    6162           * an n3 bnode string like: "_:xyz1234"  
    6263         
    63         :param resUri: if None then create an instance with a BNode resUri 
    6464        :param kwargs: is a set of values that will be set using the keys to find the appropriate descriptor""" 
    6565         
  • rdfalchemy/trunk/test/sesame2_perf.py

    r102 r127  
    11from datetime import datetime 
    2 from rdfalchemy.sesame2 import SesameGraph 
     2from rdfalchemy.sparql.sesame2 import SesameGraph 
    33 
    44import logging  
  • rdfalchemy/trunk/test/sesame2_test.py

    r116 r127  
    1 from rdfalchemy.sesame2 import SesameGraph 
     1from rdfalchemy.sparql.sesame2 import SesameGraph 
    22 
    33url = 'http://www.openvest.com:8080/openrdf-sesame/repositories/Portfolio/'