owlontologyprotegeswrl

Protege: Anonymous class to subsume all classes not participate in a relation


Suppose there is 4 classes: a,b,c, d. and we have a has_relation some b.

I can define c as : has_relation some b to subsume a as its subclass.

but what if i want that the c to have d as its subclass.

(I know not(a has_relation some b) is not a true answer as d is not explicitly defined to has or has not any relation)


Solution

  • Strictly speaking this is not possible to infer due to the open world assumption. Thus, the only way to achieve this is by asserting that A is not related to B. Depending on the inferences you need, there are different ways to achieve this. In all cases you will need 2 relations: the first relation states that the relation does exist and the second relation states that the relation does not exist.

    Option 1

    If the inferences you require need to be applied to individuals, then you can specify it as follows:

    ObjectProperty: isRelatedByRelationXOption1
        DisjointWith: 
            isNotRelatedByRelationXOption1
    
    ObjectProperty: isNotRelatedByRelationXOption1
        DisjointWith: 
            isRelatedByRelationXOption1
    

    If you then specify that individuals x1 and y1 are related via both these relations, the reasoner will indicate an inconsistency:

    Individual: x1
        Facts:  
            isNotRelatedByRelationXOption1  y1,
            isRelatedByRelationXOption1  y1
    
    Individual: y1
    

    The potential disadvantage of defining the relations like this is that the following will not result in an inconsistency:

    Class: A
        SubClassOf: 
            isRelatedByRelationXOption1 some B
    
    Class: B
    
    Class: C
          SubClassOf: 
              A,
              isNotRelatedByRelationXOption1 some B
    

    If you want an inconsistency in this case, you will need to make use of Option 2.

    Option 2

    When we define the relations as below, class C will be unsatisfiable. Note that it is also not necessary to define the relations as Disjoint, except if you still want to detect individuals using both relations.

    ObjectProperty: isRelatedByRelationXOption2
        Domain: 
            A
    
    ObjectProperty: isNotRelatedByRelationXOption2
        Domain: 
            not (A)
    
     Class: A
        SubClassOf: 
             isRelatedByRelationXOption2 some B
    
     Class: B
    
     Class: C
         SubClassOf: 
             A,
             isNotRelatedByRelationXOption2 some B
    

    Option 3

    If you do not need to use Protege, you may want to consider using SHACL. See my answer on this Stackoverflow question.