These queries use a resource called the linkedMDB, the Linked Movie Database. It is a simple translation of a relational database about movies into RDF. It hasn't been maintained for a while, but it is still good for making examples. Because it was a relational database, it has some interseting foibles that we explore in these queries.
The data for these queries can be dowloaded from linkedMDB.ttl
Sometimes actors are also directors. Since the linkedMDB came from a database with separate tables for Director and Actor, these aren't obviously the same entity. We can find out that they are the same by using their foaf:page.
In this query, we filter the data to match the output shown in the book; feel free to remove those lines to see all the output. This query will find all of the matching people in the source data, and create skos:exactMatch triples for them.