1 year ago
#386696
tim_76
Limiting diversity of attributes in Wikidata / SPARQL Query
I want to create a dataset of 100 paintings querying from Wikidata.
With my current query, for each painting I retrieve the artist (creator), the movement, the year it was painted (inception) and so on.
I would like to fix a limit to the number of different movements in my data set. Same for the artists. (i.e. I will have only paintings from n
random genres at unspecified proportions).
So for example if I limit to 2 movements I would have only Pop-Art and Cubist paintings or Neoclassic and Impressionist, etc.
SELECT ?itemLabel ?pic ?movementLabel ?creatorLabel ?inception
WHERE
{
?item wdt:P31 wd:Q3305213 .
?item wdt:P135 ?movement .
?item wdt:P170 ?creator .
?item wdt:P18 ?pic .
?item wdt:P571 ?inception
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
LIMIT 100
sparql
wikidata
0 Answers
Your Answer