Re: Processing RDF in XML/XSLT workflows

Hi Johan,

Have you considered XSPARQL [1]?



----- Original Message -----
From: <>
To: <>
Sent: Sun Apr 25 23:11:30 2010
Subject: Processing RDF in XML/XSLT workflows


When publishing content, XSLT is a key technology.
RDF however is kind of difficult to process with XSLT.
Though there is an RDF/XML serialization, that standard allows for a variety
of ways to express the same things.

The notes below propose a restricted version of RDF/XML and some usage
The objective is to make RDF easily processable by XSLT.

I am interested in any alternative.
SPARQL result xml is not a full solution because it is limited to ASK and
SELECT queries.
Hence the attached proposal.

Just like canonical XML, I think this restricted RDF/XML format may be of
interest as a reference in XML processing.
Please let me know if others are interested to discuss this.

Graph representation proposal (restricted RDF/XML usage)
- the result is a list of resources which have properties.
- the id of a resource is an IRI or a CURIE
- all blank nodes are nested within properties.

<rdf:RDF {namespace}* > -- the namespaces are the ones used in
CURIES/element names
   <rdf:Description rdf:about="{subject-uri}">
     <rdf:type rdf:resource="{class-uri}"/> *      
     (  -- plain literal with optional language
     <{data-property-curie} [ xml:lang="{lang-code}" ]> {...value...}
    or -- xml literal
     <{data-property-curie} rdf:parseType="rdf:XMLLiteral" {namespace}* > --
the namespaces are the ones used in xml-content
     or -- typed literal
     <{data-property-curie} rdf:datatype="{simple-XML-schema-data-type}">
    or  -- expanded blank node
     <{object-property-curie}  rdf:parseType="Resource">
    or -- any resource with a known URI
     <{object-property-curie} rdf:resource="{uri}"/>

Writing xslt extensions to process RDF on a node by node navigation basis:
 - connect to an RDF store and identify a graph
 - navigate through the graph by iterating all (or selected) properties of
one or more selected subject resources.
 - represent each triple of the iteration result so it is easily processed
by XSLT (with a unique representation). 
 - allow this property iteration to be nested such that object resource can
be visited recursively. 
Proposal for result representation (see above)

1) connecting to an RDF store + graph(s) for access

2) To get statements from this store and to merge the RDF into XML,
something like 
<xsl:variable name="rdfresult"
 namespaces="{alias uri}*" -- namespaces used in subjects and
 filter="{property-curie}*" -- empty filter or no filter => give
all properties

3) Process the result based on xml nodes (see next page) as follows
3.1) typical processing :
 <xsl:variable name="current-property" select="name()"/>
 . do other stuff 
3.2) recursive processing :
 <xsl:variable name="current-property" select="name()"/>
 <xsl:variable name="current-uri" select="@rdf:resource"/>
  . recursively process as from step 2 using $current-uri as
he (new) subject-uri ... 

Kind Regards,
   Johan De Smedt (CTO TenForce)
mobile: +32 477 475934

Received on Monday, 26 April 2010 01:37:44 UTC