-
Notifications
You must be signed in to change notification settings - Fork 5
/
Q5-naive.sparql
44 lines (43 loc) · 1.42 KB
/
Q5-naive.sparql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
PREFIX dbpp: <http://dbpedia.org/property/>
PREFIX dbpo: <http://dbpedia.org/ontology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbpr: <http://dbpedia.org/resource/>
SELECT ?team ?name ?count_basketball_players
FROM <http://dbpedia.org>
WHERE
{ { SELECT DISTINCT ?team ?name ?count_basketball_players
WHERE
{ { SELECT ?team ?name
WHERE
{ ?team dbpp:name ?name }
}
{ SELECT ?team ?count_basketball_players
WHERE
{ { SELECT DISTINCT ?team (COUNT(DISTINCT ?player) AS ?count_basketball_players)
WHERE
{ { SELECT *
WHERE
{ ?player rdf:type dbpo:Athlete }
}
{ SELECT *
WHERE
{ ?player dbpp:team ?team }
}
{ SELECT *
WHERE
{ ?team dbpo:league ?league }
}
{ SELECT *
WHERE
{ ?team dbpp:location ?location }
}
}
GROUP BY ?team
}
}
}
}
}
}