Project:SPARQL/examples: Difference between revisions

Jump to navigation Jump to search
Line 112: Line 112:
PREFIX wbt: <http://biodiversity.wiki.opencura.com/prop/direct/>
PREFIX wbt: <http://biodiversity.wiki.opencura.com/prop/direct/>
PREFIX wb: <http://biodiversity.wiki.opencura.com/entity/>  
PREFIX wb: <http://biodiversity.wiki.opencura.com/entity/>  
SELECT * WHERE {
SELECT DISTINCT ?taxon ?taxonLabel ?wikidata WITH {
?observation wbt:P9 ?taxon .
  SELECT * WHERE {
{SELECT * WHERE {
    VALUES ?country {wd:Q664} # new zealand
  SERVICE wikibase:around {
    SERVICE wikibase:around {
         ?observation wbt:P8 ?location .
         ?observation wbt:P8 ?location .
         bd:serviceParam wikibase:center ?loc .
         bd:serviceParam wikibase:center ?loc .
         bd:serviceParam wikibase:radius "100" .
         bd:serviceParam wikibase:radius "100" .
    }
    SERVICE <https://query.wikidata.org/sparql> {
      ?country wdt:P625 ?loc .
    }
   }
   }
  SERVICE <https://query.wikidata.org/sparql> {
} as %result
       wd:Q664 wdt:P625 ?loc .
WHERE {
   }
    INCLUDE %result
}}}
    ?observation wbt:P9 ?taxon .
    ?taxon wbt:P11 ?wikidata .
    SERVICE <https://query.wikidata.org/sparql> {  
       ?wikidata wdt:P31 [] .
      MINUS {?article schema:about ?wikidata ;schema:isPartOf <https://en.wikipedia.org/> ;schema:inLanguage "en" .}
    }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
</sparql>
</sparql>