query-d3d1dbfaeffc98d0038023adc7c47cab
rq turtle/ttl
by Jura1 2016-09-16, rev. 2017-07-16, adapted from query by User:Syced
SELECT DISTINCT
?item ?host ?sl ?st ?l ?hostLabel ?opLabel ?coor ?op ?p6 ?p4 ?p1
(str(( 10 * ROUND( (?p1 + ?p2 + ?p3 + ?p4 + ?p5 + ?p6 + ?p7 + ?p8 + ?p9 + ?p10 ) / 10 * 10))) as ?c1) ?www
(CONCAT("data-sort-value='", ?c1, "' \u007C [[File:Progressbar", ?c1, ".png\u007Ccenter\u007C100px\u007C ", ?c1, " %]]") as ?completeness)
{
BIND(wd:Q63638898 AS ?item) .
?item wdt:P31 wd:Q3917681 .
OPTIONAL {?item wdt:P131*/wdt:P17 ?host } BIND(xsd:integer(BOUND(?host)) as ?p1)
OPTIONAL {?item wdt:P131 ?city } BIND(xsd:integer(BOUND(?city)) as ?p2)
OPTIONAL {?item wdt:6375?addr } BIND(xsd:integer(BOUND(?addr)) as ?p3)
OPTIONAL {?item wdt:P625 ?coor } BIND(xsd:integer(BOUND(?coor)) as ?p4)
OPTIONAL {?item wdt:P137 ?op } BIND(xsd:integer(BOUND(?op)) as ?p5)
OPTIONAL {?item wdt:P1329 ?phn } BIND(xsd:integer(BOUND(?phn)) as ?p6)
OPTIONAL {?item wdt:P856 ?webs } BIND(xsd:integer(BOUND(?webs)) as ?p7)
OPTIONAL {?item wdt:P18 ?image } BIND(xsd:integer(BOUND(?image)) as ?p8)
OPTIONAL {?item wikibase:sitelinks ?sl } BIND(xsd:integer(BOUND(?sl) && ?sl > 0) as ?p9)
OPTIONAL {?item wikibase:statements ?st }
OPTIONAL {?item wdt:P856 ?w . BIND( CONCAT("[", str(?w), " ", substr( REPLACE(str(?w), "https?://(www.)?", ""), 0, 65) , "]") as ?www) }
OPTIONAL {?op p:P530 [ ps:P530 ?host ; pq:P531 ?item ] . BIND("ok" as ?l) }
BIND(xsd:integer(BOUND(?l)) as ?p10)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(?p1) ?hostLabel ?opLabel ?item
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# by Jura1 2016-09-16, rev. 2017-07-16, adapted from query by User:Syced
SELECT DISTINCT
?item ?host ?sl ?st ?l ?hostLabel ?opLabel ?coor ?op ?p6 ?p4 ?p1
(str(( 10 * ROUND( (?p1 + ?p2 + ?p3 + ?p4 + ?p5 + ?p6 + ?p7 + ?p8 + ?p9 + ?p10 ) / 10 * 10))) as ?c1) ?www
(CONCAT("data-sort-value='", ?c1, "' \u007C [[File:Progressbar", ?c1, ".png\u007Ccenter\u007C100px\u007C ", ?c1, " %]]") as ?completeness)
{
BIND(wd:Q63638898 AS ?item) .
?item wdt:P31 wd:Q3917681 .
OPTIONAL {?item wdt:P131*/wdt:P17 ?host } BIND(xsd:integer(BOUND(?host)) as ?p1)
OPTIONAL {?item wdt:P131 ?city } BIND(xsd:integer(BOUND(?city)) as ?p2)
OPTIONAL {?item wdt:6375?addr } BIND(xsd:integer(BOUND(?addr)) as ?p3)
OPTIONAL {?item wdt:P625 ?coor } BIND(xsd:integer(BOUND(?coor)) as ?p4)
OPTIONAL {?item wdt:P137 ?op } BIND(xsd:integer(BOUND(?op)) as ?p5)
OPTIONAL {?item wdt:P1329 ?phn } BIND(xsd:integer(BOUND(?phn)) as ?p6)
OPTIONAL {?item wdt:P856 ?webs } BIND(xsd:integer(BOUND(?webs)) as ?p7)
OPTIONAL {?item wdt:P18 ?image } BIND(xsd:integer(BOUND(?image)) as ?p8)
OPTIONAL {?item wikibase:sitelinks ?sl } BIND(xsd:integer(BOUND(?sl) && ?sl > 0) as ?p9)
OPTIONAL {?item wikibase:statements ?st }
OPTIONAL {?item wdt:P856 ?w . BIND( CONCAT("[", str(?w), " ", substr( REPLACE(str(?w), "https?://(www.)?", ""), 0, 65) , "]") as ?www) }
OPTIONAL {?op p:P530 [ ps:P530 ?host ; pq:P531 ?item ] . BIND("ok" as ?l) }
BIND(xsd:integer(BOUND(?l)) as ?p10)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(?p1) ?hostLabel ?opLabel ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?addr")
v27("?c1"):::projected
v6("?city")
v28("?completeness")
v10("?coor"):::projected
v5("?host"):::projected
v2("?hostLabel"):::projected
v18("?image")
v5("?item"):::projected
v25("?l"):::projected
v12("?op"):::projected
v3("?opLabel"):::projected
v6("?p1"):::projected
v26("?p10"):::projected
v7("?p2"):::projected
v9("?p3"):::projected
v11("?p4"):::projected
v13("?p5"):::projected
v15("?p6"):::projected
v17("?p7"):::projected
v19("?p8"):::projected
v21("?p9"):::projected
v14("?phn")
v20("?sl"):::projected
v22("?st"):::projected
v23("?w")
v16("?webs")
v24("?www"):::projected
a1((" "))
a2((" "))
c19(["en"]):::literal
c17(["bd:serviceParam"]):::iri
c2(["wd:Q3917681"]):::iri
bind0[/"'wd:Q63638898'"/]
bind0 --as--o v5
v5 --"p:direct/P31"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P131".-> a1
a1 --"p:direct/P17"--> v5
end
bind1[/"http://www.w3.org/2001/XMLSchema#integer(bound(?host))"/]
v5 --o bind1
bind1 --as--o v6
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P131".-> v6
end
bind2[/"http://www.w3.org/2001/XMLSchema#integer(bound(?city))"/]
v6 --o bind2
bind2 --as--o v7
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/6375".-> v8
end
bind3[/"http://www.w3.org/2001/XMLSchema#integer(bound(?addr))"/]
v8 --o bind3
bind3 --as--o v9
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P625".-> v10
end
bind4[/"http://www.w3.org/2001/XMLSchema#integer(bound(?coor))"/]
v10 --o bind4
bind4 --as--o v11
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P137".-> v12
end
bind5[/"http://www.w3.org/2001/XMLSchema#integer(bound(?op))"/]
v12 --o bind5
bind5 --as--o v13
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P1329".-> v14
end
bind6[/"http://www.w3.org/2001/XMLSchema#integer(bound(?phn))"/]
v14 --o bind6
bind6 --as--o v15
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P856".-> v16
end
bind7[/"http://www.w3.org/2001/XMLSchema#integer(bound(?webs))"/]
v16 --o bind7
bind7 --as--o v17
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P18".-> v18
end
bind8[/"http://www.w3.org/2001/XMLSchema#integer(bound(?image))"/]
v18 --o bind8
bind8 --as--o v19
subgraph optional8["(optional)"]
style optional8 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wikibase:sitelinks".-> v20
end
bind9[/"http://www.w3.org/2001/XMLSchema#integer(bound(?sl)?sl > '0^^xsd:integer')"/]
v20 --o bind9
bind9 --as--o v21
subgraph optional9["(optional)"]
style optional9 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wikibase:statements".-> v22
end
subgraph optional10["(optional)"]
style optional10 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P856".-> v23
bind10[/"concat('#91;',str(?w),' ',substring(replace(str(?w),'https?://(www.)?',''),'0^^xsd:integer','65^^xsd:integer'),'#93;')"/]
v23 --o bind10
bind10 --as--o v24
end
subgraph optional11["(optional)"]
style optional11 fill:#bbf,stroke-dasharray: 5 5;
a2 -."p:statement/P530".-> v5
a2 --"p:qualifier/P531"--> v5
v12 --"p:P530"--> a2
bind11[/"'ok'"/]
bind11 --as--o v25
end
bind12[/"http://www.w3.org/2001/XMLSchema#integer(bound(?l))"/]
v25 --o bind12
bind12 --as--o v26
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c17 --"wikibase:language"--> c19
end
bind13[/"str('10^^xsd:integer' * numeric-round(?p1 + ?p2 + ?p3 + ?p4 + ?p5 + ?p6 + ?p7 + ?p8 + ?p9 + ?p10 / '10^^xsd:integer' * '10^^xsd:integer'))"/]
v6 --o bind13
v7 --o bind13
v9 --o bind13
v11 --o bind13
v13 --o bind13
v15 --o bind13
v17 --o bind13
v19 --o bind13
v21 --o bind13
v26 --o bind13
bind13 --as--o v27
bind14[/"concat('data-sort-value='',?c1,'' | #91;#91;File:Progressbar',?c1,'.png|center|100px| ',?c1,' %#93;#93;')"/]
v27 --o bind14
bind14 --as--o v28