0

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
tim_76
  • 74
  • 6
  • 1
    you can use a subquery to get only `n` different movements. What you can't do unfortunately is to get `m` per each movements then, i.e. you are not able to get an equally distributed dataset – UninformedUser Apr 07 '22 at 11:18
  • 1
    `SELECT ... WHERE {... {SELECT DISTINCT ?movement {?item wdt:P135 ?movement } LIMIT 10} ... } LIMIT 100` – UninformedUser Apr 07 '22 at 11:19

0 Answers0