query-4062c41a5068e5c0950843f9be575fc2
TODO
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?person ?personLabel ?propertyLabel ?film ?filmLabel ?date WHERE
{
{
SELECT ?person ?property ?film (MIN(?date_) as ?date) WHERE {
{ {?item wdt:P179 wd:Q23733.
?item ?ppredicate ?person .}
UNION
{wd:Q23733 ?ppredicate ?person .}
?person wdt:P31 wd:Q5 .
?pproperty wikibase:directClaim ?ppredicate .
} # get the people
?film ?predicate ?person . # get items that mention the person
?property wikibase:directClaim ?predicate .
OPTIONAL {?film wdt:P577 ?date_ . } # get the publication date
# which we aggregate above to get the minimum date
} GROUP BY ?person ?property ?film } ?film wdt:P31/wdt:P279* wd:Q2431196 . # check that the film is an audiovisual work
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?date"):::projected
v8("?date_")
v5("?film"):::projected
v1("?item")
v3("?person"):::projected
v2("?ppredicate")
v4("?pproperty")
v6("?predicate")
v7("?property")
a1((" "))
c10(["bd:serviceParam"]):::iri
c4(["wd:Q5"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c8(["wd:Q2431196"]):::iri
c2(["wd:Q23733"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
c2 -->v2--> v3
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"wdt:P179"--> c2
v1 -->v2--> v3
end
union0r <== or ==> union0l
end
v3 --"wdt:P31"--> c4
v4 --"wikibase:directClaim"--> v2
v5 -->v6--> v3
v7 --"wikibase:directClaim"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P577".-> v8
end
bind1[/"min(?date_)"/]
v8 --o bind1
bind1 --as--o v9
v5 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end