PREFIX foaf: PREFIX ex: SELECT ?X ?A FROM WHERE { ?X a foaf:Person . ?X ex:age ?A . FILTER ( !(?A > ?X ) && (?A > 20) ) }