OWL

Chapter 5: Building Expressive Semantic Web Ontologies

Eng. Dr. Tiroshan Madushanka

What is OWL?

The Foundation of Semantic Web Ontologies

Core Concept

OWL = RDF Schema + New Constructs for Expressiveness

OWL is the latest W3C recommendation and the most popular language for creating ontologies today.

Key Features

  • Built on top of RDF Schema - all RDFS classes and properties available
  • Greatly enhanced expressiveness compared to RDFS
  • Enables construction of agents with enhanced reasoning ability
  • Same purpose as RDFS: define classes, properties, and their relationships

Why Choose OWL?

While RDF Schema is still valid for simple ontologies, OWL's rich expressiveness makes it the preferred choice for complex ontology development.

OWL Class Structure

Root Classes and Basic Definitions

Top-Level Classes

owl:Thing - Root of all classes in OWL

URI: http://www.w3.org/2002/07/owl#Thing

<owl:Class rdf:ID="Camera"> </owl:Class> <!-- Equivalent to: --> <owl:Class rdf:ID="Camera"> <rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/> </owl:Class>

Class Hierarchy

owl:Thingrdfs:Resourcerdfs:Classowl:Class

OWL creates a new class owl:Class to define classes in OWL documents, which is a subclass of rdfs:Class.

Localizing Global Properties

owl:allValuesFrom

The Challenge

Properties in RDFS are global - once defined, they apply to the entire domain class and all subclasses.

OWL provides mechanisms to localize property constraints to specific classes.

<owl:Class rdf:ID="ExpensiveSLR"> <rdfs:subClassOf rdf:resource="#SLR"/> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#owned_by"/> <owl:allValuesFrom rdf:resource="#Professional"/> </owl:Restriction> </rdfs:subClassOf> </owl:Class>

Interpretation

ExpensiveSLR is a subclass of SLR with property owned_by, and only instances of Professional can be values of this property.

Enhanced Reasoning

  • Agent sees: ExpensiveSLR owned by Liyang and Jin
  • Agent understands: Both Liyang and Jin are Professionals (not just Photographers or Amateurs)

Property Restrictions

owl:someValuesFrom & owl:hasValue

owl:someValuesFrom

At least one value of this property must be of the specified type

ExpensiveSLR can be owned by Professionals OR Amateurs, but at least one owner must be Professional

owl:hasValue

Property must have this specific value

Every ExpensiveSLR has expensiveOrNot property with value "expensive"

<owl:Class rdf:ID="ExpensiveSLR"> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#expensiveOrNot"/> <owl:hasValue rdf:datatype="...#string"> expensive </owl:hasValue> </owl:Restriction> </rdfs:subClassOf> </owl:Class>

Key Differences

allValuesFrom: All values must be of this type (but property may not appear)

someValuesFrom: At least one value must be of this type (property must appear)

hasValue: At least one value must equal this specific instance

Cardinality Constraints

Controlling Property Value Counts

Three Types of Cardinality

  • owl:cardinality - Exactly N values
  • owl:minCardinality - At least N values
  • owl:maxCardinality - At most N values
<!-- Exactly one owner --> <owl:Restriction> <owl:onProperty rdf:resource="#owned_by"/> <owl:cardinality rdf:datatype="...#nonNegativeInteger">1</owl:cardinality> </owl:Restriction> <!-- Range: 1-2 owners --> <owl:Restriction> <owl:onProperty rdf:resource="#owned_by"/> <owl:minCardinality rdf:datatype="...#nonNegativeInteger"> 1 </owl:minCardinality> <owl:maxCardinality rdf:datatype="...#nonNegativeInteger"> 2 </owl:maxCardinality> </owl:Restriction>

Enhanced Reasoning Example

If ExpensiveSLR has owl:cardinality = 1 for owned_by property:

Agent sees: NikonD200 owned by Liyang and Jin

Agent concludes: Liyang and Jin must be the same person!

Set Operators & Enumeration

Building Complex Class Definitions

Set Operations

  • owl:intersectionOf - Class is intersection of other classes
  • owl:unionOf - Class is union of other classes
  • owl:complementOf - Class is complement of another class

Enumeration with owl:oneOf

Explicitly enumerate all members of a class for precise semantics

<owl:Class rdf:ID="ExpensiveSLR"> <rdfs:subClassOf rdf:resource="#SLR"/> <owl:oneOf rdf:parseType="Collection"> <SLR rdf:about="...#D70"/> <SLR rdf:about="...#D200"/> <SLR rdf:about="...#20D"/> </owl:oneOf> </owl:Class>

Descriptive vs. Enumerative Definitions

Descriptive: "ExpensiveSLR is owned by Professionals" - many instances qualify

Enumerative: "ExpensiveSLR consists of exactly these cameras" - more precise semantics

OWL Property Types

ObjectProperty vs DatatypeProperty

owl:ObjectProperty

Connects resource to resource

Camera → Photographer
SLR → Specifications

owl:DatatypeProperty

Connects resource to literal/typed value

Camera → "Nikon D70"
Digital → 10.2 (MegaPixel)
<!-- ObjectProperty Example --> <owl:ObjectProperty rdf:ID="owned_by"> <rdfs:domain rdf:resource="#SLR"/> <rdfs:range rdf:resource="#Photographer"/> </owl:ObjectProperty> <!-- DatatypeProperty Example --> <owl:DatatypeProperty rdf:ID="model"> <rdfs:domain rdf:resource="#Specifications"/> <rdfs:range rdf:resource="...XMLSchema#string"/> </owl:DatatypeProperty>

Important Note

Both owl:ObjectProperty and owl:DatatypeProperty are subclasses of rdf:Property

Property Characteristics

Symmetric, Transitive, Functional

Symmetric Property

  • If A relates to B, then B relates to A
  • Example: friend_with - if Liyang is friend_with Jin, then Jin is friend_with Liyang

Transitive Property

  • If A relates to B and B relates to C, then A relates to C
  • Example: betterQualityPriceRatio

Functional Property

  • For any given instance, there is at most one value for this property
  • Example: model - each camera has exactly one model name
  • Enhanced reasoning: If two statements give different model values for same camera, they must be synonyms!
<owl:ObjectProperty rdf:ID="friend_with"> <rdf:type rdf:resource="...#SymmetricProperty"/> <rdfs:domain rdf:resource="#Person"/> <rdfs:range rdf:resource="#Person"/> </owl:ObjectProperty>

Inverse Properties

owl:inverseOf & InverseFunctionalProperty

owl:inverseOf

If property P connects R1 to R2, then inverse property P⁻¹ connects R2 to R1

<owl:ObjectProperty rdf:ID="owned_by"> <rdfs:domain rdf:resource="#SLR"/> <rdfs:range rdf:resource="#Photographer"/> </owl:ObjectProperty> <owl:ObjectProperty rdf:ID="own"> <owl:inverseOf rdf:resource="#owned_by"/> <rdfs:domain rdf:resource="#Photographer"/> <rdfs:range rdf:resource="#SLR"/> </owl:ObjectProperty>

Enhanced Reasoning

  • Agent sees: Liyang owns NikonD70
  • Agent automatically infers: NikonD70 is owned_by Liyang

InverseFunctionalProperty

For a given range value, the domain value must be unique

Example: If own is InverseFunctional and both LiyangJin and JinLiyang own NikonD70, then agent concludes: LiyangJin = JinLiyang (same person!)

Ontology Matching

Integrating Distributed Information

The Challenge

Multiple ontologies may describe the same domain using different terms and structures. How do we connect them?

Class-Level Matching

  • owl:equivalentClass - Two classes have the same meaning
  • owl:disjointWith - Two classes have no overlap
<owl:Class rdf:ID="Digital"> <rdfs:subClassOf rdf:resource="#Camera"/> <owl:equivalentClass rdf:resource="http://another.ont#DigitalCamera"/> </owl:Class> <owl:Class rdf:ID="SLR"> <rdfs:subClassOf rdf:resource="#Digital"/> <owl:disjointWith rdf:resource="#PointAndShoot"/> </owl:Class>

Benefit

Any instance described as Digital in our ontology is also understood as DigitalCamera in another ontology - enabling seamless data integration!

Instance-Level Matching

Identifying Same & Different Individuals

Matching Constructs

  • owl:sameIndividualAs - Two URIs refer to the same instance
  • owl:differentFrom - Two URIs refer to different instances
  • owl:AllDifferent - Bulk declaration for multiple instances
<!-- Same Individual --> <SLR rdf:ID="NikonD70"> <owl:sameIndividualAs rdf:resource="http://other.site#Nikon-D70"/> </SLR> <!-- All Different --> <owl:AllDifferent> <owl:distinctMembers rdf:parseType="Collection"> <SLR rdf:about="#NikonD70"/> <SLR rdf:about="#NikonD200"/> <SLR rdf:about="#Canon20D"/> </owl:distinctMembers> </owl:AllDifferent>

Critical for Distributed Web

Reuse URIs whenever possible! If you know a resource has already been described with a specific URI and you agree with its semantics, use that URI instead of creating your own.

This is how information connects across the distributed web!

Three Faces of OWL

Balancing Expressiveness and Reasoning

The Trade-off

More expressiveness → More powerful ontologies

BUT also → More complex reasoning (sometimes computationally impossible!)

🔷 OWL Full

Everything available - All OWL + RDF + RDFS constructs

✓ Maximum expressiveness

✗ No guarantees on computational completeness/efficiency

🔶 OWL DL (Description Logic)

Restricted subset - Constraints on how constructs can be combined

✓ Complete & decidable reasoning

✓ Maximum expressiveness while maintaining computational properties

✗ Some restrictions (e.g., class cannot be instance of another class)

🔹 OWL Lite

Further restricted - Simplest subset

✓ Easiest to implement reasoners

✓ Quick response from reasoning engines

✗ Limited expressiveness (e.g., cardinality only 0 or 1)

OWL DL Key Restrictions

What You Need to Know

Main Restrictions in OWL DL

  • Type Separation: A resource can be only ONE of: class, datatype, datatype property, object property, instance, or data value
  • Functional Properties: Can only be ObjectProperty, not DatatypeProperty
  • Transitive Properties: Cannot use cardinality restrictions on transitive properties
  • Import Restrictions: Importing OWL Full makes your ontology OWL Full

OWL Lite Additional Restrictions

Cannot use:

  • owl:hasValue
  • owl:disjointWith
  • owl:unionOf
  • owl:complementOf
  • owl:oneOf

Cardinality values restricted to 0 or 1 only

Example: Camera Ontology

Putting It All Together

📷 Class Hierarchy

Camera
├── Film
└── Digital
    ├── SLR
    │ └── ExpensiveSLR
    └── PointAndShoot

Key Features Used

  • Equivalent Classes: Digital ≡ DigitalCamera (from another ontology)
  • Disjoint Classes: SLR ⊥ PointAndShoot, Professional ⊥ Amateur
  • Property Restrictions: ExpensiveSLR owned_by someValuesFrom Professional
  • Functional Property: model (each Specification has one model)
  • Symmetric Property: friend_with
  • Transitive Property: betterQualityPriceRatio
  • Inverse Properties: own ⇔ owned_by

Ontology Classification

Our camera ontology is OWL Full because it uses owl:hasValue and functional properties on DatatypeProperty

What Our Ontology Expresses

Rich Semantics in Action

1. Taxonomy Knowledge

ExpensiveSLR is a special type of SLR → which is Digital → which is Camera

Professional is a Photographer → which is a Person

2. Cross-Ontology Alignment

Digital class = DigitalCamera in another ontology

SLR class = SingleLensReflex in another ontology

3. Constraint Knowledge

An SLR instance cannot be a PointAndShoot instance (disjoint)

A Professional cannot be an Amateur (disjoint)

4. Complex Property Constraints

ExpensiveSLR must be owned by at least one Professional (someValuesFrom)

ExpensiveSLR always has expensiveOrNot = "expensive" (hasValue)

Each Specification has exactly one model name (functional property)

Result: Enhanced Machine Reasoning

Over 100 lines of OWL express rich domain knowledge that enables intelligent agents to perform complex reasoning automatically!

Summary

Key Takeaways

What We Learned

  • OWL extends RDF Schema with powerful expressiveness for ontology development
  • Property restrictions (allValuesFrom, someValuesFrom, hasValue) localize global properties
  • Cardinality constraints control how many values properties can have
  • Property characteristics (symmetric, transitive, functional) enable rich reasoning
  • Ontology matching features (equivalentClass, sameIndividualAs) integrate distributed information
  • Three levels of OWL (Full, DL, Lite) balance expressiveness vs. reasoning efficiency

The Power of OWL

OWL enables us to build ontologies that not only describe domain knowledge but also encode reasoning rules that machines can use to infer new knowledge automatically.

Critical Principle

Reuse URIs! The semantic web works because we use common identifiers. When describing resources, use existing URIs when available to enable data integration across the distributed web.

1 / 17