Difference between revisions of "Ontology Development Exercises"

From Developer Documents
Jump to navigation Jump to search
Line 42: Line 42:
 
* 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 ways to define the concept.
+
Note, that there are more than one way to define the concept.

Revision as of 01:17, 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 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.