GF for OBDA -- Result of a SPARQL query
Screen capture for the query wizard

Query Text
# Categorize people by sex and compute the average and maximum weight, least birthdate, person count and sum of weights.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?isMale (AVG(?weight) AS ?averageWeight) (MAX(?weight) AS ?maximumWeight) (MIN(?bd) AS ?leastBirthDate) (COUNT(?id) AS ?personCount) (SUM(?weight) AS ?weightSum)
WHERE
{
?x rdf:type <http://example.org/Person> .
?x <http://example.org/Person/sex> ?isMale .
?x <http://example.org/Person/weight> ?weight .
?x <http://example.org/Person/weight> ?weight .
?x <http://example.org/Person/birthDate> ?bd .
?x <http://example.org/Person/personID> ?id .
?x <http://example.org/Person/weight> ?weight .
}
GROUP BY ?isMale
Query Results
isMale | averageWeight |
"false"^^<http://www.w3.org/2001/XMLSchema#boolean> | "60.0"^^<http://www.w3.org/2001/XMLSchema#double> |
"true"^^<http://www.w3.org/2001/XMLSchema#boolean> | "115.0"^^<http://www.w3.org/2001/XMLSchema#double> |
Query Results for LaTeX
\begin{tabular}{|c|c|} \hline
\emph{isMale} & \emph{averageWeight}\\
\hline
false & 60.0\\
true & 115.0\\
\hline
\end{tabular}