PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>  
PREFIX : <http://example.org/test#>

SELECT * 
WHERE { ?C rdfs:subClassOf _:b .
       FILTER( ?C != owl:Nothing ) 
       _:b a owl:Restriction ;
       owl:onProperty :hasChild ;
       owl:someValuesFrom owl:Thing .      
}
