query-e8d4459d7abd4d2a86a2d9d42b1f75db

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)part of the series (P179)follows (P155)followed by (P156)

Use at

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 p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?follows ?followsLabel ?followed_by ?followed_byLabel ?statement WHERE {
  ?item wdt:P31/wdt:P279* wd:Q7889.
  ?item p:P179 ?statement.
  OPTIONAL { ?statement pq:P155 ?follows. FILTER (!wikibase:isSomeValue(?follows)) }
  OPTIONAL { ?statement pq:P156 ?followed_by. FILTER (!wikibase:isSomeValue(?followed_by)) }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY (UCASE(STR(?itemLabel)))

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?followed_by"):::projected v3("?follows"):::projected v4("?item"):::projected v1("?itemLabel"):::projected v5("?statement"):::projected a1((" ")) c8(["bd:serviceParam"]):::iri c3(["wd:Q7889"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal v4 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v4 --"p:P179"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P155".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P156".-> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end