-
Notifications
You must be signed in to change notification settings - Fork 5
/
Q2-expert.sparql
50 lines (49 loc) · 1.83 KB
/
Q2-expert.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
45
46
47
48
49
50
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 yagoinfo: <http://yago-knowledge.org/resource/infobox/en/>
PREFIX yago: <http://yago-knowledge.org/resource/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dbpr: <http://dbpedia.org/resource/>
SELECT *
WHERE
{ { { SELECT *
WHERE
{ GRAPH <http://dbpedia.org>
{ ?film1 dbpp:starring ?actor1 .
?actor1 dbpp:birthPlace ?actor_country1 ;
dbpp:name ?name
FILTER regex(str(?actor_country1), "USA")
}
OPTIONAL
{ GRAPH <http://yago-knowledge.org/>
{ ?actor2 yago:actedIn ?film2 ;
yago:isCitizenOf ?actor_country2 ;
yagoinfo:name ?name
FILTER ( ?actor_country2 = yago:United_States )
}
}
}
}
UNION
{ SELECT *
WHERE
{ GRAPH <http://yago-knowledge.org/>
{ ?actor2 yago:actedIn ?film2 ;
yago:isCitizenOf ?actor_country2 ;
yagoinfo:name ?name
FILTER ( ?actor_country2 = yago:United_States )
}
OPTIONAL
{ GRAPH <http://dbpedia2020.org>
{ ?film1 dbpp:starring ?actor1 .
?actor1 dbpp:birthPlace ?actor_country1 ;
dbpp:name ?name
FILTER regex(str(?actor_country1), "USA")
}
}
}
}
}
}