Re: SYNTAX: RDF Syntax Telecon Friday

Jan Grant wrote:
> 
> [ XSLT translation RDF/XML to ntriples is the real subject here ]
[...]
> And now for something completely the same: an XSLT approach to ntriples
> generation- [aimed at the syntax mob really]
> 
> The difference between XSLT validation and spitting out of ntriples is
> that the latter is harder.

not in my experience.

> Principally (and I've just begun sketching
> this) because we've a requirement to output approprately unique
> identifiers for anonymous nodes when producing RDF.

er... XSLT has generate-id() which works find for this, no?

> The problem with a
> single-step RDF/XML -> ntriples is that it needs to produce genids
> (effectively) for anonymous nodes as it goes; and since XSLT is
> completely applicative there seems to be no way to pass the small amount
> of state around needed to do that apart from the usual obfuscating
> tricks that Prolog, etc. would use to chain state-modifying operations
> together:
> 
>         some_operation(Params, State_in, State_out) :-
>                 sub_operation(ParamSubset1, State_in, State'),
>                 sub_op_2(ParamSubset2, State', State_out).

I dunno why you're messing with state-modifying operations.

The "attribute grammar" approach seems to work just fine
in XSLT.

[I'm new to attribute grammars, so maybe I'm using the
term incorrectly.]

Regardless, I just revisited my old (2000/04) RDF parser in
XSLT, and it took me about 10 minutes to add n-triples support
for it. I've only tested it lightly, but you're
welcome to take a look:

  http://www.w3.org/XML/2000/04rdf-parse/rdfp.xsl
  $Id: rdfp.xsl,v 1.7 2001/10/02 17:36:49 connolly Exp $

  (nodes/doc: http://www.w3.org/XML/2000/04rdf-parse/)


> I've just begun hacking around with an intermediate form ...

looks like overkill to me.


> The other problem I've got is that XSLT is strongly write-only. It _is_
> a W3C technology, but it's a royal PITA to come back to it after, I
> dunno, 5 minutes and try to figure out what you were up to :-(

chuckle.

And, at the end of the day, XSLT is turing-complete. So
an RDF/XML->RDF/n-triples mapping in XSLT is just another
program. If we were particularly confident, we could go
so far as to call it a reference implementation. I'm not
sure we'll get that far.

As a sample implementation, it might be worth persuing.
But as you say, it's not exactly the easiest thing
to read at a glance.

I sure like the RELAX-NG specification of RDF;
 
http://lists.w3.org/Archives/Public/www-rdf-comments/2001JulSep/0238.html

I took a look at doing an n-triples generator based
on relaxngcc
  http://homepage2.nifty.com/okajima/relaxngcc/index_en.htm
but it's built on a bunch of other
tools that I'm unable to install just now.


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/

Received on Tuesday, 2 October 2001 13:43:53 UTC