# Unexpected query result using reasoning

**URL:** <https://community.stardog.com/t/unexpected-query-result-using-reasoning/1217>\
**Category:** Support\
**Created:** [August 11, 2018, 8:13pm UTC](https://community.stardog.com/t/unexpected-query-result-using-reasoning/1217 "2018-08-11T20:13:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndyVanDerHoeven](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@AndyVanDerHoeven](https://community.stardog.com/u/AndyVanDerHoeven)\
**Post date:** [August 11, 2018, 8:13pm UTC](https://community.stardog.com/t/unexpected-query-result-using-reasoning/1217/1 "2018-08-11T20:13:47Z")

</div>

I have a very simple ontology that contains the following statements:  
:class\_x  
rdf:type owl:Class ;  
rdfs:comment "test class:this class is going to be renamed" ;  
rdfs:label "Test class" ;  
rdfs:subClassOf owl:Thing ;  
.  
:class\_x1  
rdf:type owl:Class ;  
rdfs:comment "test class:this class is the new name of classx" ;  
rdfs:label "Test class 1" ;  
rdfs:subClassOf owl:Thing ;  
owl:equivalentClass :class\_x ;  
.  
:class\_x\_individual  
rdf:type :class\_x ;  
.  
:class\_x\_property  
rdf:type owl:DatatypeProperty ;  
rdfs:comment "Test property for class\_x" ;  
rdfs:domain :class\_x ;  
rdfs:label "Test" ;  
rdfs:range xsd:string ;  
.

In addition, there is a bunch of other properties that are not in scope for the test and do not relate to any of the entities above:  
:international\_transport\_stops  
rdf:type owl:DatatypeProperty ;  
:catchment catchment:walk\_900s ;  
:feature geospatial:international\_transport\_stop ;  
:operation "count" ;  
system:technical\_label "international\_transport\_stops" ;  
rdfs:comment "Number of international public transport stops in a given catchment" ;  
rdfs:label "International Public Transport Stops" ;  
rdfs:range xsd:integer ;  
rdfs:subPropertyOf :scoring\_aggregations ;  
.  
:education  
rdf:type owl:DatatypeProperty ;  
:catchment catchment:car\_1200s ;  
:catchment catchment:car\_1500s ;  
:catchment catchment:car\_1800s ;  
:catchment catchment:car\_900s ;  
:catchment catchment:walk\_1800s ;  
:catchment catchment:walk\_900s ;  
:feature geospatial:education ;  
:operation "count" ;  
system:technical\_label "education\_facilities" ;  
rdfs:comment "Number of education facilities in a given catchment" ;  
rdfs:label "Education Facilities" ;  
rdfs:range xsd:integer ;  
rdfs:subPropertyOf :aggregations ;  
.  
etc

When I run the following query:  
select ?p  
where {  
?p rdfs:domain aggr:class\_x.}

without the reasoner, I get the :class\_x\_property as a result.  
However, turning on the reasoner results in a long list of properties, including :education and :international\_transport\_stop, owl:top and bottomProperty and the :class\_x\_property.

When running:  
stardog reasoning explain test C:\Users\avand\Documents\Software\stardog-5.3.3\oops\reasoning.ttl  
whereas reasoning.ttl contains the following statement:  
[http://test.io/aggr#international\_transport\_stops](http://test.io/aggr#international_transport_stops) rdfs:domain [http://test.io/aggr#class\_x](http://test.io/aggr#class_x).

the result is:  
Input axiom is not inferred; nothing to explain.  
I am using reasoning type = SL and all the rest of options is default in that section.

---

<div class="post-metadata">

**Author:** ![pavel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/pavel/32/18_2.png) [@pavel](https://community.stardog.com/u/pavel)\
**Post date:** [August 13, 2018, 1:16pm UTC](https://community.stardog.com/t/unexpected-query-result-using-reasoning/1217/2 "2018-08-13T13:16:09Z")

</div>

Hi Andreas.

Here’s what I got with a simpler version of your data (it’s at the end of the post):

```auto
$ sq test "select * {?p rdfs:domain <http://example.com/class_x> . }"
+-------------------+
| p |
+-------------------+
| :class_x_property |
+-------------------+

Query returned 1 results in 00:00:00.046
$ sq -r test "select * {?p rdfs:domain <http://example.com/class_x> . }"
+--------------------------+
| p |
+--------------------------+
| owl:bottomDataProperty |
| :class_x_property |
| owl:bottomObjectProperty |
+--------------------------+

Query returned 3 results in 00:00:00.060

```

The object bottom property is there because it is by definition unsatisfiable so its domain (that is, the empty set) is vacuously a subset of `class_x` (the presence of the bottom data property is likely a bug). But the main point is that I don’t get `:international_transport_stop` or `:education` with this.

My guess is there’re inferences via `rdfs:subPropertyOf` which follow from your data but not from the fragment you posted. In the extreme case the properties could be unsatisfiable and thus answers to the query. You can test that by running `:international_transport_stop rdfs:subPropertyOf ?p` or similar queries.

It’s a separate problem why the explanation fails. We’ll look into this once we understand how reasoning works in your case.

Cheers,  
Pavel

* * *

```auto
@prefix : <http://example.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#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:class_x
rdf:type owl:Class ;
rdfs:comment "test class:this class is going to be renamed" ;
rdfs:label "Test class" ;
rdfs:subClassOf owl:Thing .

:class_x1
rdf:type owl:Class ;
rdfs:comment "test class:this class is the new name of classx" ;
rdfs:label "Test class 1" ;
rdfs:subClassOf owl:Thing ;
owl:equivalentClass :class_x .

:class_x_individual
rdf:type :class_x .

:class_x_property
rdf:type owl:DatatypeProperty ;
rdfs:comment "Test property for class_x" ;
rdfs:domain :class_x ;
rdfs:label "Test" ;
rdfs:range xsd:string .

:international_transport_stops
rdf:type owl:DatatypeProperty ;
:operation "count" ;
rdfs:comment "Number of international public transport stops in a given catchment" ;
rdfs:label "International Public Transport Stops" ;
rdfs:range xsd:integer ;
rdfs:subPropertyOf :scoring_aggregations .

:education rdf:type owl:DatatypeProperty ;
:operation "count" ;
rdfs:comment "Number of education facilities in a given catchment" ;
rdfs:label "Education Facilities" ;
rdfs:range xsd:integer ;
rdfs:subPropertyOf :aggregations .

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [August 27, 2018, 1:16pm UTC](https://community.stardog.com/t/unexpected-query-result-using-reasoning/1217/3 "2018-08-27T13:16:12Z")

</div>

Closed on August 27, 2018, 1:16pm UTC

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