Search code examples
semantic-webowlinferencereasoningblazegraph

Why is owl:Restriction reasoning not working in Blazegraph?


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?


Solution

  • 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.