query-90c3846efee3fb5f814d45c53cc1628f

rq turtle/ttl

All Greek mythology related items and their links to MANTO, Mythoskop, MythsOnMaps

and ToposText as well as their article in the Realencyclopädie

SELECT DISTINCT ?item ?itemLabel ?REArticle ?MANTO ?Mythoskop ?MythsOnMaps ?ToposText WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?item (wdt:P31/wdt:P279*)?/wdt:P361 wd:Q34726 . OPTIONAL { ?item p:P1343 ?statement . ?statement ps:P1343 wd:Q1138524 . OPTIONAL { ?statement pq:P805 ?REitem . ?REArticle schema:about ?REitem ; schema:isPartOf https://de.wikisource.org/ .} OPTIONAL { ?statement pq:P958 ?REArticle . } #the RE article exists, but has yet to be made available } OPTIONAL { ?item2 wdt:P460 ?item ; p:P1343 ?statement . ?statement ps:P1343 wd:Q1138524 . OPTIONAL { ?statement pq:P805 ?REitem . ?REArticle schema:about ?REitem ; schema:isPartOf https://de.wikisource.org/ . } #the item isn't described, but another figure to whom it is said to be the same as is described OPTIONAL { ?statement pq:P958 ?REArticle . } #same as above, but has yet to be made available } OPTIONAL { ?item wdt:P9660 wd:Q1138524 . BIND("N/A" AS ?REArticle) } #if there is no RE article OPTIONAL { ?item wdt:P9736 ?manto . wd:P9736 wdt:P1630 ?fmtMANTO . BIND(IRI(REPLACE(?manto, CONCAT('(',?manto,')'), ?fmtMANTO)) AS ?MANTO) .} OPTIONAL { ?item wdt:P11946 ?mythoskop . wd:P11946 wdt:P1630 ?fmtMythoskop . BIND(IRI(REPLACE(?mythoskop, CONCAT('(',?mythoskop,')'), ?fmtMythoskop)) AS ?Mythoskop) .} OPTIONAL { ?item wdt:P12402 ?mythsonmaps . wd:P12402 wdt:P1630 ?fmtMythsOnMaps . BIND(IRI(REPLACE(?mythsonmaps, CONCAT('(',?mythsonmaps,')'), ?fmtMythsOnMaps)) AS ?MythsOnMaps) .} OPTIONAL { ?item wdt:P8069 ?topostext . wd:P8069 wdt:P1630 ?fmtToposText . BIND(IRI(REPLACE(?topostext, CONCAT('(',?topostext,')'), ?fmtToposText)) AS ?ToposText) .} }

ORDER BY STR(?itemLabel)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
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#>
#All Greek mythology related items and their links to MANTO, Mythoskop, MythsOnMaps
#and ToposText as well as their article in the Realencyclopädie
SELECT DISTINCT ?item ?itemLabel ?REArticle ?MANTO ?Mythoskop ?MythsOnMaps ?ToposText WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?item (wdt:P31/wdt:P279*)?/wdt:P361 wd:Q34726 .
  OPTIONAL { ?item p:P1343 ?statement .
            ?statement ps:P1343 wd:Q1138524 .
            OPTIONAL { ?statement pq:P805 ?REitem .
                       ?REArticle schema:about ?REitem ;
                                  schema:isPartOf <https://de.wikisource.org/> .}
            OPTIONAL { ?statement pq:P958 ?REArticle . } #the RE article exists, but has yet to be made available
            }
  OPTIONAL { ?item2 wdt:P460 ?item ;
                    p:P1343 ?statement .
            ?statement ps:P1343 wd:Q1138524 .
            OPTIONAL { ?statement pq:P805 ?REitem .
                       ?REArticle schema:about ?REitem ;
                                  schema:isPartOf <https://de.wikisource.org/> . } #the item isn't described, but another figure to whom it is said to be the same as is described
            OPTIONAL { ?statement pq:P958 ?REArticle . } #same as above, but has yet to be made available
            }
  OPTIONAL { ?item wdt:P9660 wd:Q1138524 .
             BIND("N/A" AS ?REArticle) } #if there is no RE article
  OPTIONAL { ?item wdt:P9736 ?manto .
             wd:P9736 wdt:P1630 ?fmtMANTO .
             BIND(IRI(REPLACE(?manto,  CONCAT('(',?manto,')'), ?fmtMANTO)) AS ?MANTO) .}
  OPTIONAL { ?item wdt:P11946 ?mythoskop .
             wd:P11946 wdt:P1630 ?fmtMythoskop .
             BIND(IRI(REPLACE(?mythoskop,  CONCAT('(',?mythoskop,')'), ?fmtMythoskop)) AS ?Mythoskop) .}
  OPTIONAL { ?item wdt:P12402 ?mythsonmaps .
             wd:P12402 wdt:P1630 ?fmtMythsOnMaps .
             BIND(IRI(REPLACE(?mythsonmaps,  CONCAT('(',?mythsonmaps,')'), ?fmtMythsOnMaps)) AS ?MythsOnMaps) .}
  OPTIONAL { ?item wdt:P8069 ?topostext .
             wd:P8069 wdt:P1630 ?fmtToposText .
             BIND(IRI(REPLACE(?topostext,  CONCAT('(',?topostext,')'), ?fmtToposText)) AS ?ToposText) .}
}

ORDER BY STR(?itemLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?MANTO"):::projected v12("?Mythoskop"):::projected v15("?MythsOnMaps"):::projected v7("?REArticle"):::projected v4("?REitem") v18("?ToposText"):::projected v8("?fmtMANTO") v11("?fmtMythoskop") v14("?fmtMythsOnMaps") v17("?fmtToposText") v2("?item"):::projected v6("?item2") v1("?itemLabel"):::projected v7("?manto") v10("?mythoskop") v13("?mythsonmaps") v3("?statement") v16("?topostext") a1((" ")) a2((" ")) c27(["wd:P8069"]):::iri c25(["wd:P12402"]):::iri c20(["wd:P9736"]):::iri c23(["wd:P11946"]):::iri c2(["bd:serviceParam"]):::iri c8(["wd:Q34726"]):::iri c11(["wd:Q1138524"]):::iri c15([https://de.wikisource.org/]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> a1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end a1 --"p:direct/P361"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P1343".-> v3 v3 --"p:statement/P1343"--> c11 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P805".-> v4 v7 --"schema:about"--> v4 v7 --"schema:isPartOf"--> c15 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P958".-> v7 end end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:direct/P460".-> v2 v6 --"p:P1343"--> v3 v3 --"p:statement/P1343"--> c11 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P805".-> v4 v7 --"schema:about"--> v4 v7 --"schema:isPartOf"--> c15 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P958".-> v7 end end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P9660".-> c11 bind0[/"'N/A'"/] bind0 --as--o v7 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P9736".-> v7 c20 --"p:direct/P1630"--> v8 bind1[/"replace(?manto,concat('(',?manto,')'),?fmtMANTO)"/] v7 --o bind1 v8 --o bind1 bind1 --as--o v9 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P11946".-> v10 c23 --"p:direct/P1630"--> v11 bind2[/"replace(?mythoskop,concat('(',?mythoskop,')'),?fmtMythoskop)"/] v10 --o bind2 v11 --o bind2 bind2 --as--o v12 end subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P12402".-> v13 c25 --"p:direct/P1630"--> v14 bind3[/"replace(?mythsonmaps,concat('(',?mythsonmaps,')'),?fmtMythsOnMaps)"/] v13 --o bind3 v14 --o bind3 bind3 --as--o v15 end subgraph optional10["(optional)"] style optional10 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P8069".-> v16 c27 --"p:direct/P1630"--> v17 bind4[/"replace(?topostext,concat('(',?topostext,')'),?fmtToposText)"/] v16 --o bind4 v17 --o bind4 bind4 --as--o v18 end