What is the {galaxy} with the {MIN(apparent magnitude)} whose {discoverer or inventor} is {William Herschel}  ?
What galaxy, discovered by William Herschel, has the less apparent magnitude?
Give the name of galaxy with less apparent magnitude and was discovered by William Herschel?
SELECT ?e WHERE { ?e rdf:type ontology:galaxy . ?e property:apparent_magnitude ?m . ?e property:discoverer_or_inventor resource:William_Herschel }
select ?ent where {
?ent <http://www.wikidata.org/entity/P31> <http://wikidata.dbpedia.org/resource/Q318>.

?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?ent .
?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P1215>.
?statement1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj1.

?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> ?ent .
?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P61> .
?statement2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q14277> .

}
ORDER BY ASC(?obj1)
LIMIT 5
select ?ent where { ?ent wdt:P31 wd:Q318 . ?ent wdt:P1215 ?obj . ?ent wdt:P61 wd:Q14277} ORDER BY ASC(?obj)LIMIT 5 
NGC 2167 NGC 4517 NGC 6284 NGC 4517 NGC 6664