SPARQL : Practical Activity

Duration1h15 AI Banned

In this activity, we will formulate SPARQL queries on a small ontology called Family Family Ontology

  • Launch the Protégé environment and then import the Family ontology locally.
  • Explore the ontology to understand its content.
  • Display the SPARQL Query tab in the Protégé interface: Window/Tab/SPARQL Query
  • Add the prefix associated with the Family ontology so that you can query it in the header of your query editor as follows: PREFIX family: <http://a.com/ontology#>
  • Run the default query and save it in a separate file. It will help you formulate other queries.
  • Remember to save your queries in a separate file (e.g., .txt), because each new query will force you to delete the previous one.
  • Then find the queries that display the following results:
  1. Display all of Jason’s object properties and their values.
  2. Display the list of individuals and their spouses (defined by the hasConsort property).
  3. Display the number of women and the number of men.
  4. Display parents having two children.
  5. Display the profiles of all individuals, grouping them together. This must include the object properties and their values for each individual.
  6. Display individuals who have at least one sibling.
  7. Display the full family tree of Jason.
  8. Display individuals who have no spouse (requires FILTER NOT EXISTS).
  • Use the keyword SELECT DISTINCT to avoid repetition of results when necessary.