Aggregate feeds are feeds of Aggregate Entries - entries that combine multiple related entries into a single entry. As an example, let's assume you have two feeds in your Atomserver, cars and drivers, with the following entries:
/cars/porsche.xml
<car make="Porsche" model="911"/>
/cars/neon.xml<car make="Dodge" model="Neon"/>
/drivers/dad.xml<driver name="dad">
<car id="/cars/porsche.xml"/>
<car id="/cars/neon.xml"/>
</driver>
/drivers/teen.xml<driver name="teen">
<car id="/cars/neon.xml"/>
</driver>
Aggregate
Feeds can be used to pull a feed of "cars with their drivers".
Aggregate feeds are constructed using categories, where a unique
category scheme defines
an aggregate category, and
each term
in that scheme defines an aggregate entriy. In our example, we
need to apply the appropriate categories to each of the entries:/cars/smith/porsche.xml (urn:car-driver)porsche
/cars/smith/neon.xml (urn:car-driver)neon
/drivers/smith/dad.xml (urn:car-driver)porsche (urn:car-driver)neon
/drivers/smith/teen.xml (urn:car-driver)neon
With those categories applied to the entries, there is an Aggregate Feed based on the scheme - urn:car-driver. The Workspace for all aggregate feeds is $join:
http://your.atomserver/$join/urn:car-driver
This feed would return one entry for each unique term in the urn:car-driver scheme, and the contents of each entry would be an <aggregate> element that contains the set of entry XMLs for the individual "real" entries with that category:
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:as="http://atomserver.org/namespaces/1.0/">There are several things to note about an Aggregate Feed:
<link href="/$join/urn:car-driver?max-results=15" rel="self"/>
<entry>
<id>/$join/urn:car-driver/porsche.xml</id>
<link href="/$join/urn:car-driver/porsche.xml" rel="self"/>
<content type="application/xml">
<aggregate xmlns="http://schemas.atomserver.org/atomserver/v1/rev0">
<entry xmlns="http://www.w3.org/2005/Atom">
<id>/cars/smith/porsche.xml</id>
<link href="/cars/smith/porsche.xml" rel="self"/>
<link href="/cars/smith/porsche.xml/1" rel="edit"/>
<content type="application/xml">
<car make="Porsche" model="911"/>
</content>
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
<id>/drivers/smith/dad.xml</id>
<link href="/drivers/smith/dad.xml" rel="self"/>
<link href="/drivers/smith/dad.xml/1" rel="edit"/>
<content type="application/xml">
<driver name="dad">
<car id="/cars/porsche.xml"/>
<car id="/cars/neon.xml"/>
</driver>
</content>
</entry>
</aggregate>
</content>
<entry>
<entry>
<id>/$join/urn:car-driver/neon.xml</id>
<link href="/$join/urn:car-driver/neon.xml" rel="self"/>
<content type="application/xml">
<aggregate xmlns="http://schemas.atomserver.org/atomserver/v1/rev0">
<entry xmlns="http://www.w3.org/2005/Atom">
<id>/cars/smith/neon.xml</id>
<link href="/cars/smith/neon.xml" rel="self"/>
<link href="/cars/smith/neon.xml/1" rel="edit"/>
<content type="application/xml">
<car make="Dodge" model="neon"/>
</content>
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
<id>/drivers/smith/dad.xml</id>
<link href="/drivers/smith/dad.xml" rel="self"/>
<link href="/drivers/smith/dad.xml/1" rel="edit"/>
<content type="application/xml">
<driver name="dad">
<car id="/cars/porsche.xml"/>
<car id="/cars/neon.xml"/>
</driver>
</content>
</entry>
<entry xmlns="http://www.w3.org/2005/Atom">
<id>/drivers/smith/teen.xml</id>
<link href="/drivers/smith/teen.xml" rel="self"/>
<link href="/drivers/smith/teen.xml/1" rel="edit"/>
<content type="application/xml">
<driver name="teen">
<car id="/cars/neon.xml"/>
</driver>
</content>
</entry>
</aggregate>
</content>
<entry>
</feed>
- The sequence number for an aggregate entry is the same as the number of its child with the highest sequence number - the result of this is that if ANY of the components of an aggregate change, the aggregate will be returned the next time the aggregate feed is pulled.
- The set of categories for an aggregate entry is the union of the categories on all its members.
- Aggregate feeds can also be subject to a category search : /$join/urn:car-driver/-/(urn:color)red would pull all the aggregate entries from our feed that have the (urn:color)red category.
- A localized aggregate feed can be specified in the same way as for normal feeds - like /$join/urn:car-driver?locale=en_US. A localized aggregate entry only exists if there is at least one of its components localized in the given locale. If there are no localized entries with an entry in the given locale for the components of an aggregate, then that aggregate is not returned in the feed.
- as:workspace - contains the workspace of the component entry
- as:collection - contains the collection of the component entry
- as:locale - contains the locale of the component entry (if any...)
AtomServer, Aggregate Feeds