Search code examples
semantic-webowlontology

How to define a class that does not have two equivalent predicate objects?


I'm trying to define class of intervals. Each interval object may have (optionally) at most two boundary points. One of them - lower boundary, and another - upper boundary. How can I restrict my class of intervals, so that lower and upper individual boundary points must be different (if provided)?


Solution

  • You can declare that the hasLowerBound and hasUpperBound properties are disjoint. This means that an individual with values for both cannot have the same value for both. Here's an example. I've used an object property here, but you can use disjoint property axioms with datatype properties, too.

    disjoint property axiom in protege

    @prefix :      <http://stackoverflow.com/q/36043590/1281433/> .
    @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix owl:   <http://www.w3.org/2002/07/owl#> .
    @prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
    @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
    
    <http://stackoverflow.com/q/36043590/1281433/#hasLowerBound>
            a                         owl:ObjectProperty ;
            owl:propertyDisjointWith  <http://stackoverflow.com/q/36043590/1281433/#hasUpperBound> .
    
    <http://stackoverflow.com/q/36043590/1281433/#hasUpperBound>
            a       owl:ObjectProperty .
    
    <rdf:RDF
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns="http://stackoverflow.com/q/36043590/1281433/"
        xmlns:owl="http://www.w3.org/2002/07/owl#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
      <owl:ObjectProperty rdf:about="http://stackoverflow.com/q/36043590/1281433/#hasUpperBound"/>
      <owl:ObjectProperty rdf:about="http://stackoverflow.com/q/36043590/1281433/#hasLowerBound">
        <owl:propertyDisjointWith rdf:resource="http://stackoverflow.com/q/36043590/1281433/#hasUpperBound"/>
      </owl:ObjectProperty>
    </rdf:RDF>