Reasoner object property value inference on individuals

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Reasoner object property value inference on individuals

betelgeux
Greetings,

I am experiencing some issues with version 0.41 of owlready2 when working with an ontology file (which I can provide here shacl_test.owx). My primary focus is on inferring object properties between individuals using the Pellet and/or HermiT reasoners, with the infer_property_values option set to True. The ontology file contains several OWL subproperty and inverse property axioms. In Protegé, both reasoners produce the expected results, including the inferred object properties derived from inverse and subproperty axioms.

However, when using owlready2, I observed that the HermiT reasoner output (checked in the console) did not contain any inferred object properties, indicating an issue with HermiT. The input temp file appeared to be correct and similar to the one used in Protegé. The following command line was used for HermiT:

HermiT.jar org.semanticweb.HermiT.cli.CommandLine -c -O -D -I temp_file -Y

The functional OWL output did not include any object properties between individuals, with the exception of classification. For example :inLine properties and :containsPhenomenon properties are missing.

Regarding the Pellet reasoner, the direct output seems accurate (on console), containing all necessary inferred object properties. However, the output parsed by owlready2 seems to be missing some inferred properties, particularly those resulting from an inverse axiom. E.g. inferred :inLine property instances are there in the owlready2 ontology, but :containsPhenomenon properties are missing.The following command line input was used for Pellet:

pellet.Pellet realize --loader Jena --input-format N-Triples --infer-prop-values --ignore-imports temp_file

Any ideas on this?

Best,
Tamas
Reply | Threaded
Open this post in threaded view
|

Re: Reasoner object property value inference on individuals

Jiba
Administrator
Hello,

Simple inferences based only on subclass / subproperty relations or inverse relations are indeed not considered when performing reasoning.

Indeed, they are not needed in Owlready, because Owlready automatically takes into account inverse relations when getting the value of a property for an individual. And you can take into account subproperty relations by prefixing the property name with "INDIRECT_".

Here is an example:


from owlready2 import *

onto = get_ontology('http://test.org/t.owl')

with onto:
  class C(Thing): pass
  class p1(Thing >> Thing): pass
  class p2(p1): pass
  class i2(Thing >> Thing):
    inverse = p2

  c1 = C()
  c2 = C()

  c1.p2 = [c2]

print(c2.i2) # => [t.c1]

print(c1.INDIRECT_p1) # => [t.c2]