suggested minus tests

Hi,

I've been working on an implementation of MINUS recently, and found
the existing SPARQL tests did not cover a number of cases. I'd like to
suggest the following tests: full-minuend, part-minuend. (files
included below)

These two queries cover a number of conditions each. Alternatively,
each case tested in these queries could be pulled out individually.

Regards,
Paul Gearon


full-minuend.ttl

@prefix :        <http://example/> .

:a0 :p1 :b0 ;
    :p2 :c0 .
:a1 :p1 :b1 ;
    :p2 :c1 .
:a2 :p1 :b2 ;
    :p2 :c2 .
:a3 :p1 :b3 ;
    :p2 :c3 .
:d0 a :Sub .
:d1 a :Sub ;
    :q1 :b1 ;
    :q2 :c1 .
:d2 a :Sub ;
    :q1 :b2 .
:d3 a :Sub ;
    :q1 :b3 ;
    :q2 :cx .


full-minuend.rq

prefix : <http://example/>
select ?a ?b ?c {
  ?a :p1 ?b; :p2 ?c
  MINUS {
    ?d a :Sub
    OPTIONAL { ?d :q1 ?b }
    OPTIONAL { ?d :q2 ?c }
  }
}
order by ?a


full-minuend.srx

<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
  <head>
    <variable name="a"/>
    <variable name="b"/>
    <variable name="c"/>
  </head>
  <results>
    <result>
      <binding name="a">
        <uri>http://example/a0</uri>
      </binding>
      <binding name="b">
        <uri>http://example/b0</uri>
      </binding>
      <binding name="c">
        <uri>http://example/c0</uri>
      </binding>
    </result>
    <result>
      <binding name="a">
        <uri>http://example/a3</uri>
      </binding>
      <binding name="b">
        <uri>http://example/b3</uri>
      </binding>
      <binding name="c">
        <uri>http://example/c3</uri>
      </binding>
    </result>
  </results>
</sparql>


part-minuend.ttl

@prefix :        <http://example/> .

:a1 a :Min ;
    :p1 :b1 .
:a2 a :Min ;
    :p1 :b2 .
:a3 a :Min ;
    :p1 :b3 .
:a4 a :Min .
:d1 a :Sub ;
    :q1 :b1 .
:d3 a :Sub ;
    :q1 :b3 ;
    :q2 :c3 .
:d4 a :Sub ;
    :q1 :b4 ;
    :q2 :c4 .
:d5 a :Sub .


part-minuend.rq

prefix : <http://example/>
select ?a ?b ?c {
  ?a a :Min
  OPTIONAL { ?a :p1 ?b }
  OPTIONAL { ?a :p2 ?c }
  MINUS {
    ?d a :Sub
    OPTIONAL { ?d :q1 ?b }
    OPTIONAL { ?d :q2 ?c }
  }
}
order by ?a


part-minuend.srx

<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
  <head>
    <variable name="a"/>
    <variable name="b"/>
    <variable name="c"/>
  </head>
  <results>
    <result>
      <binding name="a">
        <uri>http://example/a2</uri>
      </binding>
      <binding name="b">
        <uri>http://example/b2</uri>
      </binding>
    </result>
    <result>
      <binding name="a">
        <uri>http://example/a4</uri>
      </binding>
    </result>
  </results>
</sparql>

Received on Wednesday, 20 June 2012 23:49:42 UTC