logo  AtomServer, Aggregate Feeds

Chris Berry, Bryon Jacob. Updated 08/15/08

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/">
    <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>
There are several things to note about an Aggregate Feed:
Aggregate feeds define three new elements that occur in the component entries inside an <aggregate> element. : These, along with as:entryId that is present in Atomserver entries anyway, allow for consumers of Aggregate feeds to easily programmatically determine what kind of entry each component of an aggregate is.