Collection items

March 8th, 2006 by Andi Vajda

A collection item is an item that wraps an abstract set of items or bi-directional item references.


A collection item is said to wrap a set of items because it delegates
the API of that set value. All methods defined on this value’s implementation
class that aren’t also defined on the collection item’s implementation class
are available directly on the collection item.

The collection item’s set value is stored in an attribute whose name is
declared on its implementation class via the __collection__
attribute. That attribute is declared like any other on the collection
item’s kind or via Chandler’s href="http://chandler.osafoundation.org/docs/0.6/parcel-schema-guide.html">schema
API.

The collection item’s implementation class must at least be a subclass of
the repository’s Collection class and must be setup with the
CollectionClass metaclass.
When the set of items is intended to be an href="http://blogs.osafoundation.org/chandlerdb/2005/07/abstract_sets_o.html">abstract
set it must be initialized in the collection item’s
implementation class’ constructor.
For example, using the href="http://chandler.osafoundation.org/docs/0.6/parcel-schema-guide.html">schema
API:

  • Defining a collection item class wrapping a simple bi-directional item reference collection.
    from repository.item.Collection import Collection
    from application import schema
    
    class GreenCollection(Collection):
      __metaclass__ = schema.CollectionClass
      __collection__ = 'bunch'
    
      # declare a collection attribute of bi-refs of cardinality 'list'
      bunch = schema.Sequence(otherName='collections', initialValue=[])
      ...
    
  • Defining a collection item class wrapping an abstract union set.
    from repository.item.Collection import Collection
    from repository.item.Sets import Union
    from application import schema
    
    class BlueCollection(Collection):
      __metaclass__ = schema.CollectionClass
      __collection__ = 'plastic'
    
      # declare a simple abstract set of items attribute
      plastic = schema.One(schema.TypeReference('//Schema/Core/AbstractSet'))
    
      # in this example, a and b are collection items
      def __init__(self, a, b, *args, **kwds):
          super(BlueCollection, self).__init__(*args, **kwds)
          self.plastic = Union((a, a.__collection__), (b, b.__collection__))
      ...
    
  • Defining a collection item wrapping class an abstract intersection set of
    bi-directional item references.

    from repository.item.Collection import Collection
    from repository.item.Sets import Intersection
    from application import schema
    
    class RedCollection(Collection):
      __metaclass__ = schema.CollectionClass
      __collection__ = 'paper'
    
      # declare a collection attribute of bi-refs of cardinality 'set'
      paper = schema.Many(otherName='inPaper')
    
      # in this example, a and b are collection items
      def __init__(self, a, b, *args, **kwds):
          super(RefCollection, self).__init__(*args, **kwds)
          self.paper = Intersection((a, a.__collection__), (b, b.__collection__))
      ...
    

    This class wraps a bi-directional set. When an item appears in the
    intersection set, the collection item will also appear in the item’s
    inPaper attribute which, like any other attribute, must be
    declared on the item’s kind. A collection item may be added or set
    explicitely to inPaper if and only if the collection item supports
    such explicit addition by implementing an add(item) method.

viagra
free viagra
buy viagra online
generic viagra
how does viagra work
cheap viagra
buy viagra
buy viagra online inurl
viagra 6 free samples
viagra online
viagra for women
viagra side effects
female viagra
natural viagra
online viagra
cheapest viagra prices
herbal viagra
alternative to viagra
buy generic viagra
purchase viagra online
free viagra without prescription
viagra attorneys
free viagra samples before buying
buy generic viagra cheap
viagra uk
generic viagra online
try viagra for free
generic viagra from india
fda approves viagra
free viagra sample
what is better viagra or levitra
discount generic viagra online
viagra cialis levitra
viagra dosage
viagra cheap
viagra on line
best price for viagra
free sample pack of viagra
viagra generic
viagra without prescription
discount viagra
gay viagra
mail order viagra
viagra inurl
generic viagra online paypal
generic viagra overnight
generic viagra online pharmacy
generic viagra uk
buy cheap viagra online uk
suppliers of viagra
how long does viagra last
viagra sex
generic viagra soft tabs
generic viagra 100mg
buy viagra onli
generic viagra online without prescription
viagra energy drink
cheapest uk supplier viagra
viagra cialis
generic viagra safe
viagra professional
viagra sales
viagra free trial pack
viagra lawyers
over the counter viagra
best price for generic viagra
viagra jokes
buying viagra
viagra samples
viagra sample
cialis
generic cialis
cheapest cialis
buy cialis online
buying generic cialis
cialis for order
what are the side effects of cialis
buy generic cialis
what is the generic name for cialis
cheap cialis
cialis online
buy cialis
cialis side effects
how long does cialis last
cialis forum
cialis lawyer ohio
cialis attorneys
cialis attorney columbus
cialis injury lawyer ohio
cialis injury attorney ohio
cialis injury lawyer columbus
prices cialis
cialis lawyers
viagra cialis levitra
cialis lawyer columbus
online generic cialis
daily cialis
cialis injury attorney columbus
cialis attorney ohio
cialis cost
cialis professional
cialis super active
how does cialis work
what does cialis look like
cialis drug
viagra cialis
cialis to buy new zealand
cialis without prescription
free cialis
cialis soft tabs
discount cialis
cialis generic
generic cialis from india
cheap cialis sale online
cialis daily
cialis reviews
cialis generico
how can i take cialis
cheap cialis si
cialis vs viagra
levitra
generic levitra
levitra attorneys
what is better viagra or levitra
viagra cialis levitra
levitra side effects
buy levitra
levitra online
levitra dangers
how does levitra work
levitra lawyers
what is the difference between levitra and viagra
levitra versus viagra
which works better viagra or levitra
buy levitra and overnight shipping
levitra vs viagra
canidan pharmacies levitra
how long does levitra last
viagra cialis levitra
levitra acheter
comprare levitra
levitra ohne rezept
levitra 20mg
levitra senza ricetta
cheapest generic levitra
levitra compra
cheap levitra
levitra overnight
levitra generika
levitra kaufen

Leave a Reply