Something like
SELECT ?item ?type ?typeLabel WHERE {
?type (a | wdt:P279) wd:Q12280. # Item's type is subclass of bridge
?item wdt:P31 ?type.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
order by ?item
In this specific case it seems that all instances have a more specific type but may have multiple types. So you may want to `SELECT DISTINCT ?item.
Correct query
SELECT DISTINCT ?item WHERE {
{ ?type wdt:P279 wd:Q12280. # Item's type is subclass of bridge
?item wdt:P31 ?type. }
UNION
{ ?item wdt:P31 wd:Q12280.} # item is an instance of bridge
}
DISTINCT required as entities may be instances of a bridge and one of its subclasses. Logically they all should be but apparently that's not how it's done in Wikidata.