I have these triples in my DB:

<http://www.co-ode.org/ontologies/ont.owl#myCar>
        a       owl:NamedIndividual , first:Car .
<http://www.co-ode.org/ontologies/ont.owl#Car>  a    owl:Class .
<http://www.co-ode.org/ontologies/ont.owl#myAutomobile>
        a       owl:NamedIndividual , first:Automobile .
<http://www.co-ode.org/ontologies/ont.owl#Automobile>  a          owl:Class ;
        owl:equivalentClass  first:Car .

I wat to retrieve all Car and Automobile individuals. Now I use this query:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>
PREFIX saref: <https://saref.etsi.org/core/>
PREFIX so: <http://purl.org/ontology/symbolic-music/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix cars: <http://www.w3.org/2002/03owlt/equivalentClass/premises001#>
SELECT DISTINCT ?s ?type Where {
  {
    SELECT ?s ?type WHERE
        {
          ?type owl:equivalentClass cars:Car .
        ?s rdf:type ?type
        }
  } UNION {
    SELECT ?s ?type WHERE
        {
        ?s rdf:type cars:Car .
        ?s rdf:type ?type
        }
  }
  FILTER(?type != <http://www.w3.org/2002/07/owl#NamedIndividual>)
}

The result is :

<http://www.co-ode.org/ontologies/ont.owl#myAutomobile> cars:Automobile
<http://www.co-ode.org/ontologies/ont.owl#myCar> cars:Car

which is ok. Apparently there is a different result if I use this query :

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>
PREFIX saref: <https://saref.etsi.org/core/>
PREFIX so: <http://purl.org/ontology/symbolic-music/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix cars: <http://www.w3.org/2002/03owlt/equivalentClass/premises001#>
SELECT DISTINCT ?s ?type Where {
  {
    SELECT ?s ?type WHERE
        {
          ?type owl:equivalentClass cars:Automobile .
        ?s rdf:type ?type
        }
  } UNION {
    SELECT ?s ?type WHERE
        {
        ?s rdf:type cars:Automobile .
        ?s rdf:type ?type
        }
  }
  FILTER(?type != <http://www.w3.org/2002/07/owl#NamedIndividual>)
}

In this case only
http://www.co-ode.org/ontologies/ont.owl#myAutomobile cars:Automobile
is returned. I'm using the OWLFBRuleReasoner together with the
GenericRuleReasoner as follows on top of a TDB2 dataset:

:modelInf rdf:type ja:InfModel;
    ja:baseModel :modelInfOwl ;
    ja:reasoner [
        ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner>
    ] ;
.

:modelInfOwl rdf:type ja:InfModel;
    ja:baseModel :tdbGraph ;
    ja:reasoner [
        ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
    ] ;
.

:tdbGraph rdf:type tdb2:GraphTDB ;
  tdb2:dataset siot:dataset .

What could wrong or done better at my end?

Thanks in advance, Johan,

Reply via email to