File tree Expand file tree Collapse file tree
sparql/sparql11/aggregates Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ PREFIX : <http://www.example.org/>
2+ SELECT ?s (AVG (DISTINCT ?o ) AS ?avg )
3+ WHERE {
4+ ?s ?p ?o
5+ }
6+ GROUP BY ?s
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <sparql xmlns =" http://www.w3.org/2005/sparql-results#" >
3+ <head >
4+ <variable name =" s" />
5+ <variable name =" avg" />
6+ </head >
7+ <results >
8+ <result >
9+ <binding name =" s" >
10+ <uri >http://www.example.org/ints</uri >
11+ </binding >
12+ <binding name =" avg" >
13+ <literal datatype =" http://www.w3.org/2001/XMLSchema#decimal" >1.5</literal >
14+ </binding >
15+ </result >
16+ <result >
17+ <binding name =" s" >
18+ <uri >http://www.example.org/decimals</uri >
19+ </binding >
20+ <binding name =" avg" >
21+ <literal datatype =" http://www.w3.org/2001/XMLSchema#decimal" >1.6</literal >
22+ </binding >
23+ </result >
24+ <result >
25+ <binding name =" s" >
26+ <uri >http://www.example.org/doubles</uri >
27+ </binding >
28+ <binding name =" avg" >
29+ <literal datatype =" http://www.w3.org/2001/XMLSchema#double" >1050</literal >
30+ </binding >
31+ </result >
32+ <result >
33+ <binding name =" s" >
34+ <uri >http://www.example.org/mixed1</uri >
35+ </binding >
36+ <binding name =" avg" >
37+ <literal datatype =" http://www.w3.org/2001/XMLSchema#decimal" >1.6</literal >
38+ </binding >
39+ </result >
40+ </results >
41+ </sparql >
Original file line number Diff line number Diff line change 1+ PREFIX : <http://www.example.org/>
2+ SELECT ?s (COUNT (DISTINCT ?o ) AS ?count ) WHERE {
3+ ?s ?p ?o
4+ } GROUP BY ?s
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <sparql xmlns =" http://www.w3.org/2005/sparql-results#" >
3+ <head >
4+ <variable name =" s" />
5+ <variable name =" count" />
6+ </head >
7+ <results >
8+ <result >
9+ <binding name =" s" >
10+ <uri >http://www.example.org/ints</uri >
11+ </binding >
12+ <binding name =" count" >
13+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
14+ </binding >
15+ </result >
16+ <result >
17+ <binding name =" s" >
18+ <uri >http://www.example.org/decimals</uri >
19+ </binding >
20+ <binding name =" count" >
21+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
22+ </binding >
23+ </result >
24+ <result >
25+ <binding name =" s" >
26+ <uri >http://www.example.org/doubles</uri >
27+ </binding >
28+ <binding name =" count" >
29+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
30+ </binding >
31+ </result >
32+ <result >
33+ <binding name =" s" >
34+ <uri >http://www.example.org/mixed1</uri >
35+ </binding >
36+ <binding name =" count" >
37+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
38+ </binding >
39+ </result >
40+ </results >
41+ </sparql >
Original file line number Diff line number Diff line change 1+ PREFIX : <http://www.example.org/>
2+ SELECT ?s (COUNT (DISTINCT * ) AS ?count ) WHERE {
3+ ?s ?p ?o
4+ } GROUP BY ?s
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <sparql xmlns =" http://www.w3.org/2005/sparql-results#" >
3+ <head >
4+ <variable name =" s" />
5+ <variable name =" count" />
6+ </head >
7+ <results >
8+ <result >
9+ <binding name =" s" >
10+ <uri >http://www.example.org/ints</uri >
11+ </binding >
12+ <binding name =" count" >
13+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
14+ </binding >
15+ </result >
16+ <result >
17+ <binding name =" s" >
18+ <uri >http://www.example.org/decimals</uri >
19+ </binding >
20+ <binding name =" count" >
21+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
22+ </binding >
23+ </result >
24+ <result >
25+ <binding name =" s" >
26+ <uri >http://www.example.org/doubles</uri >
27+ </binding >
28+ <binding name =" count" >
29+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
30+ </binding >
31+ </result >
32+ <result >
33+ <binding name =" s" >
34+ <uri >http://www.example.org/mixed1</uri >
35+ </binding >
36+ <binding name =" count" >
37+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
38+ </binding >
39+ </result >
40+ </results >
41+ </sparql >
Original file line number Diff line number Diff line change 1+ PREFIX : <http://www.example.org/>
2+ ASK {
3+ {SELECT (GROUP _CONCAT (DISTINCT ?o ) AS ?g ) WHERE {
4+ VALUES ?o { " 1" " 2" " 1" }
5+ }}
6+ FILTER (?g = "1 2" || ?g = "2 1")
7+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <sparql xmlns =" http://www.w3.org/2005/sparql-results#" >
3+ <head />
4+ <boolean >true</boolean >
5+ </sparql >
Original file line number Diff line number Diff line change 1+ PREFIX : <http://www.example.org/>
2+ SELECT ?s (MAX (DISTINCT ?o ) AS ?max )
3+ WHERE {
4+ ?s ?p ?o
5+ }
6+ GROUP BY ?s
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <sparql xmlns =" http://www.w3.org/2005/sparql-results#" >
3+ <head >
4+ <variable name =" s" />
5+ <variable name =" max" />
6+ </head >
7+ <results >
8+ <result >
9+ <binding name =" s" >
10+ <uri >http://www.example.org/ints</uri >
11+ </binding >
12+ <binding name =" max" >
13+ <literal datatype =" http://www.w3.org/2001/XMLSchema#integer" >2</literal >
14+ </binding >
15+ </result >
16+ <result >
17+ <binding name =" s" >
18+ <uri >http://www.example.org/decimals</uri >
19+ </binding >
20+ <binding name =" max" >
21+ <literal datatype =" http://www.w3.org/2001/XMLSchema#decimal" >2.2</literal >
22+ </binding >
23+ </result >
24+ <result >
25+ <binding name =" s" >
26+ <uri >http://www.example.org/doubles</uri >
27+ </binding >
28+ <binding name =" max" >
29+ <literal datatype =" http://www.w3.org/2001/XMLSchema#double" >2.0E3</literal >
30+ </binding >
31+ </result >
32+ <result >
33+ <binding name =" s" >
34+ <uri >http://www.example.org/mixed1</uri >
35+ </binding >
36+ <binding name =" max" >
37+ <literal datatype =" http://www.w3.org/2001/XMLSchema#decimal" >2.2</literal >
38+ </binding >
39+ </result >
40+ </results >
41+ </sparql >
You can’t perform that action at this time.
0 commit comments