Search code examples
sparqlvirtuosoinference

Default RDFS inference in Virtuoso 7.x


This is a question about simple RDFS inference in Virtuoso 7.1 and DBpedia. I have a Virtuoso instance which was installed using this link as a reference. Now if I query the endpoint with the following query :

Select ?s 
where { ?s a <http://dbpedia.org/ontology/Cricketer> . }

I get a list of Cricketers that are present in DBpedia. Suppose I want all the athletes (all sports and cricketers included, where Athlete is rdfs:superClassOf Cricketer), I just try the query

Select ?s 
where { ?s a <http://dbpedia.org/ontology/Athlete> . }

For this I get all the correct answers. However I have an issue with rdfs:subPropertyOf. For example the property <http://dbpedia.org/ontology/capital> is the sub-property of <http://dbpedia.org/ontology/administrativeHeadCity>. So suppose I want all the capitals and the administrative head cities and I issue the query

Select ?s ?o 
where { ?s <http://dbpedia.org/ontology/administrativeHeadCity> ?o . }

I get zero results. Why is it that subproperty inference isn't working in DBpedia? Is there something else that I have missed?


Solution

  • You've missed a couple of things.

    First, Virtuoso is at 7.2.4 as of April 2016, and this version is strongly recommended over the old version from 2014, for many reasons.

    @AKSW's advice about Property Paths will work much better with this later version, too.

    Then, you can use inference on the DBpedia endpoint (including your local mirror), through the input:inference pragma, as shown on the live results of the query shown below --

    DEFINE input:inference "http://dbpedia.org/resource/inference/rules/dbpedia#"
    
    SELECT ?place ?HeadCity 
    WHERE
      {
         ?place  <http://dbpedia.org/ontology/administrativeHeadCity>  ?HeadCity
      }
    ORDER BY ?place ?HeadCity
    

    You can also see a list of predefined inference rule sets.

    And... more of the relevant documentation.

    (ObDisclaimer: I work for OpenLink Software, producer of Virtuoso.)