NEW ISSUE: Normalization Algorithm is broken

Title: Normalization Algorithm is broken 

Description: The Normalization Algorithm in the WS-Policy framework is
broken in converting a single expression of conjuncts in compact form to
an equivalent expression normal form and does not lead to a normal form
expression as illustrated below.

For expressions of the following form where the wsp:Policy element may
have single element child, or a multiple element children composition
with wsp:All such as: 

<wsp:Policy> 
    <ex:Assertion1/>
</wsp:Policy>

or 

<wsp:Policy>
    <wsp:All>
       <ex:Assertion1/>
       <ex:Assertion2/>
    </wsp:All>
</wsp:Policy>

The normalization algorithm fails to convert this into an equivalent
expression. It would be expected to derive a normal form expression with
a single alternative of the form from such expressions. 

<wsp:Policy>
    <wsp:ExactlyOne>
       <wsp:All> 
            List of Assertions
       </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>

but the algorithm fails to do so. 

In both cases, there is no wsp:optional attribute to introduce two
alternatives into the resulting expression converted to the normal form.
Thus, no wsp:exactlyOne is introduced in this case, and the resulting
expression can not be normalized. 

Note that the primer [1] uses such an example for the use of
WS-Addressing in Example 2.2. Thus, readers following the Framework with
the primer document and trying to formulate a normal form will not be
able to get what they want. I will illustrate the result using the
following example: 

<Policy>
  <wsap:UsingAddressing />
</Policy>

Taking the first form (a single child element) as an example, here is
the rundown of the normalization algorithm: 



1.	Start with the [document element] property D of the Document
Information Item of the policy expression. The [namespace name] of D is
always "http://www.w3.org/2006/07/ws-policy". In the base case, the
[local name] property of D is "Policy"; in the recursive case, the
[local name] property of D is "Policy", "ExactlyOne", or "All".
2.	Expand Element Information Items in the [children] property of D
that are policy references per Section 4.3.5 Policy Inclusion <\l > .
3.	Convert each Element Information Item C in the [children]
property of D into normal form.
4.	If the [namespace name] property of C is
"http://www.w3.org/2006/07/ws-policy" and the [local name] property of C
is "Policy", "ExactlyOne", or "All", C is an expression of a policy
operator; normalize C by recursively applying this procedure.
5.	Otherwise the Element Information Item C is an assertion;
normalize C per Sections 4.3.1 Optional Policy Assertions <\l >  and
4.3.2 Policy Assertion Nesting <\l > .
6.	Apply the policy operator indicated by D to the normalized
Element Information Items in its [children] property and construct a
normal form per Section 4.3.3 Policy Operators <\l > .


Here is what happens if you follow this step by step. 

1. applies <wsp:Policy>
2. does not apply
3. The element information item C is wsap:UsingAddressing. 
    4. does not apply
    5.  there is nothing to normalize (as 4.3.1, or 4.3.2 does not
apply) 
6. The policy operator indicated by D is wsp:Policy which is equivant to
"wsp:All"

    "Applying" wsp:All to wsaw:UsingAddressing is 

     <wsp:All><wsaw:UsingAddressing/></wsp:All>

     There is no optional assertion, etc. Thus, <wsp:exactlyOne> is not
introduced anywhere per the rules of the algorithm. 

The resulting Expression is 

     <wsp:All><wsaw:UsingAddressing/></wsp:All>

This is not in normal form!!! 

It is noted that it is impossible to convert an assertion which does not
have an wsp:optional attribute to a normal form. This appears to be a
deficiency of the algorithm, and not its intention. This is a bug in the
framework. 

Justification: 

A common form of the expression is expected to work without the presence
of wsp:optional attribute. It is possible to create such expressions
using the policy framework. As a matter of fact, the example is from our
own primer document itself. The algorithm should work for simple cases
when single alternatives are intended by compact form as well as
complicated cases where alternatives are introduced by the presence of
the wsp:optional attribute implicitly. The algoritm should not assume
the presence of wsp:optional to introduce alternatives. 

Proposal: 

Add another step for the normalization algorithm along the lines of 

7. If the resulting expression contains no alternatives, the expression
is equivalent to a policy with a single alternative where the content of
the resulting expression comprises its content.


This issue is filed as [Bug 4138] with the content that is provided
above. 


[1] http://www.w3.org/TR/2006/WD-ws-policy-primer-20061018/
[Bug 4138] http://www.w3.org/Bugs/Public/show_bug.cgi?id=4138


----------------------

Dr. Umit Yalcinalp
Research Scientist
SAP Labs, LLC
Email: umit.yalcinalp@sap.com Tel: (650) 320-3095 
SDN: https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/36238
--------
"Nearly all men can stand adversity, but if you want to test a man's
character, give him power." Abraham Lincoln. 

Received on Tuesday, 2 January 2007 19:56:49 UTC