Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[higgins-dev] Updates to IdAS elements

The fact that many (but perhaps not all) of the IdAS CPs use IdAS to present data that exists in some real store tends to throw a wrench into simplistic methods of performing updates (adds and modifies specifically).
 
I keep trying to shift APIs around in ways that would allow us to re-use things like IDigitalSubject, IAttribute, etc. when adding new subjects and modifying existing ones.  One problem always surfaces:  In re-using a single interface, and in keeping things simple, it complicates the CP writer's job by forcing the CP to have to keep track of whether an objects represents something in the real store, versus something that's being built up to be later added to the real store.  Furthermore, some of the methods make no sense until the object has been added to the real store.
 
So, I'm wondering if taking a slightly different approach would be better.  Here's what I'm thinking:
 
1) Remove IContext.addSubject, preserve (but pare down IContext.createSubject)  createSubject always creates and adds a new subject.  It takes as arguments the components of a subject (cuid, attributes, metadata).  The return value is the resulting cuid, not an IDigitalSubject.  This means we wouldn't have ambiguous husks of IDigitalSubject floating around.
 
2) Remove add and create methods from IHasAttributes and IHasMetadata.  This removes confusion as to what happens when these are called on IDigitalSubject.
 
3) Because of #2, we have two needs: a) Need a way to build attributes and metadata to pass to the createSubject in #1, and b) Need a way to modify the attributes or metadata of an existing subject.
 
3.a) Add createAttribute and createMetadata methods to IAttributeModel and IMetadataModel (this is currently missing btw).  These methods would be capable of creating an IAttribute or IMetadata which can be passed to createSubject.  Similar methods would also be introduced to help build Filter assertions.
 
3.b) Introduce an UpdateSet class which is a set of UpdateOperation classes.  An UpdateOperation class consists of an operation (Add, Delete, Replace), and one or more attribute or metadata values.  This allows one to represent a set of modifications like: {Delete hatSize (8), Add hatSize (9), Delete favoriteCigaretteBrand, Replace favoriteDrinks (martini, cape cod)}
 
 

Back to the top