Difference between revisions of "Ontology Development Exercises"

From Developer Documents
Jump to navigation Jump to search
Line 27: Line 27:
 
== Exercise 4: Subtitles ==
 
== Exercise 4: Subtitles ==
  
* Add a data type for subtitles to Movie ontology and make possible to add it to movie. (See [[Databoard_Specification#Datatypes|Datatype documentation]] for reference)
+
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 ==

Revision as of 01:13, 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 type Genre to Movie ontology. It inherits Type.
  • Add types Action, Drama and Western to Movie ontology. These types inherit Movie and are instances of Genre.
mo.Drama <T mo.Movie : mo.Genre
  • 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 following information to MovieLibrary and corresponding concepts to Movie ontology:

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