Index

Example: Match items with a certain parent

Here we want to determine which of Robert's favorite animals are reptiles. There are several ways to do this. In this case, we first get the list of favorite animals, then use a <member> tag to go up to the parent reptile node. We will need to compare to the reptile's name to filter out the non-reptiles since the <member> tag can only use variables.

View   View Data Source

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