Re: The XML Schema GRDDL Story

[+cc www-archive; I presume nobody minds.]

On Tue, 2004-12-07 at 17:06 -0600, Dan Connolly wrote:
> On Tue, 2004-12-07 at 16:52 -0500, Ben Adida wrote:
> [...]
> > How do we make this happen? What are the relevant specs that address 
> > this?
> 
> I think GRDDL is enough.
> 
> I'm working on an example based on the purchase order schema
> from the XML Schema primer.
>   http://www.w3.org/TR/xmlschema-0/#po1.xsd
> 
> I have a document
>   http://www.w3.org/2003/g/po-doc.xml
> and a schema
>   http://www.w3.org/2003/g/po-ex.xsd
> 
> and I finally remembered enough about XML Schema to get
> them to validate using xsv...
>   http://www.w3.org/2001/03/webdata/xsv
> 
> Now to write the XSLT bits...

OK, one XSLT deely to extract the embedded RDF from
the schema that expresses the "namespaceTransformation" relationship:

  http://www.w3.org/2003/g/embeddedRDF.xsl

and one to transform purchase order documents:
  http://www.w3.org/2003/g/grokPO.xsl

et viola...

$ python glean.py --output ,docg.rdf 'http://www.w3.org/2003/g/po-doc'
$ python ~/w3ccvs/WWW/2000/10/swap/cwm.py --rdf ,docg.rdf --n3
#Processed by Id: cwm.py,v 1.164 2004/10/28 17:41:59 timbl Exp
     @prefix : <http://www.w3.org/2003/g/po-ex#> .

      [      a :purchaseOrder;
             :billTo  [
                 :city "Old Town";
                 :name "Robert Smith";
                 :state "PA";
                 :street "8 Oak Avenue";
                 :zip "95819" ];
             :comment "Hurry, my lawn is going wild";
             :orderDate "1999-10-20";
             :shipTo  [
                 :city "Mill Valley";
                 :name "Alice Smith";
                 :state "CA";
                 :street "123 Maple Street";
                 :zip "90952" ] ].

#ENDS


with the --debug output on glean.py, we can see how the sausage
is made... well, sorta:


$ python glean.py --debug --output ,docg.rdf
'http://www.w3.org/2003/g/po-doc'
grddl(('http://www.w3.org/2003/g/po-doc', None,
['http://www.w3.org/2003/g/data-view', 'http://www.w3.org/1999/xhtml']))
grddl(('http://www.w3.org/2003/g/po-doc', '/tmp/grddl-xformsQumE_i.txt',
['http://www.w3.org/2003/g/data-view', 'http://www.w3.org/1999/xhtml']))
SPAWN: xsltproc --novalid -o /tmp/grddl-xformsLkCrZH.txt --stringparam
xmlfile http://www.w3.org/2003/g/po-doc
getTransforms.xsl /tmp/grddl-xformsQumE_i.txt
getTransforms line:R http://www.w3.org/2003/g/po-ex
PROFILE: http://www.w3.org/2003/g/po-ex
grddl(('http://www.w3.org/2003/g/po-ex', None,
['http://www.w3.org/2003/g/data-view', 'http://www.w3.org/1999/xhtml',
'http://www.w3.org/2003/g/po-ex']))
grddl(('http://www.w3.org/2003/g/po-ex', '/tmp/grddl-xformswFKkLF.txt',
['http://www.w3.org/2003/g/data-view', 'http://www.w3.org/1999/xhtml',
'http://www.w3.org/2003/g/po-ex']))
SPAWN: xsltproc --novalid -o /tmp/grddl-xformskMjJuq.txt --stringparam
xmlfile http://www.w3.org/2003/g/po-ex
getTransforms.xsl /tmp/grddl-xformswFKkLF.txt
getTransforms line:R http://www.w3.org/2001/XMLSchema
getTransforms line:T http://www.w3.org/2003/g/embeddedRDF.xsl
PROFILE: http://www.w3.org/2001/XMLSchema
grddl(('http://www.w3.org/2001/XMLSchema', None,
['http://www.w3.org/2003/g/data-view', 'http://www.w3.org/1999/xhtml',
'http://www.w3.org/2003/g/po-ex', 'http://www.w3.org/2001/XMLSchema']))
grddl(('http://www.w3.org/2001/XMLSchema',
'/tmp/grddl-xformstMjzqL.txt', ['http://www.w3.org/2003/g/data-view',
'http://www.w3.org/1999/xhtml', 'http://www.w3.org/2003/g/po-ex',
'http://www.w3.org/2001/XMLSchema']))
SPAWN: xsltproc --novalid -o /tmp/grddl-xformsbdUyxk.txt --stringparam
xmlfile http://www.w3.org/2001/XMLSchema
getTransforms.xsl /tmp/grddl-xformstMjzqL.txt
getTransforms line:R http://www.w3.org/1999/xhtml
SPAWN: xsltproc --novalid -o /tmp/grddl-statementsERboAj.rdf
--stringparam xmlfile http://www.w3.org/2003/g/po-ex
http://www.w3.org/2003/g/embeddedRDF.xsl /tmp/grddl-xformswFKkLF.txt
data size:1
NAMESPACE XFORM: http://www.w3.org/2003/g/grokPO.xsl
SPAWN: xsltproc --novalid -o /tmp/grddl-statementspYJDWT.rdf
--stringparam xmlfile http://www.w3.org/2003/g/po-doc
http://www.w3.org/2003/g/grokPO.xsl /tmp/grddl-xformsQumE_i.txt
data size:15
GRDDL size:15


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E

Received on Tuesday, 7 December 2004 23:41:05 UTC