-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwikis.sparql
68 lines (55 loc) · 2.09 KB
/
wikis.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#defaultView:Table
SELECT DISTINCT ?year ?name ?creators ?ancestors ?language ?wikidata {
{ SELECT DISTINCT
?item
?itemLabel
?date
?end
(GROUP_CONCAT(DISTINCT ?ancestorLabel;separator=", ") AS ?ancestors)
(GROUP_CONCAT(DISTINCT ?creatorLabel;separator=", ") AS ?creators)
(GROUP_CONCAT(DISTINCT ?short;separator="/") AS ?shortLabel)
(GROUP_CONCAT(DISTINCT ?systemLabel;separator=", ") AS ?language)
WHERE
{
# wiki engines
{ ?item wdt:P31 wd:Q6686945 }
# date of creation, publication etc.
OPTIONAL {
{ ?item wdt:P571 ?date } UNION { ?item wdt:P580 ?date } UNION { ?item wdt:P585 ?date } UNION { ?item wdt:P577 ?date } }
# end time
OPTIONAL { ?item wdt:P582 ?end }
# all kinds of creators
OPTIONAL {
{ ?item wdt:P50 ?creator } UNION # author
{ ?item wdt:P170 ?creator } UNION # creator
{ ?item wdt:P61 ?creator } UNION # discoverer or inventor
{ ?item wdt:P178 ?creator } # developer
}
OPTIONAL { ?item wdt:P2093 ?creatorLabel }
OPTIONAL {
{ ?item wdt:P155 ?ancestor } UNION
{ ?item wdt:P941 ?ancestor } UNION
{ ?item wdt:P144 ?ancestor } UNION
{ ?item wdt:P737 ?ancestor }
}
# short name(s)
OPTIONAL { ?item wdt:P1813 ?short } .
OPTIONAL {
{ ?item wdt:P277 ?system }
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?item rdfs:label ?itemLabel .
?creator rdfs:label ?creatorLabel .
?ancestor rdfs:label ?ancestorLabel .
?system rdfs:label ?systemLabel .
} .
} GROUP BY ?item ?itemLabel ?date ?end }
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)
}
BIND(IF(strlen(?shortLabel)>0,CONCAT(?itemLabel," (",?shortLabel,")"),?itemLabel) AS ?name)
BIND(IF(BOUND(?end),CONCAT(STR(YEAR(?date)),"-",STR(YEAR(?end))),STR(YEAR(?date))) AS ?year)
BIND(?item as ?wikidata)
} ORDER BY DESC(?year)