There is a simple query for which I am not getting the expected results.
I have created a class my:ShortMale
which is a sub class of ex:Human
. Then ex:Human
is a sub class of ex:LivingThing
. When I query with my:ShortMale rdfs:subClassOf* ex:LivingThing
there is no binding. Only when I use reasoning there is.
However, I don’t think reasoning is necessary with rdfs:subClassOf*
: I have an ex:Male
which has exactly the same amount of triples and I am getting results with ex:Male rdfs:subClassOf* ex:LivingThing
.
It doesn’t seem logical to me, am I making a mistake or what can be happening?
I have prepared an example:
Query with my:ShortMale
which doesn’t state isLiving.
SELECT *
WHERE {
my:ShortMale ?p ?o
OPTIONAL {
my:ShortMale rdfs:subClassOf* ex:Human . BIND("true" AS ?isHuman)
}
OPTIONAL { my:ShortMale rdfs:subClassOf* ex:LivingThing . BIND("true" AS ?isLiving)}
OPTIONAL { ex:Human rdfs:subClassOf* ex:LivingThing . BIND("true" AS ?HumanIsLiving) }
}
Results:
p o isHuman isLiving HumanIsLiving
rdf:type owl:Class true true
rdfs:label Short male true true
rdfs:comment A short male true true
rdfs:subClassOf ex:Human true true
Query with ex:Male
which does state isLiving.
SELECT *
WHERE {
ex:Male ?p ?o
OPTIONAL {
ex:Male rdfs:subClassOf* ex:Human . BIND("true" AS ?isHuman)
}
OPTIONAL { ex:Male rdfs:subClassOf* ex:LivingThing . BIND("true" AS ?isLiving)}
OPTIONAL { ex:Human rdfs:subClassOf* ex:LivingThing . BIND("true" AS ?HumanIsLiving) }
}
Results:
p o isHuman isLiving HumanIsLiving
rdf:type owl:Class true true true
rdfs:label Male true true true
rdfs:comment A male true true true
rdfs:subClassOf ex:Human true true true