0

I have the following setting:

  1. an owl-ontology (accessed via owlready with this class hierarchy:
owl:Thing
├── ClassA1
└── ClassB1
    └── ClassB2
        └── ClassB3
            └── ClassB4
  1. one instance of each class, say A1, B1 , etc.
  2. a property prop1 which relates A1 to B4: prop1(A1, B4)

I want a SWRL-rule which, given prop1(A1, B4), relates A1 to B3 and B2 via prop1.

I imagine there must be something like this (partially invented syntax):

ClassA(?a), prop1(?a, ?i1), rdfs:type(?i1, ?c),
direct_subclass(?c ,?d), rdfs:type(?i2, ?d), not rdfs:type(?i2, ClassB1) -> prop(?a, ?i2)

However, I did not find anything about "variables representing classes" in SWRL (cf direct_subclass(?c, ?d) or rdfs:type(?i2, ?d)).

How can I formulate my rule?

cknoll
  • 2,130
  • 4
  • 18
  • 34
  • *"relates A1 to B3 and B2 via prop1"* — And why not to B1? – Stanislav Kralin Apr 10 '21 at 16:58
  • @StanislavKralin because in my use case I need only some of the relations. To make this clear I introduced ClassB1. – cknoll Apr 10 '21 at 22:20
  • 1
    that is not possible with SWRL, classes denote unary predicates, and SWRL extends OWL, thus, `rdf:type` is opaque to any SWRL library/reasoner. Pellet or HermiT won't work. There are some [non-standard extensions](https://github.com/protegeproject/swrlapi/wiki/SWRLABoxBuiltInLibrary) in the SWRLAPI, though, it's supposed to be used for SQWRL and neither Pellet or HermiT would work with it. – UninformedUser Apr 11 '21 at 10:15
  • 2
    Moreover, you negation would lead to another issue as the Open World Assumption also holds for SWRL inference similar to OWL inference. Absence of information isn't handled as the negation of a fact. – UninformedUser Apr 11 '21 at 10:16
  • 1
    Honestly, you should consider of other approaches like SHACL or plain SPARQL CONSTRUCT query or other rule language supported by some triple stores. I'm pretty sure (though other smarter people might correct me) that what you want isn't possible with OWL axioms and/ore SWRL rules and thus won't work with any OWL reasoner. Even the `direct_subclass` is some kind of non-standard inference which you cannot model in OWL/SWRL as far as I know – UninformedUser Apr 11 '21 at 10:19

0 Answers0