SELECT distinct (bif:subseq (?s, bif:strchr (?s, '#'))) WHERE { graph ?g { ?s ?p `2+2` . FILTER (! bif:isnull (bif:strchr (?s, '#') ) ) } };