Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
IdAS Update Proposals 2
There were three problems in the previous IdAS model:
1. IAttribute (IProperty) has two methods - getValues() and getValue(), and can store/return as single value as multiple value. We propose to add the following changes to IdAS interfaces to remove this ambiguity:
/** * Holds the value of a property. * */ public interface IPropertyValue { <!-- Jimse: Is this true when the model specifies this attribute as single, as well as when it may hold multiple values but only happens to hold a single value? --> <!-- Vkokhan: Actually 'isSingle' was a mistype --> /** * Returns <code>true</code> when the value is simple and this instance * could be cast to {@link ISimpleValue} and <code>false</code> otherwise. * * @throws IdASException */ public boolean isSimple() throws IdASException; /** * Returns <code>true</code> when the value is complex and this instance * could be cast to {@link IComplexValue} and <code>false</code> * otherwise. * * @throws IdASException */ public boolean isComplex() throws IdASException; /** * Returns <code>true</code> when the property may contains multiple * values and this instance could be cast to {@link IValueList} and * <code>false</code> otherwise. * * @throws IdASException */ public boolean isList() throws IdASException; /** * Returns OWL type for this property's value (i.e. * http://www.w3.org/2001/XMLSchema/string or * http://www.eclipse.org/higgins/ontologies/2006/higgins/SubjectRelationship). * When {@link isList()} returns <code>true</code> returned type * represents OWL type of each value in the list. * * @throws IdASException */ public URI getType() throws IdASException; } interface ISimpleValue extends IPripertyValue { Object getValue(); void setValue(Object value); } interface IComplexValue extends IPropertyValue, IHasProperties { } interface IValueList extends IPropertyValue { Iterator getValues(); void setValues(Iterator newValues); void addValue(IPropertyValue value); void removeValue(IPropertyValue value); } /** * Represents a typed propery. */ public interface IProperty { /** * Returns the type of this property as an {@link URI}. * <p> * Using this URI a consumer may find definition of this property in context * data model. Definition of the property define the type or range of types * of object(s) returned from {@link #getValue()} * * @throws IdASException */ public URI getType() throws IdASException; /** * Returns a value for this property. When this type of property could * contains multiple values an instance of {@link IValueList} is returned * even if this property's instance doesn't contain any value. When this * type of property must contains single value an instance of either * {@link ISimpleValue} or {@link IComplexValue} is returned. * * @throws IdASException */ public IPropertyValue getValue() throws IdASException; /** * Sets value for this property. Performs deep copy of value supplied as the * parameter and return new value of this property. Subsequent updates to * the value must be made to the returned value in order to have them affect * this property. * * @throws IdASException */ public IPropertyValue setValue(IPropertyValue newValue) throws IdASException; }
By default IAttribute (IProperty) should retrun IValueList instance. If we want to define this attribute as single, we should set cardinality = 1 for appropriate attribute property in the higgins OWL schema and in this case IProperty should return single ISimpleValue or IComplexValue instance. As a result, using cardinality mechanism of higgins OWL schema, we will able to define which value single or multiple is used for attribute.
An alternate approach is this:
Interface IProperty { /** * Returns all values for this iProperty. * @return an Iterator of {@link IPropertyValue}s * @throws IdASException */ public Iterator getValues() throws IdASException; /** * When true, this property may be cast as an {@link ISingleValuedProeprty} such that * {@link ISingleValuedProperty#getValue()} may be called as a convenience * @return true when the model for this property dictates that this property is single valued */ public boolean isSingleValued(); ... } public interface ISingleValuedProperty extends IProperty { /** * Returns the value for this iProperty. * @throws IdASException */ public IPropertyValue getValue() throws IdASException; }
2. Complex Attriburte can not contain more than one complex value because of restrictions of used OWL schema. Figure below shows current schema:
On this picture digital subject (pwa:Person class) contains attribute (pwa:postalAddress property) with complex value (pwa:PostalAddress class). If we want to add one more value (individual of pwa:PostalAddress class) we can only add a new attribute, because the same attribute can not contain two complex values (pwa:postalAddress property can not refer to two individuals of pwa:PostalAddress class). We need to add some intermediary owl-class between pwa:postalAddress (attribute property) and pwa:PostalAddress (complex value class), like pwa:postalAddress_container on the figure below.
3. We need some transaction mechanism to update IContext (or IDigitalSubject at the least) safely. We think it will be most useful to add transaction support on IContext level. We propose to add the following methods:
a) commit() - this method will be used by user to commit a set of changes made in the context;
b) rollback() - this method will be used by user to rollback his changes for some resons (because of non-IdAS exeptions, for example);
c) setAutocommit(boolean) - this method will be used by user to set\reset transaction mode (if true - user should use commit() method to save changes, if false - each change will be saved immediately).