query-e9b67f1df86bc3e4c89fae6454f47960

rq turtle/ttl

Is it possible to have an array or list of values for a column? https://w.wiki/cVCI have this query: I was wondering if value(s) for a column in a query can be extracted as an array. For example, in a battle, there are multiple participants(wdt:P710) wd:Q39040 Battle of Yamazaki 12 July 1582 Point(135.691333333 34.907055555) Akechi Mitsuhide wd:Q39040 Battle of Yamazaki 12 July 1582 Point(135.691333333 34.907055555) Toyotomi Hideyoshivs. wd:Q39040 Battle of Yamazaki 12 July 1582 Point(135.691333333 34.907055555) [Toyotomi Hideyoshi, Akechi Mitsuhide] ).contribs • talk (Nonoumasy comment was added byunsignedThe preceding –

Use at

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 bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide": "?coordinates"}
SELECT ?battle ?battleLabel ?year ?coordinates (GROUP_CONCAT(DISTINCT ?participantLabel; separator=" // ") as ?participants) 
WHERE 
{
  ?battle ( wdt:P361 | wdt:P2348 ) wd:Q204023.

  OPTIONAL { ?battle wdt:P710 ?participant. }
  OPTIONAL { ?battle wdt:P585 ?year. }
  OPTIONAL { ?battle wdt:P625 ?coordinates. }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,ja". 
                         ?battle rdfs:label ?battleLabel .
                         ?participant rdfs:label ?participantLabel .
                         }
}
GROUP BY ?battle ?battleLabel ?year ?coordinates
ORDER BY (?year)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?battle"):::projected v5("?battleLabel"):::projected v4("?coordinates"):::projected v3("?participant") v6("?participantLabel"):::projected v7("?participants") v1("?year"):::projected c8(["bd:serviceParam"]):::iri c2(["wd:Q204023"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en,ja"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P2348"--> c2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P361"--> c2 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P710".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P585".-> v1 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P625".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 v2 --"rdfs:label"--> v5 v3 --"rdfs:label"--> v6 end bind1[/"?participantLabel"/] v6 --o bind1 bind1 --as--o v7