query-6fff35ee2277f66ac3fb45590b6604ba
Filtering by enddate in a propertyI'm looking to create a query to get the actual ongoing index components of a stock index (IBEX35) (not only the full historical list). I filter companies who are part of IBEX35 and don't have and end date of being part. But query doesn't work and still shows me Q1493131 and Q944760 items, wich are not anymore components of the index. Any help on improving the query? Thanks in advance!
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 pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel
WHERE
{
?item wdt:P361 wd:Q938032. #Part of Ibex35 index
FILTER NOT EXISTS { ?item pq:P582 ?x } #item has no P582 (end date) qualifier
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v2("?x")
c3(["wd:Q938032"]):::iri
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"pq:P582"--> e0v2
e0v1("?item"):::projected
e0v2("?x"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> v2
v1 --"pq:P582"--> v2
v1 --"wdt:P361"--> c3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end