query-736a4137b397944a341f7153fc05a67c
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?item ?ilen ?sitelink_EN ?ilar ?sitelink_AR {
?item wdt:P31/wdt:P279* wd:Q486972. # are some type of human settlement
?item wdt:P17 ?country. ?country wdt:P37 wd:Q13955. # in countries with official language Arabic
OPTIONAL { ?item rdfs:label ?ilen. FILTER(LANG(?ilen)="en") } # get the English label only
OPTIONAL { ?item rdfs:label ?ilar. FILTER(LANG(?ilar)="ar") } # get the Arabic label only
OPTIONAL { ?sitelink_EN ^schema:name ?article_EN . ?article_EN schema:about ?item ; schema:isPartOf <https://en.wikipedia.org/> . } # get the EN Wikipedia article name
OPTIONAL { ?sitelink_AR ^schema:name ?article_AR . ?article_AR schema:about ?item ; schema:isPartOf <https://ar.wikipedia.org/> . } # get the AR Wikipedia article name
filter (?sitelink_EN != ?ilen || ?sitelink_AR != ?ilar)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?article_AR")
v7("?article_EN")
v6("?country")
v4("?ilar"):::projected
v2("?ilen"):::projected
v5("?item"):::projected
v3("?sitelink_AR"):::projected
v1("?sitelink_EN"):::projected
a1((" "))
c5(["wd:Q486972"]):::iri
c13([https://en.wikipedia.org/]):::iri
c14([https://ar.wikipedia.org/]):::iri
c8(["wd:Q13955"]):::iri
f0[["(?sitelink_EN != ?ilen || ?sitelink_AR != ?ilar)"]]
f0 --> v1
f0 --> v2
f0 --> v3
f0 --> v4
v5 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
v5 --"wdt:P17"--> v6
v6 --"wdt:P37"--> c8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."rdfs:label".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."rdfs:label".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v7 -."schema:name".-> v1
v7 --"schema:about"--> v5
v7 --"schema:isPartOf"--> c13
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v8 -."schema:name".-> v3
v8 --"schema:about"--> v5
v8 --"schema:isPartOf"--> c14
end