query-411ed731d52b151a9cec8c1eaaf30bba
Filtering only truthy nodesI want a properties that are both truthy and have an English language qualifier, but struggle to get both. I have
Use at
- https://query.wikidata.org/sparql
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#>
SELECT DISTINCT ?issuer ?issuerLabel ?register ?URLprefix WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "en-GB,en". }
{
SELECT DISTINCT ?issuer ?register ?URLprefix WHERE {
?register p:P31 ?statement0.
?statement0 (ps:P31/(wdt:P279*)) wd:Q18618628. # cultural heritage
?register wdt:P17 wd:Q145.
?register p:P1630 [ps:P1630 ?URLprefix; pq:P407 wd:Q1860].
#?register wdt:P1630 ?URLprefix.
#FILTER (lang(?URLprefix) = "en")
OPTIONAL {?register wdt:P2378 ?issuer}
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?URLprefix"):::projected
v4("?issuer"):::projected
v1("?register"):::projected
v2("?statement0")
a1((" "))
a2((" "))
c4(["en-GB,en"]):::literal
c2(["bd:serviceParam"]):::iri
c8(["wd:Q18618628"]):::iri
c10(["wd:Q145"]):::iri
c13(["wd:Q1860"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v1 --"p:P31"--> v2
v2 --"p:statement/P31"--> a1
a1 --"p:direct/P279"--> c8
v1 --"p:direct/P17"--> c10
a2 --"p:statement/P1630"--> v3
a2 --"p:qualifier/P407"--> c13
v1 --"p:P1630"--> a2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P2378".-> v4
end