W3C home > Mailing lists > Public > www-rdf-interest@w3.org > October 2003

RE: ANNOUNCEMENT: RDFStyles: alternative to XSLT for RDF

From: Leo Sauermann <leo@gnowsis.com>
Date: Tue, 21 Oct 2003 11:15:28 +0200
To: "'Reto Bachmann-Gmuer'" <reto@gmuer.ch>, <www-rdf-interest@w3.org>
Message-ID: <000101c397b3$ded97800$0501a8c0@ZION>

> Indeed, this is probably the most basic point: is it useful to have a
> special (or xml based) syntax for defining rdf styling or can this be
> done with pure rdf. I wanted to try out the second approach to better
> see what it could do. 

Ah, now I see. The idea of defining the RDFSTYLES language in RDF was
obvious, sorry I didn't get it. 
Sure you should use RDF as a syntax for RDFStyles, as you can embed
style & content in one RDF graph. Very elegant idea, gratulations.

I also like your mapping of java classnames that you defined in
jrdfstyles.rdf, I did a similiar thing in www.gnowsis.com.



But still I think it would be a good approach to "rebuilt" the existing
XSLT vocabulary and adapt it to the RDF topic. Many developers are used
to the principles behind XSLT, selection and "apply-templates" etc.
It would not be very hard to "restructure" the XSLT stuff and bring the
syntax into a RDF graph model.

So I identify two goals that may be good for RDFSTYLES:

1. Stick closely to the XSLT syntax, use the same words and similiar
structure. Make it that developers have a easy step to RDFSTYLES

2. Find a XPATH equivalent in RDF to select TRIPLES and PARTS OF TRIPLES
(Literals, Resources, Properties). With this RDF-XPATH you may have easy
going in selecting and ordering  triples and output of values. XSLT is
completely build on XPATH and this works very fine.

I just did a glance at XPath 2.0 and could not find anything about RDF
there, so it seems that a new syntax is needed. I will post a second
thread here if anybody knows a project in this direction

For the first point, I will  add some ideas here, for the second point
we will wait a little what the RDF-interest answers.

XSLT Ideas:

some ideas are very close to XSLT:

style:renderedType => could be <rslt:template
rslt:match="[rdf:type=rdfs:Literal]">
style:LiteralOutputAction => <rslt:output rslt:value-of="." />
stlye:TextAction => <rslt:Text><rslt:textvalue>Blabla and also
<xml></rslt:textvalue></rslt:Text>

with the rslt:Text thing, you may also use this RDF parsetype where the
engine ignores XML (äh, lookup this in the standard, forgotton what it
was called)


these things are obvious to me, but there is another thing:

your architecture is very property-focused and actions, I guess.

Perhaps shift it more to the XSLT idea of "writing the output document
and inserting the dynamic stuff like with placeholders"

In XSLT the whole stream is parsed and divided into <xsl:text> and
<xsl:...> things that are all in a stream, so the processor does "ah, a
text, output; a command, do it".

In RDF / XSLT this may be: 

<rslt:template rslt:match="<some resouce>">
 <rdf:Seq>
  <rdf:li>
   <rslt:Text><rslt:textvalue (ignoreXML)><h1></textvalue></rslt:Text>
  </rdf:li>
  <rdf:li>
   <rslt:Value rslt:match="(. rdfs:label ?)" /> <!-- this XPATH/RDF hack
should return the label, the "?" -->
  </rdf:li>
  <rdf:li>
   <rslt:Text><rslt:textvalue
(ignoreXML)></h1><TABLE></textvalue></rslt:Text>
  </rdf:li>
  <rdf:li>
   <rslt:ApplyTemplates rslt:select="(. http://purl.org/rss/1.0/items
?)" />
  </rdf:li>
  <rdf:li>
   <rslt:Text><rslt:textvalue
(ignoreXML)></h1></TABLE></textvalue></rslt:Text>
  </rdf:li>
 </rdf:Seq>
</rslt:template>

<!-- match all things that are called by applytemplates and have a type
of "rss:item" -->
<rslt:template rslt:match="(? rdf:type http://purl.org/rss/1.0/item)">
 <rdf:Seq>
  <rdf:li>
   <rslt:Text><rslt:textvalue
(ignoreXML)><tr><td></textvalue></rslt:Text>
  </rdf:li>
  <rdf:li>
   <rslt:Value rslt:match="(. rdfs:label ?)" /> <!-- this XPATH/RDF hack
should return the label, the "?" -->
  </rdf:li>
  <rdf:li>
   <rslt:Text><rslt:textvalue
(ignoreXML)></td></tr></textvalue></rslt:Text>
  </rdf:li>
 </rdf:Seq>
</rslt:template>
			


With this "near to XSLT" syntax, more people would see what it is about.

If we also could get rid of those pesky <rdf:Seq> and <rdf:Li> things
and instead write:

<rslt:template rslt:match="(? rdf:type http://purl.org/rss/1.0/item)">
   <rslt:Text><rslt:textvalue
(ignoreXML)><tr><td></textvalue></rslt:Text>
   <rslt:Value rslt:match="(. rdfs:label ?)" /> <!-- this XPATH/RDF hack
should return the label, the "?" -->
   <rslt:Text><rslt:textvalue
(ignoreXML)></td></tr></textvalue></rslt:Text>
</rslt:template>

It would be much simpler, but I think that most RDF parser do not
"garantuee" the correct order of the triples here, but you may write
your own parser anyway.


hope that is some inspiration for you,

greetings
Leo Sauermann
www.gnowsis.com
Received on Tuesday, 21 October 2003 05:11:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:52:02 GMT