Dieser Ausdruck erstellt eine neue Liste, indem alle doppelten Einträge aus einer vorhandenen Liste entfernt werden.
Falls ein Eintrag in der ursprünglichen Liste mehrfach enthalten ist, wird nur die erste Instanz beibehalten. Die Reihenfolge der Einträge bleibt ansonsten erhalten.
<?xml version="1.0" encoding="UTF-8"?> <RuleSet name="Example_removeduplicates" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://www.curamsoftware.com/CreoleRulesSchema.xsd"> <Class name="Person"> <!-- The list of relationships where this person is the "fromPerson". --> <Attribute name="relationships"> <type> <javaclass name="List"> <ruleclass name="Relationship"/> </javaclass> </type> <derivation> <specified/> </derivation> </Attribute> <!-- The people who are related to this person. Any relative appears in this list only once, even though one person can be related to another in more than one way, e.g. my grandparent can also be my legal guardian.--> <Attribute name="uniqueRelatives"> <type> <javaclass name="List"> <ruleclass name="Person"/> </javaclass> </type> <derivation> <removeduplicates> <reference attribute="allRelatives"/> </removeduplicates> </derivation> </Attribute> <Attribute name="allRelatives"> <type> <javaclass name="List"> <ruleclass name="Person"/> </javaclass> </type> <derivation> <!-- get the relatives of this person by forming a list of the "toPerson" on the other end of each relationship. --> <dynamiclist> <list> <reference attribute="relationships"/> </list> <listitemexpression> <reference attribute="toPerson"> <current/> </reference> </listitemexpression> </dynamiclist> </derivation> </Attribute> </Class> <!-- A relationship from one person to another. --> <Class name="Relationship"> <Attribute name="fromPerson"> <type> <ruleclass name="Person"/> </type> <derivation> <specified/> </derivation> </Attribute> <Attribute name="relationshipType"> <type> <javaclass name="String"/> </type> <derivation> <specified/> </derivation> </Attribute> <Attribute name="toPerson"> <type> <ruleclass name="Person"/> </type> <derivation> <specified/> </derivation> </Attribute> </Class> </RuleSet>