obsolete, a better doc exists elsewhere
XML Format for Parcels
Goals
Example #1
A parcel defines schema items for books and authors. Note that this parcel references both the core parcel, which defines Parcel, Kind, Attribute, String, etc. This parcel also references another parcel, "PeopleSchema", which we will assume defines a kind 'Person' and an attribute 'name'.
<Parcel itemName="BookSchema"
xmlns="//Schema/Core"
xmlns:people="//Parcels/OSAF/PeopleSchema"
xmlns:book="//Parcels/OSAF/BookSchema">
<displayName>Book Schema</displayName>
<version>0.3</version>
<author>Open Source Application Foundation</author>
<Enumeration itemName="BookCategories">
<values>Fiction</values>
<values>Travel</values>
<values>Cooking</values>
</Enumeration>
<Attribute itemName="isbn">
<displayName>ISBN</displayName>
<description>The ISBN number associated with a book</description>
<cardinality>single</single>
<type itemref="String"/>
<required/>
</Attribute>
<Attribute itemName="title">
<displayName>Book Title</displayName>
<description>The full title of a book</description>
<cardinality>single</cardinality>
<type itemref="String"/>
</Attribute>
<Attribute itemName="author">
<displayName>Book Author</displayName>
<cardinality>single</cardinality>
<type itemref="book:Author"/>
<description>The author of a book.</description>
<inverseAttribute itemref="book:authored"/>
</Attribute>
<Attribute itemName="authored">
<displayName>Authored</displayName>
<cardinality>list</cardinality>
<type itemref="book:Book"/>
<description>Books a given person has authored.</description>
<inverseAttribute itemref="book:author"/>
</Attribute>
<Attribute itemName="category">
<displayName>Authored</displayName>
<description>Book category</description>
<cardinality>single</cardinality>
<type itemref="book:BookCategory"/>
</Attribute>
<Kind itemName="Book">
<displayName>Book</displayName>
<description>A kind representing a book</description>
<attributes itemref="book:isbn"/>
<attributes itemref="book:title"/>
<attributes itemref="book:author"/>
<attributes itemref="book:category"/>
<classes key="python">OSAF.BookSchema.Book.Book</classes>
</Kind>
<Kind itemName="Author">
<displayName>Book Author</displayName>
<description>A kind representing the author of a book.</description>
<superKinds itemref="people:Person"/>
<attributes itemref="book:authored"/>
<displayAttribute itemref="people:name"/>
<classes key="python">OSAF.BookSchema.Author.Author</classes>
</Kind>
</Parcel>
Example #2
A second parcel creates book items, using the schema items from the first parcel. This parcel references the first parcel, the PeopleSchema parcel, and the core parcel.
<core:Parcel itemName="BookList"
xmlns="//Parcels/OSAF/BookSchema"
xmlns:core="//Schema/Core"
xmlns:people="//Parcels/OSAF/PeopleSchema"
xmlns:list="//Parcels/OSAF/BookList">
<Author itemName="YM">
<people:name>Yann Martel</people:name>
</Author>
<Book itemName="LP">
<title>Life of Pi</title>
<author itemref="list:YM"/>
<isbn>0-15-602732-1</isbn>
<category>Fiction</category>
</Book>
</core:Parcel>
Defining Items
Both parcels follow the pattern:
<kind_uri itemName="item_name">
<attribute_uri>attribute_value</attribute_uri>
<attribute_uri itemref="item_uri"/>
<kind_uri itemName="item_name">
<attribute_uri>attribute_value</attribute_uri>
</kind_uri>
</kind_uri>
- kind_uri: The uri (currently same as the itemPath) to identify the kind of the item that will be created.
- itemName = "item_name": The name given to the item that will be created in this parcel. The name will become part of the new item's uri.
- attribute_uri: The uri to identify an attribute that will decorate this item.
- attribute_value: The value of the attribute that will decorate this item.
- itemref="item_uri": The uri of an item that is the value of the attribute that decorates this item.
- All tags and xml attribute values that might be uris can make use of xml namespaces to build the uri. The namespace is the parent of the item being referred to. The parser combines the namespace and the tag using the '/' character. In other words, "core:String" becomes "//Schema/Core/String", if the parser has earlier seen xmlns:core="//Schema/Core".
- Nested kinds are the "itemChildren" of the enclosing kind. The enclosing kind is the "itemParent" of the nested kind.
Defining Schema Items
The first parcel primarily uses the kinds and attributes in the "//Schema/Core" parcel.
--
KatieCappsParlante - 08 Nov 2003