rdf variable binding xml format

Just before this WG started up, I spent a bit of time one afternoon
sketching out an XML vocabulary for representing the variable binding
results of RDF queries. I mentioned this vocabulary in Bristol and
took an action item to make some of it public.

I'm including in this message a DTD, a compact RELAX schema, and a bit
of (probably full of errors) instance data. One thing I'd probably do
different -- especially now that I'm working on a protocol document --
is, instead of allowing multiple binding-sets per instance, I'd put
multiple sets of bindings into a multipart HTTP response message. (In
that case, I'd drop the binding-set container element altogether.)

(I make no claims about the consistence of these artifacts, since I
haven't worked on them since sometime in January.)

Anyway, I claim that this message discharges ACTION KendallC: put xml
format up somewhere public, mail a pointer.

Kendall Clark
--
First, the DTD:

<?xml version="1.0" encoding="UTF-8"?>

<!-- ============================================================= -->
<!--              rvb: Rdf Query Result Set Variable Bindings      -->
<!-- ============================================================= -->

<!--                    Rdf Query Variable Bindings                -->
<!ELEMENT  rvb          (binding-set*)                               >

<!--         xmlns      rvb's namespace                            -->
<!ATTLIST  rvb
             xmlns      CDATA                           #REQUIRED    >

<!--                    binding-set                                -->
<!--                    a container holding variable bindings      -->
<!ELEMENT  binding-set  (binding*)                                   >

<!--                    binding                                    -->
<!--                    a binding consists of one var and 
                        one value                                  -->
<!ELEMENT  binding      (var, value)                                 >

<!--                    variable                                   -->
<!ELEMENT  var          (#PCDATA)                                    >

<!--                    value                                      -->
<!--                    the value part of a variable binding       -->
<!ELEMENT  value        (#PCDATA)                                    >

<!--                    xml:lang                                   -->
<!ATTLIST  value
             xml:lang   CDATA                          	#IMPLIED     >

<!--                    datatype                                   -->
<!ATTLIST  value
             datatype   CDATA                           #IMPLIED     >

If you prefer RNC:

# =============================================================

# rvb: Rdf Query Result Set Variable Bindings

# =============================================================

# Rdf Query Variable Bindings

rvb = element rvb { attlist.rvb, binding-set* }
# xmlns      rvb's namespace
attlist.rvb &= empty
# binding-set

# a container holding variable bindings
binding-set = element binding-set { attlist.binding-set, binding* }
attlist.binding-set &= empty
# binding

# a binding consists of one var and 
# one value
binding = element binding { attlist.binding, variable, value }
attlist.binding &= empty
# variable
variable = element variable { attlist.variable, text }
attlist.variable &= empty
# value

# the value part of a variable binding
value = element value { attlist.value, text }
# xml:lang
attlist.value &= attribute xml:lang { text }?
# datatype
attlist.value &= attribute datatype { text }?

Now, some instance data:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rvb SYSTEM "file:/Users/k/Documents/rvb.dtd">

<!--

This query --
 
SELECT ?mbox
WHERE
  (?x foaf:name "John Smith")
  (?x foaf:mbox ?mbox)
USING
  foaf  FOR <http://xmlns.com/foaf/0.1/>

executed against this graph --

@prefix foaf:  <http://xmlns.com/foaf/0.1/> .

[]
     foaf:name   "John Smith" ;
     foaf:mbox   <mailto:jsmith@example.com> .
     foaf:mbox   <mailto:J_smith@pobox.com> .
         
would result in an RVB instance like the following...
 -->

<rvb xmlns="http://www.w3.org/2001/sw/DataAccess/rvb/">
    <binding-set>
        <binding>    
            <var>?mbox</var>
            <value>mailto:jsmith@example.com</value>
        </binding>
        <binding>
            <var>?mbox</var>
            <value>mailto:j_smith@pobox.com</value>
        </binding>
    </binding-set>
</rvb>

<!--

This query --
 
SELECT ?mbox, ?friend
WHERE
  (?x foaf:name "John Smith")
  (?x foaf:mbox ?mbox)
  (?x foaf:knows ?friend)
USING
  foaf  FOR <http://xmlns.com/foaf/0.1/>

executed against this graph --

@prefix foaf:  <http://xmlns.com/foaf/0.1/> .

[]
     foaf:name   "John Smith"^^xsd:string ;
     foaf:mbox   <mailto:jsmith@example.com> ;
     foaf:mbox   <mailto:J_smith@pobox.com> ;
     foaf:knows  <mailto:danbri@w3.org> ;
     foaf:knows  "Kendall Clark"^^xsd:string .
would result in an RVB instance like the following...
 -->
     
<rvb xmlns="http://www.w3.org/2001/sw/DataAccess/rvb/">
    <binding-set>
        <binding>    
            <var>?mbox</var>
            <value>mailto:jsmith@example.com</value>
        </binding>
        <binding>
            <var>?mbox</var>
            <value>mailto:j_smith@pobox.com</value>
        </binding>
        <binding>
            <var>?friend</var>
            <value>mailto:danbri@w3.org</value>
        </binding>
        <binding>
            <var>?friend</var>
            <value datatype="xsd:string">Kendall Clark</value>
        </binding>
    </binding-set>
</rvb>

Received on Tuesday, 28 September 2004 13:54:19 UTC