Ontology Development Exercises

From Developer Documents
Jump to navigation Jump to search

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:

    @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"
        [ {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