query-fadf731911fc26a782096271c3d95e7e
05:51, 2 June 2017 (UTC)) talk (d1g about that. Is that what you want to do? expanded guide with section: 1 and 2 are the same. I SharkD@. And the relevant bits:Here is my attempt: D1gggg@deletedOkay, I got it to work: 17:57, 2 June 2017 (UTC)) talk (SharkD. It is not showing rdf:type
and publication date
of the item. Here is a more minimal case 15:32, 2 June 2017 (UTC)) talk (SharkDI am not getting anything other than empty strings however.
Use at
- https://query.wikidata.org/sparql
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 bd: <http://www.bigdata.com/rdf#>
SELECT
(group_concat(distinct ?dateYear ; separator = ", ") AS ?dateYears)
(group_concat(distinct ?gameENLabel ; separator = ", ") AS ?gameENLabels)
(group_concat(distinct ?typeOfStatementNode ; separator = ", ") AS ?typeOfStatementNodes)
WHERE {
VALUES ?game {
wd:Q4850488
wd:Q4931588
wd:Q5315330
}
?game rdfs:label ?gameENLabel.
FILTER(LANG(?gameENLabel) = "en").
OPTIONAL {
?game wdt:P577 ?date.
# BIND(YEAR(?date) AS ?dateYear).
}
?game ?boogie ?whaat.
optional {
?whaat rdf:type ?typeOfStatementNode.
}
BIND(IF(isBlank(?whaat), "unknown value", IF(?typeOfStatementNode = IRI("http://www.wikidata.org/prop/novalue/P577"), "no value", YEAR(?date))) as ?dateYear).
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
}
}
GROUP BY $game
order by desc(?dateYears)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?boogie")
v4("?date")
v8("?dateYear"):::projected
v9("?dateYears")
v3("?game")
v2("?gameENLabel"):::projected
v9("?gameENLabels")
v7("?typeOfStatementNode"):::projected
v10("?typeOfStatementNodes")
v6("?whaat")
c6(["bd:serviceParam"]):::iri
c1(["en"]):::literal
f0[["?gameENLabel = 'en'"]]
f0 --> v2
bind1[/VALUES ?game/]
bind1-->v3
bind10(["wd:Q4850488"])
bind10 --> bind1
bind11(["wd:Q4931588"])
bind11 --> bind1
bind12(["wd:Q5315330"])
bind12 --> bind1
v3 --"rdfs:label"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P577".-> v4
end
v3 -->v5--> v6
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."a".-> v7
end
bind2[/"if(isBlank(?whaat),'unknown value',if(?typeOfStatementNode = 'http://www.wikidata.org/prop/novalue/P577','no value',year-from-dateTime(?date)))"/]
v6 --o bind2
v7 --o bind2
v4 --o bind2
bind2 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c1
end
bind6[/"?dateYear"/]
v8 --o bind6
bind6 --as--o v9
bind7[/"?gameENLabel"/]
v2 --o bind7
bind7 --as--o v9
bind8[/"?typeOfStatementNode"/]
v7 --o bind8
bind8 --as--o v10