!!! The Simpsons - An example Ontology for tutorial purposes

The Simpsons is a polpular comic televisions series. A comprehensive overview (in german) is [Simpsonspedia|http://simpsonspedia.net].

[{Image src='simpsons_family.png' width='150px' align='left'}]


!!! General Domain Model

We first define some classes framing the example domain.


! Classes 

%%turtle
si:Human
   rdf:type rdfs:Class ;
   rdfs:label "Mensch"@de, "Human"@en .

si:Animal
   rdf:type rdfs:Class ;
   rdfs:label "Tier"@de, "Animal"@en .

si:GenderType 
   rdf:type rdfs:Class ;
   rdfs:label "Geschlecht"@de, "Gender"@en .

si:male
   rdf:type si:GenderType ;
   rdfs:label "männlich"@de, "male"@en .

si:female
   rdf:type si:GenderType ;
   rdfs:label "weiblich"@de, "female"@en .

si:Building
   rdf:type rdfs:Class ;
   rdfs:label "Gebäude"@de, "Building"@en .
   
si:Location
   rdf:type rdfs:Class ;
   rdfs:label "Ort"@de, "Location"@en .
   
si:Powerplant   
   rdf:type rdfs:Class ;
   rdfs:subClassOf si:Building ;
   rdfs:label "Kraftwerk"@de, "Power plant"@en .
%

Some (alternative ways) to express negations.

%%Turtle 
[] rdf:type     owl:AllDisjointClasses ;
   owl:members  ( si:Human  si:Building si:GenderType) .

si:GenderType owl:disjointWith si:Human .

%


! Properties

%%turtle
si:livesIn
   rdf:type rdf:Property .

si:relatedWith 
   rdf:type owl:ReflexiveProperty .

si:parent
   rdf:type owl:AsymmetricProperty ;
   rdfs:subPropertyOf si:relatedWith .
   
si:spouse
   rdf:type rdf:Property .

si:husband
   rdfs:subPropertyOf si:spouse .
   
si:spouse owl:propertyDisjointWith si:parent .
      
si:child
   rdf:type rdf:Property ;
   rdfs:subPropertyOf si:relatedWith ;
   owl:inverseOf si:parent .

si:mother
   rdf:type rdf:Property ;
   rdfs:subPropertyOf si:parent .

si:father
   rdf:type rdf:Property ;
   rdfs:subPropertyOf si:parent .

si:grandparent 
   rdf:type rdf:Property ; 
   owl:propertyChainAxiom  ( si:parent  si:parent ) .
   
si:grandfather 
   rdf:type rdf:Property ; 
   owl:propertyChainAxiom  ( si:parent  si:father ) .


si:sibling
   rdf:type owl:SymmetricProperty ;
   rdf:type owl:TransitiveProperty ;
   rdfs:subPropertyOf si:relatedWith .
   
si:gender
   rdf:type rdf:Property ;
   rdfs:domain si:GenderType . 
   
si:age rdf:type rdf:Property .   

si:owns rdf:type rdf:Property ;
   owl:minCardinality "1" .

si:amount rdf:type rdf:Property .

si:ownType rdf:type rdf:Property .
%


! NegativeObjectPropertyAssertion

Bart never wants to be a female.

%%turtle
 []  rdf:type               owl:NegativePropertyAssertion ;
     owl:sourceIndividual   si:bart ;
     owl:assertionProperty  si:gender ;
     owl:targetIndividual   si:female .
%


!!! Illustrative Instances

We now insert some characters and things of the Simpsons world.

%%Turtle
si:springfield
   rdf:type si:Location ;
   rdfs:label "Springfield" .

si:homer
   rdfs:label "Homer Simpson" ;
   rdf:type si:Human ;
   si:age "36" ;
   si:gender si:male ;
   si:father si:abraham ;
   si:livesIn si:springfield .

si:marge
   rdfs:label "Marge Simpson" ;
   rdf:type si:Human ;
   si:age "34" ;
   si:husband si:homer ;
   si:gender si:female ;
   si:livesIn si:springfield .

si:bart
   rdfs:label "Bart Simpson" ;
   rdf:type si:Human ;
   si:age "10" ;
   si:gender si:male ;
   si:sibling si:lisa ;
   si:mother si:marge ;
   si:father si:homer ;
   si:livesIn si:springfield .
   
si:lisa 
   rdfs:label "Lisa Simpson" ;
   rdf:type si:Human ;
   si:age "8" ;
   si:gender si:female ;
   si:mother si:marge ;
   si:father si:homer ;
   si:livesIn si:springfield .

si:maggie 
   rdfs:label "Maggie Simpson" ;
   rdf:type si:Human ;
   si:age "1" ;
   si:sibling si:lisa ;
   si:gender si:female ;
   si:mother si:marge ;
   si:father si:homer ;
   si:livesIn si:springfield .
   
si:abraham
   rdfs:label "Abraham Simpson" ;
   rdf:type si:Human ;
   si:mother si:yuma ;
   si:gender si:male .

si:yuma
   rdfs:label "Yuma Hickman" ;
   rdf:type si:Human ;
   si:gender si:female .


si:burns_dog
   rdf:type si:Animal ;
   rdfs:label "Mr. Burns' dog" .

si:burns_powerplant
   rdf:type si:Powerplant ;
   rdfs:label "Mr. Burns' nuclear power plant" .
%

We can also introduce blank nodes to represent the belongings of Mr. Burns.

%%Turtle 
si:burns
   rdf:type si:Human ;
   rdfs:label "Charles Montgomery Burns" ;
   si:gender si:male ;
   si:owns _:own1, _:own2 .

_:own1 
   si:amount "3" ;
   si:ownType si:burns_dog .

_:own2 
   si:amount "1" ;
   si:ownType si:burns_powerplant .

%


!!! Sample Queries

Ok, we can test/query the ontology by inserting some SPARQL statements.


! Simple start

Show me all instances of Human and also show their labels.

%%Sparql 
SELECT ?x ?name
WHERE {
  ?x rdf:type si:Animal ;
     rdfs:label ?name .
}
@border: true
@zebramode: true
@showQuery: true
%


! Barts Grand-Pa

Use property paths in SPARQL.

%%Sparql 
SELECT ?name
WHERE {
  si:bart si:father/si:father ?name .
}
@border: true
@zebramode: true
@showQuery: true
%

Now using a defined PropertyChain

%%Sparql 
SELECT ?name
WHERE {
  si:bart si:grandparent ?name .
}
@border: true
@zebramode: true
@showQuery: true
%


! Optional belongings

We also can add optional patterns into the query. Show all humans and their (optional) belongings.

%%Sparql 
SELECT ?name ?belonging
WHERE {
  ?x rdf:type si:Human ;
     rdfs:label ?name .
  OPTIONAL { ?x si:owns/si:ownType/rdfs:label ?belonging } .
}
@border: true
@zebramode: true
@showQuery: true
%


! UNION: All names of humans and animals

%%Sparql 
SELECT ?name
WHERE {
  { ?x rdf:type si:Human ;
       rdfs:label ?name .
  } UNION {
    ?x rdf:type si:Animal ;
       rdfs:label ?name .
  }
}
@border: true
@zebramode: true
@showQuery: true
%


! Expected Compentency Questions: Intersecting Properties

The family father: A father that is also a husband

%%Sparql 
SELECT ?name
WHERE {
  ?x si:father ?kid ;
     rdfs:label ?name .
  ?y si:husband ?x .
}
@border: true
@zebramode: true
@showQuery: true
%


!!! Administrative Definitions of the Simpsons Ontology

This wiki article belongs to the {{simpsons}} package.

%%package simpsons

We define the ontology using all articles of the {{simpsons}} package.

%%ontology
  @uses: simpsons
%

Let's us the namespace {{si}} for the resources.

%%namespace 
  si http://www.example.org/ontology#
%