Re: variables as nodes? (re: XML Binding Format)

On Tue, Mar 22, 2005 at 03:06:06PM -0500, Bijan Parsia wrote:
> 
> On Mar 22, 2005, at 2:09 PM, Howard Katz wrote:
> 
> >Bijan,
> >Can you briefly explain why the attribute form is more "XML Schemable" 
> >than
> >the element form?
> 
> I'm no schema wonk (which is fine, btw :)), but looking at:
> 
>   <xs:element name="result">
>     <xs:complexType>
>       <xs:group minOccurs="0" maxOccurs="unbounded" ref="res:var"/>
>       <xs:attribute ref="xml:lang"/>
>     </xs:complexType>
>   </xs:element>
>   <xs:group name="var">
>     <xs:sequence>
>       <xs:any namespace="##targetNamespace" processContents="skip"/>
>     </xs:sequence>
>   </xs:group>
> 
> That processContents="skip" is a consequence of not having a fixed set 
> of names for the binding forms and that is unfortunate.

I think it comes down to, unlike RelaxNG,

var = element res:* {
     xmllang?, uriAttr?, datatypeAttr?, bnodeidAttr?, boundAttr?,
     literal
}

XML Schema can't have wildcard nodenames. I think this is why RDF/XML
is only describable with RelaxNG.

> I would prefer for the element children of resutls to be fixed and data 
> bindable. I would also like to use xsi:type to enforce schema 
> processing of their children.

Another argument for this is that it fits with the common idiom for
XSLT templates. I originally voted for a regular XML syntax that was
also usefully parsable as RDF. Failing that, I prefer to go all the
way to the XML side and do things in the most common idioms possible,
which I think is consistent with Yoshio's syntax.

> Heck. It'd be nice to be able to distinguish bindings with a node vs. a 
> literal content. If we can't distinguish by attribute value, then i'd 
> be in favor of things like nodeVar, literalVar, etc.
> 
> I do not yet intend this as a proposal. I hope to flesh it out a bit 
> more. Deadlines and illness have interceded a bit.
> 
> But even the little bit more schema processing seems worth it to me.
> 
> I did some experiments with kendall on Dave's example transform scripts 
> to HTML tables, and it doesn't complicate them significantly (to my 
> eye). Also, you can, in XQuery, use typecase (or whatever it's called) 
> which might have optimization and safety advantages.

Maybe it's not significant, but transformers that don't have a priori
knowledge of which variables to expect (say, an HTML presenter for
*any* results) will need to use

<!-- datatyped literals template -->
<xsl:template match="*/[type='datatype']">
  <html:th>?<xsl:value-of select="self::name()"/></html:th>

instead of

<!-- datatyped literals template -->
<xsl:template match="var/[type='datatype']">
  <html:th>?<xsl:value-of select="@name"/></html:th>

The former is not many more characters, but involves being further
into the tutorial and further from the shortcut syntaxes of XSLT.


PROPOSAL: that the XML Results Format change from
    <result>
      <x bnodeid="r2"/>
      <hpage uri="http://work.example.org/bob/"/>
      <name xml:lang="en">Bob</name>
      <mbox uri="mailto:bob@work"/>
      <age
      datatype="http://www.w3.org/2001/XMLSchema#integer">30</age> 
      <blurb bound="false"/>
      <friend bnodeid="r1"/>
   </result>
to
    <result>
      <bind name="x" bnodeid="r2"/>
      <bind name="hpage" uri="http://work.example.org/bob/"/>
      <bind name="name" xml:lang="en">Bob</bind>
      <bind name="mbox" uri="mailto:bob@work"/>
      <bind name="age"
      datatype="http://www.w3.org/2001/XMLSchema#integer">30</bind> 
      <bind name="blurb" bound="false"/>
      <bind name="friend" bnodeid="r1"/>
   </result>

I reallize it's extra bytes, but I think having XML Schema validation

  <xs:group name="var">
    <xs:complexType>
      <xs:attribute name="uri" type="res:URI-reference"/>
      <xs:attribute name="datatype" type="res:URI-reference"/>
      <xs:attribute name="bnodeid" type="xs:NMTOKEN"/>
      <xs:attribute name="bound">
    </xs:complexType>
  </xs:group>

all the way down is worth it.
-- 
-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:   +81.90.6533.3882

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

Received on Wednesday, 23 March 2005 12:37:50 UTC