-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtraces.sparql
39 lines (33 loc) · 1.22 KB
/
traces.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
#defaultView:Graph
SELECT ?item ?itemLabel ?image ?linkTo ?edgeLabel WHERE {
# hypertext systems
{ { ?item wdt:P31 wd:Q65966993 } UNION { ?item wdt:P279 wd:Q65966993 } }
# first date
OPTIONAL { { ?item wdt:P571 ?date } UNION { ?item wdt:P580 ?date } UNION { ?item wdt:P585 ?date } UNION { ?item wdt:P577 ?date } }
FILTER NOT EXISTS {
{ { ?item wdt:P571 ?date2 } UNION { ?item wdt:P580 ?date2 } UNION { ?item wdt:P585 ?date2 } UNION { ?item wdt:P577 ?date2 } }
FILTER (?date > ?date2)
}
# links
OPTIONAL {
{
{ ?item wdt:P155 ?linkTo BIND(wd:P155 AS ?edge) }
UNION
{ ?item wdt:P941 ?linkTo BIND(wd:P941 AS ?edge) }
UNION
{ ?item wdt:P144 ?linkTo BIND(wd:P144 AS ?edge) }
UNION
{ ?item wdt:P737 ?linkTo BIND(wd:P737 AS ?edge) }
}
{ { ?linkTo wdt:P31 wd:Q65966993 } UNION { ?linkTo wdt:P279 wd:Q65966993 } }
}
# image and short name
OPTIONAL { ?item wdt:P18 ?image }
OPTIONAL { ?item wdt:P1813 ?short }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
?item rdfs:label ?label .
?edge rdfs:label ?edgeLabel .
} .
BIND(CONCAT(IF(BOUND(?short),?short,?label),": ", STR(YEAR(?date))) AS ?itemLabel) .
}