query-a29dac14ec2401d8a9660155577f01c2
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 (group_concat(distinct ?publication_date;separator="; ") as ?pd) (group_concat(distinct ?imdb_code;separator="; ") as ?imdb) (GROUP_CONCAT(distinct ?directorLabel;separator="; ") AS ?directors) (GROUP_CONCAT(distinct ?screenwriterLabel;separator="; ") AS ?screenwriter)
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 inlabel:'three men and a leg'@en" .
?item wikibase:apiOutputItem mwapi:title.
}
OPTIONAL {?item wdt:P577 ?publication_date . }
OPTIONAL {?item wdt:P345 ?imdb_code .}
OPTIONAL {?item wdt:P57 ?director .}
OPTIONAL {?item wdt:P58 ?screenwriter .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,it,es,de,fr,hu,ro" .
?item rdfs:label ?itemLabel .
?director rdfs:label ?directorLabel .
?screenwriter rdfs:label ?screenwriterLabel.}
} group by ?item ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?director")
v7("?directorLabel"):::projected
v11("?directors")
v10("?imdb")
v3("?imdb_code"):::projected
v1("?item"):::projected
v6("?itemLabel"):::projected
v9("?pd")
v2("?publication_date"):::projected
v12("?screenwriter")
v8("?screenwriterLabel"):::projected
c6(["www.wikidata.org"]):::literal
c10(["haswbstatement:P31=Q11424 inlabel:'three men and a leg'@en"]):::literal
c19(["#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 optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P58".-> v12
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c2 --"mwapi:language"--> c19
v1 --"rdfs:label"--> v6
v4 --"rdfs:label"--> v7
v12 --"rdfs:label"--> v8
end
bind4[/"?publication_date"/]
v2 --o bind4
bind4 --as--o v9
bind5[/"?imdb_code"/]
v3 --o bind5
bind5 --as--o v10
bind6[/"?directorLabel"/]
v7 --o bind6
bind6 --as--o v11
bind7[/"?screenwriterLabel"/]
v8 --o bind7
bind7 --as--o v12