Mon, 26 Sep, 2005
sparql-p goes to RDFLib: done
The 2.2.2 version of RDFLib has been released, and this includes my old
sparql-p as part of the distribution. Thanks again to Michel Pelletier.
There have been some small changes due to the merge. Whereas, in the separate sparql-p distribution, the main structure of the code was something like:
from rdflibUtils import myTripleStore
store = myTripleStore()
store.load("someRDFFile.rdf")
select = ("?a","?b","?c")
where = GraphPattern([("?a",P,"?x"),(Q,"?b","?a"),("?x",R,"?c")])
result = myTripleStore.query(select,where)
the new version looks as follows:
from rdflib.sparql import sparqlGraph
sparqlGr = sparqlGraph.SPARQLGraph()
sparqlGr.parse("someRDFFile.rdf") # or sparqlGr.load, these are synonyms
select = ("?a","?b","?c")
where = GraphPattern([("?a",P,"?x"),(Q,"?b","?a"),("?x",R,"?c")])
result = sparqlGr.query(select,where)
Not a big deal, but better be careful. I am sure that some other problems will pop up as we go, but this is a great start.
Work has also begun to include a SPARQL parser into the system, leading, eventually, to a full SPARQL implementation in RDFLib. That would be great…
Category: /WorkRelated/SemanticWeb/RDFLib; Posted at: 16:33 UTC; Permalink