query-9047f9ed9617d65598d2d3aa9502aee8

rq turtle/ttl

Propertiespart of the series (P179)instance of (P31)series ordinal (P1545)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
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 ?series ?seriesLabel (GROUP_CONCAT(?seriesTypeLabel) AS ?seriesTypes) ?item ?itemLabel (GROUP_CONCAT(?itemTypeLabel;SEPARATOR=" | ") AS ?itemTypes) ?ordinal
WHERE {
  VALUES ?series {
    wd:Q1129378
    wd:Q165356
  }
  ?item wdt:P179 ?series .
  OPTIONAL {?item wdt:P31 ?itemType}
  OPTIONAL {?series wdt:P31 ?seriesType}
  OPTIONAL {
    ?item p:P179 [
      pq:P1545 ?ordinal; 
      ps:P179 ?series
    ]
  }
  SERVICE wikibase:label { 
    ?item rdfs:label ?itemLabel .
    ?series rdfs:label ?seriesLabel .
    ?seriesType rdfs:label ?seriesTypeLabel.
    ?itemType rdfs:label ?itemTypeLabel .
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
  }
}
GROUP BY ?series ?seriesLabel ?item ?itemLabel ?ordinal
ORDER BY ?series xsd:integer(?ordinal)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v6("?itemLabel"):::projected v4("?itemType") v9("?itemTypeLabel"):::projected v11("?itemTypes") v2("?ordinal"):::projected v3("?series"):::projected v7("?seriesLabel"):::projected v5("?seriesType") v8("?seriesTypeLabel"):::projected v10("?seriesTypes") a1((" ")) c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?series/] bind0-->v3 bind00(["wd:Q1129378"]) bind00 --> bind0 bind01(["wd:Q165356"]) bind01 --> bind0 v3 --"p:direct/P179"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P31".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P31".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; a1 -."p:qualifier/P1545".-> v2 a1 --"p:statement/P179"--> v3 v3 --"p:P179"--> a1 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; v3 --"rdfs:label"--> v6 v3 --"rdfs:label"--> v7 v5 --"rdfs:label"--> v8 v4 --"rdfs:label"--> v9 c8 --"wikibase:language"--> c10 end bind3[/"?seriesTypeLabel"/] v8 --o bind3 bind3 --as--o v10 bind4[/"?itemTypeLabel"/] v9 --o bind4 bind4 --as--o v11