Some OWL snippets:

<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:p="http://example.org/pers-schema#">
  <rdf:Description rdf:about="http://example.org/~jdoe#jane">
    <p:knows rdf:resource="http://example.org/~jsmith#john" />
    <p:name>Jane Doe</p:name>
    <rdf:type
         rdf:resource=”http://example.org/pers-schema#Person”/>
  </rdf:Description>
</rdf:RDF>

Describes Jane == http://example.org/~jdoe#jane.
Jane’s name is Jane Doe. Jane is a person. Jane knows http://example.org/~jsmith#john.


<rdf:RDF xml:base="http://example.org/~jdoe"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:p="http://example.org/pers-schema#">
  <p:Person rdf:about="#jane">
    <p:knows rdf:resource="http://example.org/~jsmith#john" />
    <p:name>Jane Doe</p:name>
  </p:Person>
</rdf:RDF>

Represents the same info as previous but uses base attr and relative references.


<!DOCTYPE rdf:RDF [<!ENTITY owl "http://www.w3.org/2002/07/owl#">]>
<rdf:RDF xmlns:owl="http://www.w3.org/2002/07/owl#"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="">
        <rdfs:label>My Ontology</rdfs:label>
        <rdfs:comment>An example ontology</rdfs:comment>
    </owl:Ontology>

    <owl:Class rdf:ID="Person"/>

    <owl:Class rdf:ID="Man"/>
        <rdfs:subClassOf rdf:resource="#Person"/>
    </owl:Class>

    <owl:ObjectProperty rdf:ID="hasChild"/>

    <owl:ObjectProperty rdf:ID="hasDaughter">
        <rdfs:subPropertyOf rdf:resource="#hasChild"/>
    </owl:ObjectProperty>

    <owl:DatatypeProperty rdf:ID="age"/>

    <owl:ObjectProperty rdf:ID="isParentOf">
        <owl:inverseOf rdf:resource="#isChildOf"/>
    </owl:ObjectProperty>

    <owl:ObjectProperty rdf:ID="isTallerThan">
        <rdf:type rdf:resource="&owl;TransitiveProperty"/>
    </owl:ObjectProperty>

    <owl:ObjectProperty rdf:ID="isFriendOf">
        <rdf:type rdf:resource="&owl;SymmetricProperty"/>
    </owl:ObjectProperty>

    <owl:ObjectProperty rdf:ID="hasSSN">
        <rdf:type rdf:resource="&owl;FunctionalProperty"/>
        <rdf:type rdf:resource="&owl;InverseFunctionalProperty"/>
    </owl:ObjectProperty>
</rdf:RDF>

Object properties specify relationships between pairs of resources. Datatype properties, on the other hand, specify a relation between a resource and a data type value.

…owl:InverseFunctionalProperty specifies a property that can be used as a primary key.

  • Man is a Person.
  • hasDaughter is a subclass of hasChild.
  • age: not an ObjectProperty. it is a data property.
  • isParentOf and isChildOf: if A isParentOf B –> B isChildOf A
  • isTallerThan: if A>B and B>C –> A>C
  • isFriendOf: if A♥B –> B♥A
  • hasSSN is both an owl:FunctionalProperty (because each person has at most one Social Security Number) and an owl:InverseFunctionalProperty (because a Social Security Number can be used to uniquely identify U.S. citizens).

<p:Person rdf:about=”http://www.cse.lehigh.edu/~heflin/ >
   <owl:sameAs
         rdf:resource=”http://www.cs.umd.edu/~heflin/” />
</p:Person>

They’re the same thing.


<owl:AllDifferent>
   <owl:distinctMembers rdf:parseType=”Collection”>
      <p:Person rdf:about=”#Bob” />
      <p:Person rdf:about=”#Sue” />
      <p:Person rdf:about=”#Mary” />
      ...
   </owl:distinctMembers>
</owl:AllDifferent>

These are all different


<owl:Class rdf:ID=”Father”>
   <owl:intersectionOf rdf:parseType=”Collection”>
      <owl:Class rdf:about=”#Parent” />
      <owl:Class rdf:about=”#Male” />
   </owl:intersectionOf>
</owl:Class>

Father is a male and parent. Didn’t use subClassOf Parent && subClassOf Male here since we want to show that someone is father just because of the gender and parenthood. Using subClassOf like that would mean all fathers must be parent and male. It doesn’t mean fatherhood is gained with being a male and a parent.


<owl:Class rdf:ID=”Man”>
  <owl:intersectionOf rdf:parseType=”Collection”>
    <owl:Class rdf:about=”#Person”>
    <owl:Class>
       <owl:complementOf rdf:resource=”#Woman” />
    </owl:Class>
  </owl:intersectionOf>
<owl:Class>

Any person not woman are man. It is important to intersect with Person as well. Because, not a piece of bread is not a woman but not a man too.


<owl:Class rdf:ID=”Band”>
  <rdfs:subClassOf>
    <owl:Restriction>
       <owl:onProperty rdf:resource=”#hasMember” />
       <owl:allValuesFrom rdf:resource=”#Musician” />
    </owl:Restriction>
  </rdfs:subClassOf>
</owl:Class>

Band is a subClassOf the anonymous class defined by the restriction. The restriction says a band member must be a musician.

Snippet above doesn’t say though, a group of musicians is a band.


<owl:Class rdf:ID=”Male”>
    <owl:disjointWith rdf:resource=”#Female”>
</owl:Class>

This is not the same with complementOf. complementOf would mean anything that is not male is female. A piece of wood is not male nor female!


<owl:Class rdf:ID=”PrimaryColor”>
    <owl:oneOf rdf:parseType=”Collection”>
        <owl:Thing rdf:about=”#Red” />
        <owl:Thing rdf:about=”#Blue” />
        <owl:Thing rdf:about=”#Yellow” />
   </owl:oneOf>
</owl:Class>

Self explanatory…


<owl:Ontology rdf:about="">
  <rdfs:label>News Ontology, v. 2.0</rdfs:label>
  <owl:imports
          rdf:resource="http://example.org/onts/person" />
  <owl:backwardCompatibleWith
          rdf:resource=”http://example.org/onts/news-v10” />
</owl:Ontology>

Imports person ontology.


<p:Person rdf:about=”#Bob”>
   <p:hasMom rdf:resource=”#Sue” />
   <p:hasMom rdf:resource=”#Mary” />
</p:Person>

OWL doesn’t make unique names assumption. Statement above infers that Sue and Mary is the same person.

OWL/Ontology terms

From http://mowl-power.cs.man.ac.uk/protegeowltutorial/resources/ProtegeOWLTutorialP4_v1_3.pdf

  • Individuals, represent objects in the domain in which we are interested (e.g. Matt, US, Turkey, Fido, Fluffy)
  • OWL classes are interpreted as sets that contain individuals (e.g. country, person)
  • Properties are binary relations3 on individuals - i.e. properties link two individuals together (e.g. Matt livesIn Turkey, Matt hasPet Fluffy)
  • The word concept is sometimes used in place of class. Classes are a concrete representation of concepts.
  • A class hierarchy may also be called a taxonomy.
  • OWL Properties represent relationships. There are two main types of properties, Object properties and Datatype properties.
    • Object properties are relationships between two individuals. (Matt hasSister Jane)
    • Data properties: (Matt hasAge 31)
    • OWL also has a third type of property – Annotation properties: can be used to add information (metadata — data about data) to classes, individuals and object/datatype properties. (JetEngine dc:creator Matthew Somebody)
  • property characteristics
    • Functional Properties:
      • Functional properties are also known as single valued properties and also features. ()
      • for a given individual, there can be at most one individual that is related to the individual via the property
      • e.g. Jean hasBirthMother Margaret
    • Inverse Functional Properties:
      • inverse property is functional
      • e.g. isBirthMotherOf is inverse functional
    • Transitive Properties
      • If the individual Matthew has an ancestor that is Peter, and Peter has an ancestor that is William, then we can infer that Matthew has an ancestor that is William
      • If a property is transitive then its inverse property should also be transitive.
      • if a property is transitive then it cannot be functional
    • Symmetric Properties
      • Matt hasSibling Jane
      • Jane hasSibling Matt
    • Asymmetric properties
      • Robert is a child of David, then David cannot be a child of Robert
    • Reflexive properties
      • A property P is said to be reflexive when the property must relate individual a to itself
        • George knows George
        • George knows Matt
      • e.g. isBirthMotherOf cannot be reflexive
    • Irreflexive properties
      • it can be described as a property that relates an individual a to individual b, where individual a and individual b are not the same
      • e.g. isBirthMotherOf
  • Properties link individuals from the domain to individuals from the range.
    • domain of the hasTopping property is Pizza
    • range of the hasTopping property PizzaTopping (w/ subclass hierarchy)
  • In general, domain for a property is the range for its inverse, and the range for a property is the domain for its inverse.

  • Property Restrictions
    • Quantifier Restrictions
      • existential restrictions
        • by far the most common type of restrictions in OWL ontologies.
        • Existential restrictions describe classes of individuals that participate in at least one relationship along a specified property to individuals that are members of a specified class.
        • hasTopping some MozzarellaTopping: This restriction describes the class of individuals that have at least one topping that is Mozzarella.
        • hasBase some PizzaBase: all of the individuals that have at least one pizza base
      • universal restrictions
        • Universal restrictions describe classes of individuals that for a given property only have relationships along this property to individuals that are members of a specified class.
        • Individuals that are members of VegetarianPizza can only have toppings that are CheeseTopping or VegetableTopping.
    • Cardinality Restrictions
      • class of individuals that have at least, at most or exactly a specified number of relationships with other individuals or datatype values
    • hasValue Restrictions
      • they describe relationships between an individual and data values.
  • necessary conditions : Cheesy pizza is a pizza and it has cheese topping
    • With necessary conditions alone, we cannot say that, “If something fulfills these conditions then it must be a member of this class”
    • Primitive class: a class that only has necessary conditions
    • Necessary conditions are called Superclasses in Protege
  • necessary and sufficient conditions :
    • Cheesy pizza is a pizza and it has cheese topping and anything that is pizza and that has cheese topping is a cheesy pizza
    • necessary and sufficient conditions are called Equivalent classes in Protege
    • Defined Class: a class that has at least one set of necessary and sufficient conditions
comments powered by Disqus