Search code examples
owlsemantic-webontologyprotege

Is there a way to infer equivalence of two instances based on multiple asserted DataProperties


Say you have an ontology like the described below:

ex:Stick a owl:Class;

ex:hasWidth a owl:DataTypeProperty;
ex:hasHeight a owl:DataTypeProperty;

ex:Instance1 a ex:Stick;
    ex:hasWidth "1";
    ex:hasHeight "20".

ex:Instance2 a ex:Stick;
    ex:hasWidth "1";
    ex:hasHeight "20".

ex:Instance3 a ex:Stick;
    ex:hasWidth "2";
    ex:hasHeight "20".

ex:Instance4 a ex:Stick;
    ex:hasWidth "1";
    ex:hasHeight "30".

Now I am looking for a way to infer that ex:Instance1 owl:SameAs ex:Instance2 and none of the others are equivalent but it seems like I cannot access the values of an individual to compare it to others.

I have tried using the owl:HasKey function but this can only take one dataTypeProperty at a time and not the combination of multiple DataProperties. When you add a owl:HasKey statement for both hasWidth and hasHeight your ontology will become inconsistent in the cases of ex:Instance3 and ex:Instance4 in combination with ex:Instance1 and ex:Instance2.


Solution

  • I have tried using the owl:hasKey function but this can only take one DatatypeProperty at a time and not the combination of multiple data properties.

    In Protégé, use comma:

    three Protege views

    Manchester syntax:

    Class: Stick
        HasKey: hasHeight, hasWidth
    

    Turtle syntax:

    :Stick a owl:Class ;
           owl:hasKey ( :hasHeight :hasWidth ) .
    

    More info: 9.5 Keys.


    Using SWRL:

    hasHeight(?x, ?h) ^ hasHeight(?y, ?h) ^ hasWidth(?x, ?w) ^ hasWidth(?y, ?w) -> sameAs(?x, ?y)