Run your first queries
To begin this tutorial, we will run some simple queries on a cinema dataset available here, described with the YACO ontology. Basically, this datast contains a bunch of movies, and of people related to these movies (mainly actors and directors, but also producers or writers).
Searching for movies
The first query we might want to run is: What are the available movies ? You may examine an instance of movie provided for reference. In SPARQL, it is formulated as follows:
Only one variable (?movie) is present in the query, and you will notice that only one element is present in each result row.
Searching for actors and birth years
Now, let's ask: What actors are we talking about, and when were they born?
In this case, the query has two variables to bound, and the result set is constituted of pairs of potential instances.
Any part of the triple may be a variable
Even the predicate ? You bet.
An actor AND a director? Somebody stop that man! He actually also wrote the movie and played music in it, but we did not put that in the dataset because it would be a lot for a single person.
Multiple variables in a single triple
And even further, multiple elements of the same triple may be variables.
Why stop there ? We can list every single triple of the knowledge base if we want, by using a completely unbound triple.
In this case however, we limit the size of the result set, to avoid an overload.