Result Clause
The result clause defines the query type, such as SELECT, CONSTRUCT, or an update operation, and the set of results to return. Depending on the type of query, the result clause can include graph and triple templates, variables, and functions or expressions that perform calculations on result set.
Examples
The result clause (SELECT ?event ?category (sum(?qty) as ?total_tickets)
) in the following example query includes a SUM aggregate function to calculate the total quantity of tickets sold.
SELECT ?event ?category (sum(?qty) as ?total_tickets) FROM <tickit> WHERE { ?sales <qtysold> ?qty . ?sales <eventid> ?eventid . ?eventid <eventname> ?event . ?eventid <catid> ?catid . ?catid <catname> ?category . } GROUP BY ?event ?category ORDER BY ?total_tickets LIMIT 10
The result clause (CONSTRUCT { GRAPH <ages> { ?person <age> ?age . } }
) in the following CONSTRUCT query includes a graph template:
CONSTRUCT { GRAPH <ages> { ?person <age> ?age . } } WHERE { GRAPH <tickit> { SELECT ?person ((YEAR(?date))-(YEAR(xsd:dateTime(?birthdate))) AS ?age) WHERE { ?person <birthday> ?birthdate . BIND(xsd:dateTime(NOW()) AS ?date) } } } ORDER BY ?person LIMIT 50