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:
- Display all of Jason’s object properties and their values.
- Display the list of individuals and their spouses (defined by the hasConsort property).
- Display the number of women and the number of men.
- Display parents having two children.
- Display the profiles of all individuals, grouping them together. This must include the object properties and their values for each individual.
- Display individuals who have at least one sibling.
- Display the full family tree of Jason.
- Display individuals who have no spouse (requires
FILTER NOT EXISTS).
- Use the keyword
SELECT DISTINCTto avoid repetition of results when necessary.