PREFIX jext: SELECT DISTINCT ?x { [] ?p [] . ?p jext:localname ?x . # Sets ?x ## And these ... ?p jext:localname ?x . # Checks ?x # Checks again - different way { ?p jext:localname "p" } UNION { ?p jext:localname "label" } . }