Query that shows how Triply Templating can be used to simplify SPARQL queries with complex literals. This is specifically useful for SPARQL queries that return HTML literals, which can be rather complex.
This query is a simplified version of this query that does not use Triply Templating.
This query is similar to query 3-2-implicit, but uses anonymous node notation in order to omit the
?item subject term variable. By doing so, the meaning of this query is significantly changed, as can be seen by the result set.
How to read the aggregation in this query?
- We are dealing with aggregation, because at least one aggregation function (
group byclause appears, so we are dealing with implicit grouping.
- Implicit grouping means grouping around the set of variables that are visible and not argument to an aggregation function. In this case, this set of variables is ∅ (the empty set).
- Grouping based on the empty set means that all results are part one one big group. So this query counts the number of names in the entire dataset.
This query is similar to query 3.2, but uses implicit grouping.
Implicit grouping occurs when at least one aggregation function is used (in this case
count) and no
group by clause is given. In this case, grouping is performed based on the set of visible variables that are not themselves arguments to an aggregation function. In this query, implicit grouping result in grouping around the
The result set of this query consists of 'blocks' of values (names in this case) that appear with the same Creative Works.
Aggregation allows functions to be applied to these 'blocks' of values, resulting in one single value per grouping element.
The grouping element can consist of one or more variables.
Every variable in a SPARQL query can be replaced by an RDF name (an IRI or literal). Replacing a variable with an RDF name makes the query more specific, i.e., results in a smaller result set.
This query is similar to query 2-8, but the
?typeName variable is replaced by the literal `"StillImage" so that only stillImages for the Creative works are returned.
Filter by language
This query uses the
lang/1 function in order to return only those result rows in which one name is in Japanese (
ja-ja) and one name is in US English (
The fact that both constraints must be satisfied is expressed by the Boolean conjunction operator (
Some properties can have multiple values for the same object. For example, one item has multiple values for the name property (
item:name) in different languages.
Notice that when a Triple Pattern ends with the comma character (
,) the next Triple Pattern implicitly has the same subject and predicate terms as the previous Triple Pattern. (If the number of object terms is small we are used to placing them on the same physical line, as in this query.)
filter expression puts additional constraints on which results are returned: the two names must be different. Difference/non-identity is specified by the
Notice that use of
!= means that for every pair 〈A,B〉 the pair 〈B,A〉 is also included. Use the smaller than (
<) or larger than (
>) operator instead in order to exclude such symmetric name pairs in the result set.
Abbreviation: repeated subject terms
This query is similar to query 2-3, but the subject term is not repeated.
Whenever consecutive Triple Patterns have the same subject term, the subject term of the next Triple Pattern can be skipped if the previous Triple Pattern ends in a semi-colon (
;) instead of a dot (