query-9def3485598ae2a00b5a82aef0d5cee4
Propertiesmain subject (P921)taxon rank (P105)taxon name (P225)title (P1476)
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
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 ?Taxon ?TaxonName ?SampleWork ?SampleTitle ?WorkCount
WITH {
SELECT ?work WHERE {
hint:Query hint:optimizer "None".
{ SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Search";
wikibase:endpoint "www.wikidata.org";
mwapi:srsearch ""hypothesis" haswbstatement:P31=Q13442814 haswbstatement:P6104=Q56241615".
?page_title wikibase:apiOutput mwapi:title.
}
}
UNION
{ SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Search";
wikibase:endpoint "www.wikidata.org";
mwapi:srsearch "impact haswbstatement:P31=Q13442814 haswbstatement:P6104=Q56241615".
?page_title wikibase:apiOutput mwapi:title.
}
} BIND(IRI(CONCAT(STR(wd:), ?page_title)) AS ?work)
}
}
AS %works
WITH {
SELECT ?Taxon ?TaxonName (SAMPLE(?work) AS ?SampleWork) (COUNT(?work) AS ?WorkCount) WHERE {
INCLUDE %works
?work wdt:P921 ?Taxon .
?Taxon wdt:P105 wd:Q7432 .
?Taxon wdt:P225 ?TaxonName .
}
GROUP BY ?Taxon ?TaxonName ?SampleWork ?WorkCount
}
AS %taxa
WHERE {
INCLUDE %works
INCLUDE %taxa
?SampleWork wdt:P1476 ?SampleTitle .
}
GROUP BY ?Taxon ?TaxonName ?SampleWork ?SampleTitle ?WorkCount
ORDER BY DESC(?WorkCount)