Esercizio: GRUPPO PER

| Exercise: Write a query that selects films that were nominated for an award, and the number of nominations per film.

Hint: Find films that have a P1411 (nominated for) property.

Tip: Make sure that your query doesn’t only retrieve films, but also items that are subclasses of films. Use DISTINCT to remove duplicates from the results

show solution

Note that the DISTINCT modifier is applied to the award, not to the item. If an item has more than one statement with P31 (instance of), and it has more than one path to the film class (e.g., an item is both a film, and a 3D film, which is a subclass of film), DISTINCT will ensure the award nominations are counted only once.

If you want to see which film has had the most award nominations, scroll to the results after running the query, and click on the “count” column at the top of the table, which will order the results according to this column. In the next section you will learn how to order the results in the query itself.

Skip to content