Difference between revisions of "Ontology Development Exercises"

From Developer Documents
Jump to navigation Jump to search
 
(10 intermediate revisions by one other user not shown)
Line 1: Line 1:
Before trying these exercises, go through the basic tutorial [[Tutorial:_Ontology_Development]]. All the exercises add some new features to the ontology.
+
Before trying these exercises, go through the basic tutorial [[Tutorial: Ontology Development]]. All the exercises add some new features to the ontology.
  
 
== Exercise 1: Release year ==
 
== Exercise 1: Release year ==
  
Make it possible to give the release year of a movie. Add following data to the movie library:
+
Make it possible to give the release year of a movie. Add the following data to the movie library:
 
* Casino Royale, 2006
 
* Casino Royale, 2006
 
* 007 Quantum of Solace, 2008
 
* 007 Quantum of Solace, 2008
Line 20: Line 20:
 
== Exercise 3: Genres ==
 
== Exercise 3: Genres ==
  
* Add type Genre to Movie ontology. It inherits Type.
+
Add genres to Movie ontology.  
* Add types Action, Drama and Western to Movie ontology. These types inherit Movie and are instances of Genre.
+
* Every genre is a subtype of Movie: Add at least the followin genres to Movie ontology: Action, Drama and Western.
mo.Drama <T mo.Movie : mo.Genre
+
* Add also a type Genre that is the type of all genres.
 
* Let all movies in MovieLibrary to be instances of Action genre.
 
* Let all movies in MovieLibrary to be instances of Action genre.
  
 
== Exercise 4: Subtitles ==
 
== Exercise 4: Subtitles ==
  
* Add a data type for subtitles to Movie ontology and make possible to add it to movie.  
+
Add a data type for subtitles to Movie ontology and make it possible to add subtitles to a movie in the following way:
* The data type of a subtitle is [{begin : Double, end : Double, text : String}].
+
ML.tt0110912 : MO.Movie
* Example data (Pulp Fiction)
+
    MO.HasTitle "Pulp Fiction"
[ {begin=29.516, end=31.916, text=”Forget it. It's too risky.”},
+
    MO.HasSubtitles   
  {begin=31.956, end=33.476, text=”I'm through doing that shit.”}}
+
        [ {begin=29.516, end=31.916, text=”Forget it. It's too risky.”},
]
+
          {begin=31.956, end=33.476, text=”I'm through doing that shit.”}}
 +
        ] : MO.Subtitles
 +
 
 +
See [[Databoard_Specification#Datatypes|Datatype documentation]] for reference about data types. Examples about literal types can be found in Layer0Literals.pgraph.
  
 
== Exercise 5: Awards ==
 
== Exercise 5: Awards ==
  
Add following information to MovieLibrary and corresponding concepts to Movie ontology:
+
Add the concept of awards to Movie ontology so that following kind of information can be added to MovieLibrary:
 
* Daniel Craig won Empire Award in category Best Actor in 2006 for Casino Royale.
 
* Daniel Craig won Empire Award in category Best Actor in 2006 for Casino Royale.
 +
 +
Note, that there are more than one way to define the concept.
 +
 +
== Exercise 6: Genealogy ontology ==
 +
 +
Create a new ontology containing the following types:
 +
* Person
 +
and the following relations:
 +
* HasForename
 +
* HasSurname
 +
* HasYearOfBirth
 +
* HasChild
 +
* HasParent
 +
* HasMother
 +
* HasFather

Latest revision as of 06:26, 17 November 2010

Before trying these exercises, go through the basic tutorial Tutorial: Ontology Development. All the exercises add some new features to the ontology.

Exercise 1: Release year

Make it possible to give the release year of a movie. Add the following data to the movie library:

  • Casino Royale, 2006
  • 007 Quantum of Solace, 2008
  • Golden Eye, 1995
  • Die Another Day, 2002
  • Dr. No, 1962
  • The World Is Not Enough, 1999

Exercise 2: MovieInfo template

Create a template MovieInfo that lets you write:

ML.t0381061
    @MO.MovieInfo "Casino Royale” ML.MartinCambell 2006
    @MO.Casting db.JamesBond ML.DanielCraig 

Exercise 3: Genres

Add genres to Movie ontology.

  • Every genre is a subtype of Movie: Add at least the followin genres to Movie ontology: Action, Drama and Western.
  • Add also a type Genre that is the type of all genres.
  • Let all movies in MovieLibrary to be instances of Action genre.

Exercise 4: Subtitles

Add a data type for subtitles to Movie ontology and make it possible to add subtitles to a movie in the following way:

ML.tt0110912 : MO.Movie
    MO.HasTitle "Pulp Fiction"
    MO.HasSubtitles    
        [ {begin=29.516, end=31.916, text=”Forget it. It's too risky.”},
          {begin=31.956, end=33.476, text=”I'm through doing that shit.”}}
        ] : MO.Subtitles

See Datatype documentation for reference about data types. Examples about literal types can be found in Layer0Literals.pgraph.

Exercise 5: Awards

Add the concept of awards to Movie ontology so that following kind of information can be added to MovieLibrary:

  • Daniel Craig won Empire Award in category Best Actor in 2006 for Casino Royale.

Note, that there are more than one way to define the concept.

Exercise 6: Genealogy ontology

Create a new ontology containing the following types:

  • Person

and the following relations:

  • HasForename
  • HasSurname
  • HasYearOfBirth
  • HasChild
  • HasParent
  • HasMother
  • HasFather