# Difficulties on a simple query involving inference / subclassing

**URL:** <https://community.stardog.com/t/difficulties-on-a-simple-query-involving-inference-subclassing/2710>\
**Category:** Support\
**Created:** [September 16, 2020, 4:11pm UTC](https://community.stardog.com/t/difficulties-on-a-simple-query-involving-inference-subclassing/2710 "2020-09-16T16:11:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LarsAC](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/larsac/32/829_2.png) [@LarsAC](https://community.stardog.com/u/LarsAC)\
**Post date:** [September 16, 2020, 4:11pm UTC](https://community.stardog.com/t/difficulties-on-a-simple-query-involving-inference-subclassing/2710/1 "2020-09-16T16:11:02Z")

</div>

Hello,

I have some difficulties on a trivial query across subclasses using inferencing. For data

```
grt:ClinicalTrial rdf:type owl:Class .

:studies rdf:type owl:Class .
:studies owl:subClassOf grt:ClinicalTrial .

grt:A a :studies .
grt:B a grt:ClinicalTrial .

```

I had expected the following query to return A and B:

```
SELECT ?s
WHERE
{
    ?s a grt:ClinicalTrial .
    # ?s ?p ?o .
}

```

However, the query (targeted at local context) only yields B. Why does it not return A as well ? Inferencing is turned on in the query window and I have tried both SL and RDFS. Am I lacking something in my data model ?

Ultimately, I would like it to run across two virtual graphs. I can query them individually just fine, but am failing to query for ClinicalTrial from virtual graph 1 and have returned also the studies from a second virtual graph. But it does not seem to be related to virtual graphs, but to inferencing on subclasses in general.

Lars

---

<div class="post-metadata">

**Author:** ![jess](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/jess/32/10_2.png) [@jess](https://community.stardog.com/u/jess)\
**Post date:** [September 16, 2020, 5:04pm UTC](https://community.stardog.com/t/difficulties-on-a-simple-query-involving-inference-subclassing/2710/2 "2020-09-16T17:04:25Z")

</div>

I think you want rdfs:subClassOf. It's not in the owl namespace

---

<div class="post-metadata">

**Author:** ![LarsAC](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/larsac/32/829_2.png) [@LarsAC](https://community.stardog.com/u/LarsAC)\
**Post date:** [September 16, 2020, 5:30pm UTC](https://community.stardog.com/t/difficulties-on-a-simple-query-involving-inference-subclassing/2710/3 "2020-09-16T17:30:21Z")

</div>

Thanks, it works now as expected. Stupid copy-paste error I need to reframe having worked a lot with syntax checking compilers ... 🙂

Lars

---

<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:** [September 30, 2020, 5:30pm UTC](https://community.stardog.com/t/difficulties-on-a-simple-query-involving-inference-subclassing/2710/4 "2020-09-30T17:30:22Z")

</div>

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