test case results expressed in ResultSet terms

A while back, AndyS and some others settled on a scheme defining
ResultSets [1]. This seems like work we can use for expressing the
expected results for a given query.

RDF Query and Rules Framework [2] leans on this schema and I've
mostly* adopted this for the Algae tests. The Optional2 test [3],
which is already in the test cases, looks like this as a table:

+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+
|                        n|                        d|                        e|                        f|                        g|
|-------------------------|-------------------------|-------------------------|-------------------------|-------------------------|
| <http://example.org/n#A>|                     NULL|                     NULL|                     NULL|                     NULL|
|<http://example.org/n#A2>|                     NULL|                     NULL|                     NULL|                     NULL|
|<http://example.org/n#A3>|<http://example.org/n#D3>|<http://example.org/n#E3>|<http://example.org/n#F3>|                     NULL|
|<http://example.org/n#A4>|<http://example.org/n#D4>|<http://example.org/n#E4>|<http://example.org/n#F4>|<http://example.org/n#F4>|
+-------------------------+-------------------------+-------------------------+-------------------------+-------------------------+

and this as a ResultSet:

@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rs:     <http://jena.hpl.hp.com/2003/03/result-set#> .

[] rdf:type rs:ResultSet ;
    rs:resultVariable "n" ;
    rs:resultVariable "d" ;
    rs:resultVariable "e" ;
    rs:resultVariable "f" ;
    rs:resultVariable "g" ;
    rs:size "4" ;
    rs:solution
    rs:solution
        [ rdf:type rs:ResultSolution ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "n" ; rs:value <http://example.org/n#A> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "d" ; rs:nonValue "NULL" ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "e" ; rs:nonValue "NULL" ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "f" ; rs:nonValue "NULL" ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "g" ; rs:nonValue "NULL" ] 
        ] ;
    rs:solution
        [ rdf:type rs:ResultSolution ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "n" ; rs:value <http://example.org/n#A2> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "d" ; rs:nonValue "NULL" ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "e" ; rs:nonValue "NULL" ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "f" ; rs:nonValue "NULL" ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "g" ; rs:nonValue "NULL" ] 
        ] ;
    rs:solution
        [ rdf:type rs:ResultSolution ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "n" ; rs:value <http://example.org/n#A3> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "d" ; rs:value <http://example.org/n#D3> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "e" ; rs:value <http://example.org/n#E3> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "f" ; rs:value <http://example.org/n#F3> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "g" ; rs:nonValue "NULL" ] 
        ] ;
        [ rdf:type rs:ResultSolution ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "n" ; rs:value <http://example.org/n#A4> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "d" ; rs:value <http://example.org/n#D4> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "e" ; rs:value <http://example.org/n#E4> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "f" ; rs:value <http://example.org/n#F4> ] ;
          rs:binding [ rdf:type rs:ResultBinding ;
                       rs:variable "g" ; rs:value <http://example.org/n#F4> ] 
        ] .


* I've substituted rs:nonValue** "NULL" for rs:value rs:undef in
  order to distinguish the case where I got no bindings from the
  case where I got a binding to the resource rs:undef.

** In analogous presumption, I plan to introduce foaf:UnPerson
   without Danbri's consent.

[1] http://jena.hpl.hp.com/2003/03/result-set
[2] http://www.w3.org/2001/11/13-RDF-Query-Rules/terms
[3] http://dev.w3.org/cvsweb/perl/modules/W3C/Rdf/test/Optional2-alg.sh?rev=HEAD&content-type=text/x-cvsweb-markup
-- 
-eric

office: +81.466.49.1170 W3C, Keio Research Institute at SFC,
                        Shonan Fujisawa Campus, Keio University,
                        5322 Endo, Fujisawa, Kanagawa 252-8520
                        JAPAN
        +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA
cell:   +1.857.222.5741 (does not work in Asia)

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

Received on Saturday, 26 June 2004 00:24:10 UTC