Index

Example: Retrieve one grandchild for each child

This example only displays one animal from each animal class. We use two member tags to go to the children and then to the grandchildren. The triple is used to bind the animal's name to the ?name variable. However, in the action, the uri attribute is bound to the ?animalclass variable which will cause the template builder to iterate over the classes instead of each animal. The additional ?animal and ?name variables will not be iterated over, but they will contain the first result.

View   View Data Source

<vbox datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/all-animals">
  <template>
    <rule>
      <conditions>
        <content uri="?uri"/>
        <member container="?uri" child="?animalclass"/>
        <member container="?animalclass" child="?animal"/>
        <triple subject="?animal"
                predicate="http://www.some-fictitious-zoo.com/rdf#name"
                object="?name"/>
      </conditions>
      <action>
        <label uri="?animalclass" value="?name"/>
      </action>
    </rule>
  </template>
</vbox>
Copyright © 1999 - 2005 XULPlanet.com