# Get names of people, together with the names of people they know. PREFIX foaf: SELECT ?name ?name2 WHERE (?person foaf:name ?name) [ (?person foaf:knows ?p2) (?p2 foaf:name ?name2) ]