We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I try to follow the tutorial, and I passed the Magic Set Method, but I am now stuck in Backward-chaining Inference section.
I followed the steps :
>>> from FuXi.SPARQL.BackwardChainingStore import TopDownSPARQLEntailingStore >>> from FuXi.Horn.HornRules import HornFromN3 >>> from rdflib import Graph >>> from rdflib import Namespace >>> import pprint >>> famNs = Namespace('http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#') >>> nsMapping = {u'fam' : famNs} >>> rules = HornFromN3('http://dev.w3.org/2000/10/swap/test/cwm/fam-rules.n3') >>> factGraph = Graph().parse('http://dev.w3.org/2000/10/swap/test/cwm/fam.n3', format='n3') >>> factGraph.bind(u'fam',famNs) >>> dPreds = [famNs.ancestor] >>> topDownStore = TopDownSPARQLEntailingStore(factGraph.store, ... factGraph, ... idb=rules, ... derivedPredicates=dPreds, ... nsBindings=nsMapping) >>> targetGraph = Graph(topDownStore) >>> targetGraph.bind(u'ex', famNs) >>> pprint(list(targetGraph.query('''SELECT ?ANCESTOR { fam:david fam:ancestor ?ANCESTOR }''',initNs=nsMapping))) []
After checking a bit, it appears that topDownStore is correctly initialized:
>>> topDownStore.edb.serialize(format='n3') @prefix : <http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#> . @prefix fam: <http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . fam:albert fam:begat fam:bevan, fam:bill . fam:bertha fam:begat fam:carol, fam:charlie . fam:bevan fam:begat fam:chaude, fam:christine . fam:bill fam:begat fam:carol, fam:charlie . fam:christine fam:begat fam:david, fam:diana, fam:douglas .
But the problem rather comes when initializing the targetGraph:
>>> targetGraph = Graph(topDownStore) >>> targetGraph.bind(u'ex', famNs) >>> targetGraph.serialize(format='n3') @prefix ex: <http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#> . @prefix fam: <http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
I suppose there had been some changes in the way rdflib.Graph deals with store, but I wasn't able to find anything relevant about it...
Thanks
The text was updated successfully, but these errors were encountered:
Test for issue #8 #8
aeaf433
I added a test for this issue: aeaf433
Sorry, something went wrong.
Just for clarity, the tutorial reports that the results should be:
>>> pprint(list(targetGraph.query( 'SELECT ?ANCESTOR { fam:david fam:ancestor ?ANCESTOR }',initNs=nsMapping))) [rdflib.URIRef('http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#albert'), rdflib.URIRef('http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#bevan'), rdflib.URIRef('http://dev.w3.org/2000/10/swap/test/cwm/fam.n3#christine')]
No branches or pull requests
I try to follow the tutorial, and I passed the Magic Set Method, but I am now stuck in Backward-chaining Inference section.
I followed the steps :
After checking a bit, it appears that topDownStore is correctly initialized:
But the problem rather comes when initializing the targetGraph:
I suppose there had been some changes in the way rdflib.Graph deals with store, but I wasn't able to find anything relevant about it...
Thanks
The text was updated successfully, but these errors were encountered: