Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [higgins-dev] Dealing with multi versus single valued attributes

If IAttribute myAttribute represents a thing called "hobbies", today I access a multi-valued attribute this way:
 
URI attrType = myAttribute.getType(); // returns a URI, probably with the word "hobbies" at the end.
// this gets me the values
Iterator iter = myAttribute.getValues();
while (iter.hasNext()) {
 // assuming I have apriori knowledge of it being simple
 ISimpleValue val = ((ISimpleValue)iter).next();
 val.getType(); // returns a URL like http://www.w3.org/2001/XMLSchema#string
 String str = ((String)val).getData();
 System.out.println(attrType + " = " + str);
}
With the strawman:
 
URI attrType = myAttribute.getType(); // returns a URI, probably with the word "hobbies" at the end.
// assuming I have apriori knowledge that it's a complex value which is a list of strings
IComplexValue outerVal = myAttribute.getValue();
Iterator iter = outerVal.getProperties();
while (iter.hasNext()) {
 IProperty prop = ((IProperty)iter).next();
 prop.getType(); // returns something rather useless in this particular case
 // assuming I have apriori knowledge of each element being a simple string
 ISimpleValue val = prop.getValue();
 val.getType(); // returns a URL like http://www.w3.org/2001/XMLSchema#string
 String str = ((String)val).getData();
 System.out.println(attrType + " = " + str);
}
I got halfway through the strawman code and realized we already had this discussion almost a year ago. I remember typing similar examples, thinking to myself -- yuk. 
 
Well, other input is welcome. Maybe there's a positive spin I'm not seeing.
 
Jim
 

>>> "Jim Sermersheim" <jimse@xxxxxxxxxx> 4/28/07 9:26 AM >>>
It may be a good time to re-visit an alternative approach to dealing with the issue of multi-valued attributes.  This is something I've resisted and I probably still don't like it, but I think we need to at least consider it while the topic is on people's minds.
 
A strawman proposal is to do away with the notion of multi-valued attributes at the IdAS API level.  Random thoughts about that:
 
- A CP with a backing store which has such a model (LDAP comes to mind) would represent a multi-valued attribute as if it were a single valued attribute which is a complex value.  Each element of the complex value has some generic type (like "value"), and represents one of the values in the backing store.  Updating these separately is now possible with the latest update operations.
 
- IFilter and friends may need to be re-visited such that a filter element can say (match if "hobbies" contains an element called "flying").  This ought to be made possible anyway.
 
It would be good to get more input on this than just that from Valery, Tom, and myself.
 
Jim

Back to the top