query-ef9ab4eaf21769e4353d05244037ef2e

rq turtle/ttl

.on Mastodon and on TwitterOriginally posted

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide": ["?layer"]}
SELECT
?statue ?statueLabel (SAMPLE(?statueLocation) AS ?statueLocation_) (SAMPLE(?statueImage) AS ?statueImage_)
?person ?personLabel
(IF(?female, "female"@en, "not female"@en) AS ?femaleLabel)
(IF(?hasNobleTitle, "has noble title"@en, "has no noble title"@en) AS ?hasNobleTitleLabel)
(CONCAT(?femaleLabel, ", "@en, ?hasNobleTitleLabel) AS ?layer)
WHERE {
  ?statue wdt:P31/wdt:P279* wd:Q860861;
          wdt:P17 wd:Q145;
          wdt:P180|wdt:P547 ?person.
  ?person wdt:P31 wd:Q5.
  BIND(EXISTS { ?person wdt:P21/wdt:P279* wd:Q6581072. } AS ?female)
  BIND(EXISTS { ?person wdt:P97 ?nobleTitle. } AS ?hasNobleTitle)
  OPTIONAL { ?statue wdt:P625 ?statueLocation. }
  OPTIONAL { ?statue wdt:P18 ?statueImage. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?statue ?statueLabel ?person ?personLabel ?female ?hasNobleTitle

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?female"):::projected v9("?femaleLabel"):::projected v4("?hasNobleTitle"):::projected v10("?hasNobleTitleLabel"):::projected v11("?layer") v2("?person"):::projected v1("?statue"):::projected v6("?statueImage"):::projected v8("?statueImage_") v5("?statueLocation"):::projected v7("?statueLocation_") a1((" ")) c12(["bd:serviceParam"]):::iri c8(["wd:Q5"]):::iri c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal c5(["wd:Q145"]):::iri c3(["wd:Q860861"]):::iri v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P17"--> c5 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P547"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P180"--> v2 end union0r <== or ==> union0l end v2 --"wdt:P31"--> c8 v2 --"wdt:P21"--> null null --"wdt:P279"--> null bind0[/" "/] subgraph bind0e0["Exists Clause"] e0v1 --"wdt:P21"--> e0a1 e0a1 --"wdt:P279"--> e0c3 e0v1("?person"):::projected e0a1((" ")):::projected e0c3(["wd:Q6581072"]):::iri end bind0--EXISTS--> bind0e0 v2 --o bind0 null --o bind0 null --o bind0 c2 --o bind0 null --o bind0 bind0 --as--o v3 v2 --"wdt:P97"--> null bind1[/" "/] subgraph bind1e1["Exists Clause"] e1v1 --"wdt:P97"--> e1v2 e1v2("?nobleTitle"):::projected e1v1("?person"):::projected end bind1--EXISTS--> bind1e1 v2 --o bind1 null --o bind1 null --o bind1 bind1 --as--o v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P625".-> v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P18".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end bind4[/"sample(?statueLocation)"/] v5 --o bind4 bind4 --as--o v7 bind5[/"sample(?statueImage)"/] v6 --o bind5 bind5 --as--o v8 bind6[/"if(?female,sfemale^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>',snot female^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>')"/] v3 --o bind6 bind6 --as--o v9 bind7[/"if(?hasNobleTitle,shas noble title^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>',shas no noble title^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>')"/] v4 --o bind7 bind7 --as--o v10 bind8[/"concat(?femaleLabel,s, ^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>',?hasNobleTitleLabel)"/] v9 --o bind8 v10 --o bind8 bind8 --as--o v11