query-3d4a882bd15f4f9fdee9eb450f7d657f
Species with only a single subspecies
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?speciesName (COUNT(?speciesName) AS ?countOfSpeciesName) (GROUP_CONCAT(?taxonName;SEPARATOR = ", ") AS ?taxonNames) WHERE {
?item wdt:P225 ?taxonName .
?item wdt:P105 wd:Q68947 . #subspecies
FILTER(REGEX(?taxonName, " subsp. "))
BIND(STRBEFORE(?taxonName, " subsp.") as ?speciesName)
}
GROUP BY ?speciesName
HAVING(?countOfSpeciesName = 1)
ORDER BY ASC(?countOfSpeciesName) ASC(?speciesName)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?countOfSpeciesName")
v4("?item")
v5("?speciesName"):::projected
v3("?taxonName"):::projected
v5("?taxonNames")
c5(["wd:Q68947"]):::iri
f0[["?countOfSpeciesName = '1^^xsd:integer'"]]
f0 --> v5
f1[["regex(?taxonName,' subsp. ')"]]
f1 --> v3
v4 --"wdt:P225"--> v3
v4 --"wdt:P105"--> c5
bind2[/"substring-before(?taxonName,' subsp.')"/]
v3 --o bind2
bind2 --as--o v5
bind5[/"count(?speciesName)"/]
v5 --o bind5
bind5 --as--o v5
bind6[/"?taxonName"/]
v3 --o bind6
bind6 --as--o v5