query-730fbb9e704319d5fa5140cfc7c78330
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?publication_date ?imdb_code (GROUP_CONCAT(?directorLabel;separator="; ") AS ?directors) WHERE {
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:api "Search" .
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam mwapi:srnamespace "0" .
bd:serviceParam mwapi:srsearch "haswbstatement:P31=Q11424 -haswbstatement:P360 inlabel:'Titanic'@en" .
?item wikibase:apiOutputItem mwapi:title.
#?ddp wikibase:apiOutputItem mwapi:publication_date. #it doesent't work like that obv
}
OPTIONAL {?item wdt:P577 ?publication_date . }
OPTIONAL {?item wdt:P345 ?imdb_code .}
OPTIONAL {?item wdt:P57 ?director .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it,es,de,fr,hu,ro" .
?item rdfs:label ?itemLabel .
?director rdfs:label ?directorLabel .}
} group by ?item ?itemLabel ?publication_date ?imdb_code
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?director")
v6("?directorLabel"):::projected
v7("?directors")
v3("?imdb_code"):::projected
v1("?item"):::projected
v5("?itemLabel"):::projected
v2("?publication_date"):::projected
c6(["www.wikidata.org"]):::literal
c10(["haswbstatement:P31=Q11424 -haswbstatement:P360 inlabel:'Titanic'@en"]):::literal
c18(["#91;AUTO_LANGUAGE#93;,en,it,es,de,fr,hu,ro"]):::literal
c8(["0"]):::literal
c2(["bd:serviceParam"]):::iri
c4(["Search"]):::literal
c12(["mwapi:title"]):::iri
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:api"--> c4
c2 --"mwapi:endpoint"--> c6
c2 --"mwapi:srnamespace"--> c8
c2 --"mwapi:srsearch"--> c10
v1 --"mwapi:apiOutputItem"--> c12
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P577".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P345".-> v3
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P57".-> v4
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c2 --"mwapi:language"--> c18
v1 --"rdfs:label"--> v5
v4 --"rdfs:label"--> v6
end
bind1[/"?directorLabel"/]
v6 --o bind1
bind1 --as--o v7