PREFIX foaf: PREFIX dct: PREFIX schema: PREFIX geo: CONSTRUCT { GRAPH ?graph { ?graph dct:title ?territoryDescription ; foaf:primaryTopic ?territory . ?territory a schema:City ; dct:title ?territoryDescription ; schema:name ?territoryDescription ; schema:identifier ?territoryID ; schema:containedInPlace ?region ; geo:lat ?latitude ; geo:long ?longitude . } } WHERE { ?territory_row <#territoryID> ?territoryID ; <#territoryDescription> ?territoryDescription ; <#regionID> ?regionID ; <#latitude> ?latitude ; <#longitude> ?longitude . BIND(uri(concat(str($base), "territories/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?territoryID), "/")) AS ?graph) BIND(uri(concat(str(?graph), "#this")) AS ?territory) BIND(uri(concat(str($base), "regions/", encode_for_uri(?regionID), "/#this")) AS ?region) }