RDF Twig in Action

Load the model:

  <xsl:variable name="model"
    select="rt:load('diagrams/bgraph.rdf')"/>

Grab a node:

  <xsl:variable name="A"
    select="rt:resource('http://uri/for/A')"/>

Turn the results into a tree:

  <xsl:variable name="tree" select="rt:twig($A)"/>

At this point, $tree contains an XML document that can be queried and transformed with XSLT like any other input document.