Triply Academy

Created on Mar 15th, 2023

The generic projection

The generic projection (select *) is used to include one column for every visible variable in the pattern component.

The order in which the columns are returned is not specified in the SPARQL standard and is implementation-specific. Often, columns are returned in the order in which the corresponding variables appear for the first time inside the pattern component, but this is not guaranteed. If the order of the columns is important, it is more robust to specify the variables explicitly.

Created 3 months ago, 2 versions

Projection: add/remove columns

This query only returns one column. This one column contains the colors of Pokémon (bindings for variable ?color).

The ?pokemon variable is used in the graph pattern, but its bindings are not returned in the projection. Variables like ?pokemon that are internal to the pattern component and are not exposed in the projection are called hidden variables.

Result sets must contain of at least one column. The same column may be included more than once.

Created 3 months ago, 2 versions

Projection: column order

Like this query, but with the order of the columns inverted: the projection specifies which columns are included in the result set, and also specifies the order in which they appear.

Created 3 months ago, 2 versions

Abbreviation: IRI prefix notation

Identical to this query, but the lengthy predicate term that was used there is now abbreviated using alias (measure). This requires that the alias and IRI prefix are declared at the top of the query (keyword prefix).

The part of the query that appears before the projection, and that contains prefix declarations, is called the Prologue.

Notice that another IRI prefix observation is also declared. This prefix is not used in the query itself, but is used to abbreviate the values that appear the first column of the result set table. (This is a Triply-specific feature.)

Created 3 months ago, 3 versions


Created 3 months ago, 4 versions


Created 3 months ago, 1 version


Binding a variable

The bind keyword allows variables to be introduced that do not appear in a graph pattern.

Created 3 months ago, 3 versions

A table of observations and their petal length

A simple select query that returns observations (bindings for the variable ?observation) and their colors (bindings for the variable ?petalLength), in that order.

Notice how the predicate term (i.e., the middle term) is bound to a specific IRI (<https://triplydb.com/triply/iris/def/measure/petalLength>) that denotes the relationship between things and their depiction.

Created 3 months ago, 4 versions

The first SPARQL select query

This is a very simple select query. But it already contains all three main select query components:

The columns that are returned (select ?s ?p ?o)
Triple Pattern
How the cells will be filled based on graph matching (?s ?p ?o.)
Result set modifiers
Adaptations to the result table (limit)
Created 3 months ago, 1 version