Importantus / ArtfulTab

A browser extension that shows artworks from Wikimedia Commons on the New Tab page
5 stars 0 forks source link

Query with sparql #8

Open Importantus opened 4 months ago

Importantus commented 4 months ago

Sparql is Wikidata's query service that allows complex queries. Integrating this service would allow users to choose which paintings they want to see (only landscapes, for example).

Importantus commented 4 months ago

Example query:

SELECT ?painting ?paintingLabel ?article ?file ?artistArticle
WHERE
{
  ?painting wdt:P31 wd:Q3305213; # Gemälde
            wdt:P170 ?artist. # Künstler des Gemäldes

  ?painting wdt:P18 ?file.

   OPTIONAL{  ?artistArticle schema:about ?artist;
   schema:isPartOf <https://de.wikipedia.org/>.}

  MINUS { ?painting wdt:P31 wd:Q1278452. } # Ausschluss von Polyptychon
  MINUS { ?painting wdt:P31 wd:Q11801536. } # Ausschluss von Flügelaltar
  MINUS { ?painting wdt:P31 wd:Q1181933. }
  MINUS { ?painting wdt:P31 wd:Q848330. }
  MINUS { ?painting wdt:P31 wd:Q79218. } 
  MINUS { ?painting wdt:P31 wd:Q15711026. } 
  MINUS { ?painting wdt:P31 wd:Q475476. } 
  MINUS { ?painting wdt:P31 wd:Q46686. } 

  # FIlter nudity
  MINUS { ?painting wdt:P136 wd:Q40446. } 
  MINUS { ?painting wdt:180 wd:Q22808839. } 
  MINUS { ?painting wdt:180 wd:Q10791. } 

  # Filter religious art
  MINUS { ?painting wdt:P136 wd:Q2864737. }  

 OPTIONAL{  ?article schema:about ?painting;
   schema:isPartOf <https://de.wikipedia.org/>.}

  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
}
Limit 100