0

I have a query returning a couple of variable, ?a and ?b. The problem is that the results contain, for instance, 10, 15, and 15, 10. I need only one of these. How can I check if the tuple already exists?

My query is messy but looks like below:

SELECT DISTINCT ?a  ?b
WHERE { ?a   rno:is_extent_of  ?x1
          ;  rno:is_extent_of  ?x2
      . ?b   rno:is_extent_of  ?x3
          ;  rno:is_extent_of  ?x4
      . ?x1  rno:is_part_of    ?d
      . ?x3  rno:is_part_of    ?d
      . ?d   a                 rno:detailed_partition
      . ?x2  rno:is_part_of    ?r
      . ?x4  rno:is_part_of    ?r
      . ?r   a                 rno:Roundabout
      .  FILTER ( ?x1 != ?x2 
               && ?x1 != ?x3
               && ?x1 != ?x4 )
      }
TallTed
  • 9,069
  • 2
  • 22
  • 37
msc87
  • 943
  • 3
  • 17
  • 39

1 Answers1

2

Use some feature of ?a annd ?b to order them. For example, if they are always URIs:

FILTER ( str(?a)  < str(?b) )
AndyS
  • 16,345
  • 17
  • 21