SPARQL Example

BASE <http://example.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX ex: <properties/1.0#>
SELECT DISTINCT $person ?name $age
FROM <http://rdf.example.org/people.rdf>
WHERE {  $person a foaf:Person ;
                 foaf:name ?name.
         OPTIONAL { $person ex:age $age } .
         FILTER ! REGEX(?name, "Bob")
       }
LIMIT 3 ORDER BY ASC[?name]