Index

Example: Combine results from two predicate lists

In this example, we get all of the favorite animals of both Sarah and Robert. Remember that only RDF sequences are ordered so we shouldn't rely on the results being returned in any specific order. In the example, two values will be stored in the 'human' variable in the member part of the condition. The first triple will therefore generate the favorite animals of both of them.

View   View Data Source

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