query-18731ef0a881a097c7643dab68e8f619

rq turtle/ttl

SPARQL query

Use at

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 ?id ?itemLabel WHERE {
  ?item p:P39 ?mem .
  ?mem ps:P39 wd:Q61976148 .
  OPTIONAL { ?mem pq:P4100 ?faction }
  OPTIONAL { ?item wdt:P4287 ?id }
  FILTER NOT EXISTS { ?mem pq:P582 [] } # no end date
  SERVICE wikibase:label { bd:serviceParam wikibase:language "et,en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?faction") v4("?id"):::projected v2("?item") v1("?mem") a1((" ")) c4(["wd:Q61976148"]):::iri c10(["et,en"]):::literal c8(["bd:serviceParam"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"p:qualifier/P582"--> e0a1 e0v1("?mem"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> a1 v1 --"p:qualifier/P582"--> a1 v2 --"p:P39"--> v1 v1 --"p:statement/P39"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:qualifier/P4100".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P4287".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end