Sunday, April 03, 2005

owl:minCardinality is not minUtility

The open world assumption can cause initial confusion to people trying to get to grips with the semantic web. The OWA states, in essence, that just because you don't know something to be true, you can't assume it to be false. For example, let's assume that Mary says her father is Fred (call this S1). She also says that her father is George (S2). If Fred and George actually referred to two different people, Mary's statements would be inconsistent because people only have one father (well, under normal conditions). But, if we knew that Fred was known as George to his work-mates, for whatever reason, so that Fred owl:sameAs George is true, Mary is being consistent. Let's call that equality S3. The Open World Assumption states that knowing only S1 and S2, we can't assume the negation of S3 (written ¬S3). The Closed World Assumption (CWA) allows us to infer ¬S3 if we don't actually know whether S3 is true or false. The CWA is also referred to as negation as failure, and will be familiar to anyone who has ever programmed in Prolog. Note that there's a separate-but-related idea, also well-discussed ontology design, called the unique names assumption. The UNA means that things with different names are always different, even under the open world assumption. If the UNA applied, statement S3 would automatically be a contradiction. OWL explicitly makes the open world assumption and not the unique names assumption. This entry, however, is about the OWA.

So far, so good. Now, let's suppose the following:

  <owl:Class rdf:ID="Person">
    <rdfs:subClassOf>
      <owl:Restriction>
        <owl:onProperty rdf:ID="hasParent"/>
        <owl:minCardinality rdf:datatype="&xsd;int">1</owl:minCardinality>
      </owl:Restriction>
    </rdfs:subClassOf>
  </owl:Class>
  <Person rdf:ID="mary"/>

For readers not familiar with OWL, this says, roughly, "the class Person is a sub-class of the class of all things that have at least one parent". That is, all Persons have at least one parent, but there may be some things that have at least one parent that are not Persons. Moreover, we note that Mary is a person. Many people, particularly those used to XML-Schema validation, would expect an OWL validator to complain that Mary doesn't have a declared parent, in violation of the class description. Indeed, this is a frequently asked question on the jena-dev list. But the OWA means that just because we don't know, in this local fragment of the knowledge base, that Mary has a parent we can't assume that she doesn't have one at all. Mary's parent might be declared in some other KB that isn't current visible to whoever or whatever is doing the reasoning. In fact, OWL reasoners (including Jena's built-in rule reasoner) will deduce that Mary does have at least one parent, we just don't know the identity of that parent yet.

Consequently, owl:minCardinality will rarely cause a validation error, and never on its own. So, does this mean that min cardinality has no value, or was put in by mistake, as some have suggested? No. The key point, I think, is that ontologies are not schema languages. Thinking of OWL as a complex data-description language leads to the wrong assumptions. One use for an OWL ontology is to let you make additional deductions about your instance data. In this case, min cardinality allows reasoners to infer class membership by classifying the instance data using the ontology. For example, in one of my ontologies I have:

  <owl:Class rdf:ID="AnyGoalStrategy">
    <rdfs:comment>A goal strategy in which any sub-goals can succeed</rdfs:comment>
    <owl:equivalentClass>
      <owl:Class>
        <owl:intersectionOf rdf:parseType="Collection">
          <owl:Class rdf:about="#GoalStrategy" />
          <owl:Restriction>
            <owl:onProperty rdf:resource="#any" />
            <owl:minCardinality rdf:datatype="&xsd;int">1</owl:minCardinality>
          </owl:Restriction>
        </owl:intersectionOf>
      </owl:Class>
    </owl:equivalentClass>
    <owl:disjointWith rdf:resource="#SequenceGoalStrategy" />
    <owl:disjointWith rdf:resource="#PerformGoalStrategy" />
  </owl:Class>

An AnyGoalStrategy instance is recognised as a GoalStrategy resource that has an any relation to a sub-goal. So I don't have to explicitly declare the types of my strategy objects, I just let the reasoner figure them out for me. It's just a small example, but I think it points the way to the utility of owl:minCardinality and other constructs, even in the presence of the open world assumption.

[Updated to correct a syntax error in the second example].

No comments: