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

SELECT ?person ?name 
WHERE 
{
    ?person rdf:type  foaf:Person .
    ?person foaf:knows{2}/foaf:name ?name .
}
