Skip to main content

SPARQL Select Clause

The SELECT clause in SPARQL is a list of all the variables that you want displayed in your results.

All SPARQL variables begin with a "?". For example, this is a valid SELECT clause:

SELECT ?chat ?message ?person ?handle ?fullName

As you can see above, SELECT should be in all caps, and there are no commas between variables, only spaces.

You can also include aggregate items in your select clause. These items are structured as follows: (AVG(?favNums) AS ?avg) where AVG can be any of a number of accepted aggregate variables.

For example:

SELECT ?favNums (AVG(?favNums) AS ?avg) ?person ?handle (MAX(?favNums) as ?max)