Not getting expected results with rdfs:subClassOf*

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

Can you share the data set that you’re querying?

I have been preparing some data to share, when I found out that it might be a bug in version 5.0.3. I have installed 5.3.0 and it does not seem to reproduce. I still have to do some more tests but it is looking promising. Thank you anyway.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.