graphthinking
RDF Transformations
Felix Ostrowski (graphthinking, @literarymachine)
(Virtual) Lightning Talk
ELAG, June 13th 2014, University of Bath
graphthinking
Using XSLT to process RDF(/XML)?
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="file:///home/fo/tmp/griffins.ttl#">
<foaf:Person rdf:about="file:///home/fo/tmp/griffins.ttl#peter"
foaf:familyName="Griffin" foaf:givenName="Peter">
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#brian"/>
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#chris"/>
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#lois"/>
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#megan"/>
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#stewie"/>
</foaf:Person>
</rdf:RDF>
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="file:///home/fo/tmp/griffins.ttl#">
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
</rdf:Description>
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<foaf:givenName>Peter</foaf:givenName>
</rdf:Description>
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<foaf:familyName>Griffin</foaf:familyName>
</rdf:Description>
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#lois"/>
</rdf:Description>
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#megan"/>
</rdf:Description>
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#chris"/>
</rdf:Description>
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#stewie"/>
</rdf:Description>
<rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter">
<foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#brian"/>
</rdf:Description>
</rdf:RDF>
And anything inbetween...
graphthinking
xsl:template match="what?"
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="rdf:Description">
...
</xsl:template>
<xsl:template match="foaf:Person">
...
</xsl:template>
</xsl:stylesheet>
graphthinking
No, thank you!
(Too many syntactically different ways to express
the same graph in RDF/XML)
graphthinking
Idea: operate on the abstract graph model
graphthinking
http://demo.graphthinking.com/rdft/
graphthinking
graphthinking
Tada!
graphthinking
Question: does this make sense?

RDF Transformations

  • 1.
    graphthinking RDF Transformations Felix Ostrowski(graphthinking, @literarymachine) (Virtual) Lightning Talk ELAG, June 13th 2014, University of Bath
  • 2.
    graphthinking Using XSLT toprocess RDF(/XML)? <?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="file:///home/fo/tmp/griffins.ttl#"> <foaf:Person rdf:about="file:///home/fo/tmp/griffins.ttl#peter" foaf:familyName="Griffin" foaf:givenName="Peter"> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#brian"/> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#chris"/> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#lois"/> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#megan"/> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#stewie"/> </foaf:Person> </rdf:RDF> <?xml version="1.0" encoding="utf-8"?> <rdf:RDF xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="file:///home/fo/tmp/griffins.ttl#"> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/> </rdf:Description> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <foaf:givenName>Peter</foaf:givenName> </rdf:Description> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <foaf:familyName>Griffin</foaf:familyName> </rdf:Description> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#lois"/> </rdf:Description> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#megan"/> </rdf:Description> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#chris"/> </rdf:Description> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#stewie"/> </rdf:Description> <rdf:Description rdf:about="file:///home/fo/tmp/griffins.ttl#peter"> <foaf:knows rdf:resource="file:///home/fo/tmp/griffins.ttl#brian"/> </rdf:Description> </rdf:RDF> And anything inbetween...
  • 3.
    graphthinking xsl:template match="what?" <?xml version="1.0"encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="rdf:Description"> ... </xsl:template> <xsl:template match="foaf:Person"> ... </xsl:template> </xsl:stylesheet>
  • 4.
    graphthinking No, thank you! (Toomany syntactically different ways to express the same graph in RDF/XML)
  • 5.
    graphthinking Idea: operate onthe abstract graph model
  • 6.
  • 7.
  • 8.
  • 9.