use case fodder for xml output - mozilla templates (svg generator)

(Feel free to ignore if this is out of order 'cos I'm looking at 
pre-pub docs.)

The Mozilla browser ships with an RDF query system, called XUL
Templates. The basic idea is much the same scope as most other basic RDF
QLs (SQuish/RDFdb/RDQL/etc); the interesting part is that they use it as 
part of a templating system, to generate XML of various kinds (HTML,
XUL, SVG, ...).

I just found an SVG-generating example on the Mozilla website, and
confirmed that it runs in the SVG-enabled build of Mozilla. If the WG
are thinking of use cases for things like 'construct' (in the BRQL
pre-strawman[1]) or full XML generation (in [2]) I'd encourage folk to 
take a look at this. The use case isn't very real world (it generates
SVG from querying an RDF graph that contains SVG fragments) but it is
real and runs clientside in browser. There's more b/g on XUL Templates
around [3]. I also note that DAWG is getting noticed in the XUL Template
world, eg. recently in http://www.xulplanet.com/ndeakin/archive/2004/8/27/
	
	There's been some discussion lately about how to improve XUL templates.
	I just added some comments about this.

	Some proposals include using an SQL-like language which generates
	results. This is suitable for database-backed data, and a query language
	for RDF is being developed. Others talk about using XSLT since it's
	already an established template language, although it would only work
	using XML. Another option is to simply improve upon the existing
	template system by adding support for conditions, better scripting, and
	so forth.

Anyway the SVG-generating example that prompted this message can be 
found at http://www.croczilla.com/svg/samples/ (last item in page), ie.
http://www.croczilla.com/svg/samples/xulsvg1/xulsvg1.xul

This consumes RDF from a linked file, 
http://www.croczilla.com/svg/samples/xulsvg1/xulsvg1.rdf

I'll include it here for reference. To my mind, it shows that there's
merit in the XML for resultsets work, since it should be easy to write
XSLT to emit SVG. Perhaps the 'construct' clause in the QL itself can be
thought of as a optimised common case of this sort of more general XML
generation mechanism? Also worth noting that XUL Templates have a
special case construct for container membership. I think that might be
becvause their design pre-dates our addition of rdfs:member into RDFS
(ie. a superproperty of the _1 _2 etc properties). However we now have
rdf:List so XUL Templates might still be a motivator for that kind of
functionality.

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:svg="http://www.w3.org/2000/svg">
  <svg:svg datasources="xulsvg1.rdf" ref="urn:root">
    <template>
      <rule>
        <conditions>
          <content uri="?root"/>
          <triple subject="?root"
                  predicate="urn:croczilla:xulsvg1:shapes"
                  object="?shapes"/>
          <member container="?shapes" child="?shape"/>

          <triple subject="?shape"
                  predicate="urn:croczilla:xulsvg1:xform"
                  object="?xform"/>
          <triple subject="?shape"
                  predicate="urn:croczilla:xulsvg1:fill"
                  object="?fill"/>
        </conditions>
        <action>
          <svg:polygon uri="?shape" 
                       fill="?fill" 
                       transform="?xform" 
                       fill-opacity=".5"
                       points="100,100 200,100 150,200"/>
       </action>
     </rule>
   </template>
 </svg:svg>

</window>


Hope this is of interest,

cheers,

Dan


[1] http://www.w3.org/2001/sw/DataAccess/rq23/#construct
[2] http://lists.w3.org/Archives/Public/www-archive/2004Sep/att-0013/_RDF-XML.html
   "Making RDF Data Available for XML processing"
[3] http://www.mozilla.org/rdf/doc/

Received on Thursday, 9 September 2004 06:42:59 UTC