Search code examples
ontologyprotege

How to say "zero or more" with OWL (in Protégé)


I'm a bit confused about how to make a restriction of "zero or more" in OWL (with Protégé)?

Suppose we have a Person, Order and OrderDetails class. There is a One-to-many relation between Person and Order (but a person could also have zero orders) An Order can have one or more OrderDetails.

The other way around an OrderDetail can only be part of one Order. An Order can only belong to one Person.

I'm especially stuck with the zero-or-more part. Is it with min cardinality 0? Seems unintuitive. Or don't I have to do anything? and not create a restriction for zero-or-more? I suspect that for one-or-more, I just need to use SomeValueFrom right.

Is this the following correct?

    <owl:Class rdf:about="http://www.example.org/ont/myMiniStore#Order">
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.example.org/ont/myMiniStore#hasParts"/>
            <owl:someValuesFrom rdf:resource="http://www.example.org/ont/myMiniStore#OrderDetails"/>
        </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.example.org/ont/myMiniStore#isOrderOf"/>
            <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
            <owl:onClass rdf:resource="http://www.example.org/ont/myMiniStore#Person"/>
        </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>



<!-- http://www.example.org/ont/myMiniStore#OrderDetails -->

<owl:Class rdf:about="http://www.example.org/ont/myMiniStore#OrderDetails">
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.example.org/ont/myMiniStore#isOrderOf"/>
            <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:qualifiedCardinality>
            <owl:onClass rdf:resource="http://www.example.org/ont/myMiniStore#Order"/>
        </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>



<!-- http://www.example.org/ont/myMiniStore#Person -->

<owl:Class rdf:about="http://www.example.org/ont/myMiniStore#Person">
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.example.org/ont/myMiniStore#hasOrder"/>
            <owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:minQualifiedCardinality>
            <owl:onClass rdf:resource="http://www.example.org/ont/myMiniStore#Order"/>
        </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>

I'm probably thinking too much with DB relations, so any tips about one-to-one, one-to-many relations are welcome!

I really appreciate it!

Regards,


Solution

  • Saying

    Class: Person
         SubClassOf: 
             hasOrder some Order
    

    is equivalent to saying

    Class: Person
         SubClassOf: 
             hasOrder min 1 Order
    

    Adding the restriction hasOrder min 0 Order will have no effect. To see this think of personA who have zero orders and personB with some orders. You will for example not be able to infer that personB is a customer and personA is not.

    If need be, a way that you could model this is:

    Class: Person
    
    Class: Customer
         SubClassOf:
             Person,
             hasOrder min 1 Order
    
    Class: NonCustomer
         SubClassOf:
             Person,
             hasOrder max 0 Order
    
    
     Individual: personA
         Types: 
             hasOrder max 0 Order
    
     Individual: booksOrder
         Types:
             Order
    
     Individual: personB
         Facts: 
             hasOrder booksOrder 
    

    In this case you will be able to infer that personB is a customer, but to infer that personA is not a customer you have to explicitly state personA has no orders (i.e Types: hasOrder max 0 Order). This is where database thinking (closed world assumption) is different to Protege thinking (open world assumption). In a DB absence of information often assumes that that information does not exist whereas in Protege the assumption is that the information is just not known but may exist.