query-5be039b85cd6e32d161217b1f594a7d8

rq turtle/ttl

Use p:P17 to get the statement node (as you did) and then ps:P17 to get the Country value: Philippines wdt:P17 plus Philippines p:P17 Philippines wdt:P17 plus US p:P17 US wdt:P17 plus Philippines p:P17 US wdt:P17 plus US p:P17, for instance, two countries are specified in its P17, so you have two possible wdt:P17 values and two possible p:P17 values & so you get four rows: (Q185639)electric chair You're getting some sort of Cartesian product of the wdt:P17 and the p:P17 ... the two were not properly tied together. For 13:30, 5 March 2022 (UTC) 2003:6:6320:8B32:50AF:F464:4185:DThank you, that works fine! 15:35, 5 March 2022 (UTC)) talk (Infrastruktur? Most of the data you are interested in is not registered on the execution method itself, but rather on the victim. I had some problems with the aggregation of minimum and maximum values, maybe someone can help with that? XY problemMaybe this is a case of the

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 rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT
  ?what
  (SAMPLE(?whatLabel) AS ?execution_method)
  (GROUP_CONCAT(DISTINCT ?whateverLabel; SEPARATOR=", ") AS ?given_as)
  (GROUP_CONCAT(DISTINCT ?country_Label; SEPARATOR=", ") AS ?country)
  (YEAR(MIN(?dod)) AS ?dodMin)
  (xsd:integer(AVG(YEAR(?dod))) AS ?dodAvg)
  (YEAR(MAX(?dod)) AS ?dodMax)
  (COUNT (?whatLabel) AS ?count)
WHERE {
  ?what wdt:P31 wd:Q15169167 .
  ?item wdt:P31 wd:Q5;
    ?whatever ?what;
    p:P570 ?dod_st .
  ?dod_st psv:P570 ?dod_vn;
    rdf:type wikibase:BestRank .
  ?dod_vn wikibase:timeValue ?dod;
    wikibase:timePrecision ?dod_prec .
  FILTER (?dod_prec >= 9)
  OPTIONAL {
    ?whatever_prop wikibase:claim|wikibase:directClaim|wikibase:directClaimNormalized ?whatever .
    ?whatever_prop rdfs:label ?whateverLabel . FILTER(LANG(?whateverLabel) = "en") .
  }
  ?what rdfs:label ?whatLabel . FILTER(LANG(?whatLabel) = "en") .
  OPTIONAL {
    ?item wdt:P27 ?country_ .
    ?country_ rdfs:label ?country_Label . FILTER(LANG(?country_Label) = "en")
  }
}
GROUP BY ?what
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v20("?count") v16("?country") v13("?country_") v3("?country_Label"):::projected v11("?dod") v18("?dodAvg") v19("?dodMax") v17("?dodMin") v4("?dod_prec") v9("?dod_st") v10("?dod_vn") v14("?execution_method") v15("?given_as") v7("?item") v6("?what"):::projected v2("?whatLabel"):::projected v8("?whatever") v5("?whateverLabel"):::projected v12("?whatever_prop") c9(["wikibase:BestRank"]):::iri c5(["wd:Q5"]):::iri c4(["wd:Q15169167"]):::iri f0[["?whatLabel = 'en'"]] f0 --> v2 f1[["?dod_prec >= '9^^xsd:integer'"]] f1 --> v4 v6 --"p:direct/P31"--> c4 v7 --"p:direct/P31"--> c5 v7 -->v8--> v6 v7 --"p:P570"--> v9 v9 --"p:statement/value/P570"--> v10 v9 --"a"--> c9 v10 --"wikibase:timeValue"--> v11 v10 --"wikibase:timePrecision"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v12 -."wikibase:directClaimNormalized".-> v8 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v12 --"wikibase:directClaim"--> v8 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v12 --"wikibase:claim"--> v8 end union0r <== or ==> union0l end v12 --"rdfs:label"--> v5 end v6 --"rdfs:label"--> v2 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P27".-> v13 v13 --"rdfs:label"--> v3 end bind9[/"sample(?whatLabel)"/] v2 --o bind9 bind9 --as--o v14 bind10[/"?whateverLabel"/] v5 --o bind10 bind10 --as--o v15 bind11[/"?country_Label"/] v3 --o bind11 bind11 --as--o v16 bind12[/"year-from-dateTime()"/] null --o bind12 bind12 --as--o v17 bind13[/"http://www.w3.org/2001/XMLSchema#integer()"/] null --o bind13 bind13 --as--o v18 bind14[/"year-from-dateTime()"/] null --o bind14 bind14 --as--o v19 bind15[/"count(?whatLabel)"/] v2 --o bind15 bind15 --as--o v20