OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sca-assembly message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Issue 14: proposal


I had taken an AI to talk to Alex and provide a proposal for issue 14. 
Alex has changed jobs and not involved with SCA. But here is a proposal 
from me:

Problem:

Examples in the spec show many-valued properties being specified in two 
different ways: multiple <property> elements with the same name and 
single property element with multiple values.

I.e., either as:

<property name="currency">EURO</property>
<property name="currency">Yen</property>
<property name="currency">USDollar</property>

OR

<property name="complexFoo">
   <MyComplexPropertyValue1 xsi:type="foo:MyComplexType" attr="bar">
     <foo:a>AValue</foo:a>
     <foo:b>InterestingURI</foo:b>
   </MyComplexPropertyValue1>
   <MyComplexPropertyValue2 xsi:type="foo:MyComplexType" attr="zing">
     <foo:a>BValue</foo:a>
     <foo:b>BoringURI</foo:b>
   </MyComplexPropertyValue2>
</property>

In the 1st case, the fact that the three properties are called 
"currency" mean that they are values for the same property. In the 
second case, since both values are scoped to the same <property> element 
they are considered to be multiple values for the same property.

For this discussion, there are two kinds of properties:
1) declared using XML schema's simple type
2) declared using XML Schema's complex type or a GED

If it is a simple type, for convenience we allow the property's simple 
type to be the type of the <property> element's character children content:
<property name="currency">EURO</property>
This is convenient, as one does not have to declare a GED nor create a 
wrapper element to hold the value.

If it is a complex type or a GED, the values are specified in a wrapper 
element (if it is a complex type) or as an instance of the GED.:

<property name="complexFoo">
   <MyComplexPropertyValue xsi:type="foo:MyComplexType" attr="bar">
     <foo:a>AValue</foo:a>
     <foo:b>InterestingURI</foo:b>
   </MyComplexPropertyValue>
</property>

<property name="foo">
   <SomeGED ...>...</SomeGED>
</property>

I.e., the syntax for specifying properties varies based on whether it is 
a simple type or a complex type/GED.

Potential solutions:

1) Status quo: make no changes to the example, but add spec-ese that 
spells out how multi-valued properties are specified for each case.

Adv: Makes specifying values of properties with simple types really simple.

Disadv: different syntax for different kind of properties is confusing. 
If a mistake is made in naming the property and the property happens to 
be multivalued, it will not be detected. EG:
<property name="var1">some-value</property>
<property name="var1">some-other-value</property>
If the created wanted 'var1' and 'var2' but instead specified two 
'var1's, it would never be detected if var1 is multivalued.

2) Treat simple types the same way as complex types (everything else 
remaining the same). Example:
<property name="currency">
   <MySimplePropertyValue1 
xsi:type="xs:string">EURO</MySimplePropertyValue1>
   <MySimplePropertyValue2 
xsi:type="xs:string">USDollar</MySimplePropertyValue2>
</property>

Multi-valued properties are specified by listing all the values in the 
same <property> element. If two <property> elements have the same name, 
it is an error.

Adv: properties declared using types has the same syntax. XML Schema for 
<property> does not have to be mixed. Better type checking when using 
schema-validating parser. Better error detection (can be done by 
defining the right schema for <property> element).

Disadv: additional element needed for simple types

3) Define a new element <value> which will always contain the property 
value irrespective of simple/complex type/GED.

simple type:
<property name="currency">
   <value xsi:type="xs:string">EURO</value>
   <value xsi:type="xs:string">USDolar</value>
</property>

complex type:
<property name="complexFoo">
   <value xsi:type="foo:MyComplexType" attr="bar">
     <foo:a>AValue</foo:a>
     <foo:b>InterestingURI</foo:b>
   </value>
   <value xsi:type="foo:MyComplexType" attr="zing">
     <foo:a>BValue</foo:a>
     <foo:b>BoringURI</foo:b>
   </value>
</property>

GED:
<property name="foo">
   <value>
     <SomeGED ...> ... </SomeGED>
   </value>
   <value>
     <SomeGED ...> ... </SomeGED>
   </value>
</property>

Adv: properties always have the same syntax. XML Schema for <property> 
does not have to be mixed. Better type checking when using 
schema-validating parser. Better error detection (can be done by 
defining the right schema for <property> element). No need to create 
wrapper elements for complex types, <value> is the wrapper that is 
always used.

Disadv: additional element needed for simple types


I like option (3) for its uniformity (and therefore readability). But I 
would be ok with either of (2) or (3) or some hybrid of (2)/(3).

Thanks.

-Anish
--


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]