Processing RDF in XML/XSLT workflows

Hi,

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
conventions.
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.

Notes:
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...}
</{data-property-curie}>	
    or -- xml literal
     <{data-property-curie} rdf:parseType="rdf:XMLLiteral" {namespace}* > --
the namespaces are the ones used in xml-content
	{...xml-content.} 
     </{data-property-curie}>*  
     or -- typed literal
     <{data-property-curie} rdf:datatype="{simple-XML-schema-data-type}">
	{...value...}
     </{data-property-curie}>*       
    or  -- expanded blank node
     <{object-property-curie}  rdf:parseType="Resource">
         <rdf:Description>
	 .  								 
         </rdf:Description>
     </{object-property-curie}>
    or -- any resource with a known URI
     <{object-property-curie} rdf:resource="{uri}"/>
     )*       
   </rdf:Description>*
</rdf:RDF>

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"
select="readrdf:for-each-property($subjects,$namespaces,$filter)"/>
Where:
	namespaces="{alias uri}*"	-- namespaces used in subjects and
filter
	subjects="{subject-uri}+"
	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:for-each
select="$rdfresult/rdf:RDF/rdf:Description[@rdf:about='{subject-uri}']/*..."
>
	<xsl:variable name="current-property" select="name()"/>
	. do other stuff 
</xsl:for-each>
3.2) recursive processing :
<xsl:for-each
select="$rdfresult/rdf:RDF/rdf:Description[@rdf:about='{subject-uri}']/*[@rd
f:resource]">
	<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 ... 
</xsl:for-each>

Kind Regards,
   Johan De Smedt (CTO TenForce)
=======================
mail: johan.de-smedt@tenforce.com
mobile: +32 477 475934

Received on Sunday, 25 April 2010 22:12:10 UTC