Skip to content

TripleStoreReasoner - Instance retrieval for indirect individuals need further subclass reasoning #571

Description

@alkidbaci

When retrieving instances using the TripleStoreReasoner, the direct argument specifies whether we also consider indirect individuals classified by the given class expression.

To do this, the reasoner has to consider the class hierarchy. In our case, we convert the class expression to a SPARQL query using owlapy's Owl2SparqlConverter. For the indirect individuals (i.e. when direct=False) we follow a simple and basic solution which is incomplete: we replace the root variable like in the following example:

?x a :A .

# to

?x a ?some_cls .
?some_cls rdfs:subClassOf* :A .

A concrete example is given the class expression Grandfather ⊓ (∃ hasChild.Grandparent), which will be initially converted to a SPARQL query and depending on the direct argument the replacement of the root variable takes place:

# from

SELECT
 DISTINCT ?x WHERE { 
?x a <http://www.benchmark.org/family#Grandfather> . 
?x <http://www.benchmark.org/family#hasChild> ?s_1 . 
?s_1 a <http://www.benchmark.org/family#Grandparent> . 
 }

# to (because of direct=False)

SELECT
 DISTINCT ?x WHERE { 
?x a ?some_cls. 
 ?some_cls <http://www.w3.org/2000/01/rdf-schema#subClassOf>* <http://www.benchmark.org/family#Grandfather> . 
?x <http://www.benchmark.org/family#hasChild> ?s_1 . 
?s_1 a <http://www.benchmark.org/family#Grandparent> . 
 }

Notice the last line still stays the same. Replacing every possible type check is not a straightforward solution because of the dynamics of a class expression.

Summary:

  • SPARQL evaluation is performed under simple entailment
  • No subclass (rdfs:subClassOf) reasoning is applied during instance lookup
  • The reasoner assumes materialized type assertions, which are not present

Possible solutions:

  • Subclass-aware instance lookup using the ontology’s class hierarchy
  • Query-time expansion over subclass closures
  • Materialization or entailment-aware SPARQL as an alternative

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions