问题
With the following RDF in Blazegraph (taken from this answer):
:eats rdf:type owl:ObjectProperty .
:Vegetable rdf:type owl:Class ;
rdfs:subClassOf owl:Thing .
:Vegetarian rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Restriction ;
owl:onProperty :eats ;
owl:someValuesFrom :Vegetable
] .
:Carrot rdf:type :Vegetable ,
owl:NamedIndividual .
:John rdf:type owl:NamedIndividual , owl:Thing ;
:eats :carrot .
the following SPARQL is returning blank:
select ?who
where
{
?who a :Vegetarian .
}
Here are the Blazegraph namespace configs (Blazegraph is running as NanoSparqlServer from command line):
com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor 1024
com.bigdata.relation.container test-ng-2
com.bigdata.journal.AbstractJournal.bufferMode DiskRW
com.bigdata.journal.AbstractJournal.file bigdata.jnl
com.bigdata.journal.AbstractJournal.initialExtent 209715200
com.bigdata.rdf.store.AbstractTripleStore.vocabularyClass com.bigdata.rdf.vocab.DefaultBigdataVocabulary
com.bigdata.rdf.store.AbstractTripleStore.textIndex false
com.bigdata.btree.BTree.branchingFactor 128
com.bigdata.namespace.kb.lex.com.bigdata.btree.BTree.branchingFactor 400
com.bigdata.rdf.store.AbstractTripleStore.axiomsClass com.bigdata.rdf.axioms.OwlAxioms
com.bigdata.service.AbstractTransactionService.minReleaseAge 1
com.bigdata.rdf.sail.truthMaintenance true
com.bigdata.journal.AbstractJournal.maximumExtent 209715200
com.bigdata.rdf.sail.namespace test-ng-2
com.bigdata.relation.class com.bigdata.rdf.store.LocalTripleStore
com.bigdata.rdf.store.AbstractTripleStore.quads false
com.bigdata.relation.namespace test-ng-2
com.bigdata.btree.writeRetentionQueue.capacity 4000
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers true
What am I missing?
回答1:
There are some RDF syntax issues, but the underlying reason is that Blazegraph does not support OWL Reasoning out of the box. See current support. There has been some work towards and ELK Reasoner.
Regarding the RDF in this example, here's an update that is validated to load in Blazegraph 1.5.1. It incorporates the feedbackup above and adds namespaces. I created a properties (test.properties) file with your properties above and loaded Blazegraph with the executable jar from Sourceforge.
java -Xmx2g -Dbigdata.propertyFile=test.properties -jar bigdata-bundled.jar
Go to the workbench: http://localhost:9999/bigdata/ and paste the RDF below into the "Update" tab on the workbench selecting "RDF Data" with the format "Turtle".
@prefix : <http://stackoverflow.com/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
:eats rdf:type owl:ObjectProperty .
:Vegetable rdf:type owl:Class ;
rdfs:subClassOf owl:Thing .
:Vegetarian rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Restriction ;
owl:onProperty :eats ;
owl:someValuesFrom :Vegetable
] .
:Carrot rdf:type :Vegetable ,
owl:NamedIndividual .
:carrot rdf:type owl:NamedIndividual , owl:Thing, :Carrot .
:John rdf:type owl:NamedIndividual , owl:Thing ;
:eats :carrot .
If you then go to the query tab and run something like:
select * where { ?s ?p ?o }
You'll see all of the triples inferred by the OWLAxiomsVocabulary.
回答2:
The reason seems to be in the fact that in
:Carrot rdf:type :Vegetable ,
you start Carrot from a capital letter, but in
:eats :carrot .
you use lowercase letter.
回答3:
This data is not well formed yet:
:Carrot rdf:type :Vegetable ,
owl:NamedIndividual .
:John rdf:type owl:NamedIndividual , owl:Thing ;
:eats :carrot .
You'd also need to say that :carrot is an individual of type :Carrot, with an assertion like:
:carrot rdf:type owl:NamedIndividual , owl:Thing, :Carrot .
Then, since :carrot will be an instance of :Carrot, and :Carrot is a subclass of :Vegetable, you can infer that :carrot is an instance of :Vegetable, and thus that :John :eats some :Vegetable. If Blazegraph supports OWL reasoning (e.g., not just RDFS reasoning), that should be enough to let you infer that :John is a :Vegetarian (at least according to this non-standard definition of vegetarian).
来源:https://stackoverflow.com/questions/29806316/why-is-owlrestriction-reasoning-not-working-in-blazegraph