A few noteworthy changes checked in last night:
1) (Per earlier thread): Added support for Literal casting to and from
python datatypes (in the constructor and in a toPython function).
2) Literal.__repr__ changed to conform to Python convention
3) Added rdflib.sparql.bison.SPARQLEvaluation module which implements
the neccessary evaluation hooks between the SPARQL BisonGen parser and
the latest version of sparql-p
4) Added NotImplemented Exception framework for SPARQL patterns that
are *currently* not supported (either because sparql-p cannot support
them - nested UNIONs/OPTIONALs - or because the corresponding sparql-p
functionality has yet to be hooked up)
5) The DAWG test suite bootstrap code has been updated to initialize a
graph with the corresponding test data before parsing *and* evaluating
the SPARQL query.
SPARQL Evaluation example:
from rdflib.sparql.bison import Evaluate,Parse
from rdflib.Graph import ConjunctiveGraph
... setup 'rdflib.store.Store' instance ..
g=ConjunctiveGraph(store)
g.parse(StringIO(...),format='...')
print Evaluate(store,Parse('..SPARQL Query..'))
Output for DAWG test case:
### data/Optional/q-opt-1.rq ###
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?mbox ?name
{
?x foaf:mbox ?mbox .
OPTIONAL { ?x foaf:name ?name } .
}
### Source Graph: ###
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
_:a foaf:mbox <mailto:[EMAIL PROTECTED]> .
_:a foaf:name "Alice" .
_:a foaf:nick "WhoMe?" .
_:b foaf:mbox <mailto:[EMAIL PROTECTED]> .
_:b foaf:name "Bert" .
_:e foaf:mbox <mailto:[EMAIL PROTECTED]> .
_:e foaf:nick "DuckSoup" .
<Parititioned MySQL N3 Store: 1 context(s), 0 classification(s), 4
property/value assertion(s), and 3 other relation(s)>
[(u'mailto:[EMAIL PROTECTED]',
rdflib.Literal('Alice',language=None,datatype=None>),
(u'mailto:[EMAIL PROTECTED]', None), (u'mailto:[EMAIL PROTECTED]',
rdflib.Literal('Bert',language=None,datatype=None>)]
_______________________________________________
Dev mailing list
[email protected]
http://rdflib.net/mailman/listinfo/dev