PREFIX  rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX  foaf:   <http://xmlns.com/foaf/0.1/> 

SELECT ?person ?otherPerson 
WHERE 
{
    ?person rdf:type  foaf:Person .
    ?person foaf:knows{2,4} ?otherPerson .
}
