Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323900 - [xpath2] improvements to computation of typed values of element and attribute nodes, for simple type varieties list and union
Summary: [xpath2] improvements to computation of typed values of element and attribute...
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xpath (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2.3   Edit
Assignee: Mukul Gandhi CLA
QA Contact: Jesper Moller CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-29 03:37 EDT by Mukul Gandhi CLA
Modified: 2010-09-27 09:05 EDT (History)
3 users (show)

See Also:
d_a_carver: review+


Attachments
patch file (15.10 KB, patch)
2010-08-29 03:59 EDT, Mukul Gandhi CLA
no flags Details | Diff
updated patch file (15.82 KB, patch)
2010-08-29 04:48 EDT, Mukul Gandhi CLA
no flags Details | Diff
updated patch file v2 (16.75 KB, patch)
2010-08-29 06:12 EDT, Mukul Gandhi CLA
no flags Details | Diff
updated patch, refactoring to NodeType (17.76 KB, patch)
2010-08-29 10:03 EDT, Mukul Gandhi CLA
no flags Details | Diff
patch having test cases for this issue (8.65 KB, patch)
2010-08-29 10:04 EDT, Mukul Gandhi CLA
no flags Details | Diff
updated patch with improvements (24.45 KB, patch)
2010-09-02 20:26 EDT, Mukul Gandhi CLA
no flags Details | Diff
attaching an improved patch for this bug report (26.66 KB, patch)
2010-09-04 09:30 EDT, Mukul Gandhi CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mukul Gandhi CLA 2010-08-29 03:37:23 EDT
Build Identifier: I20090313-0100

The typed values of element and attribute nodes need to be implemented as per the algorithm described in the XDM spec (ref, http://www.w3.org/TR/xpath-datamodel/#TypedValueDetermination). The current implementation with PsychoPath engine has certain shortcomings as per this part of the XDM spec (particularly for simple content with varieties list and union).

i've written a fix for this and would be committing a patch soon and few additional test cases about this change later.

Reproducible: Always
Comment 1 Mukul Gandhi CLA 2010-08-29 03:59:38 EDT
Created attachment 177675 [details]
patch file

i've committed the patch to HEAD, and attaching it here for review, before we commit this to the service branch.

with this patch current PsychoPath tests pass without any change (that's good i believe). i would be writing few additional test cases for this patch, and would attach them to this bug-report soon.
Comment 2 Mukul Gandhi CLA 2010-08-29 04:04:09 EDT
i've attached the patch file for this bug, and asking for review from fellow committers before we commit this to the service branch.
Comment 3 Mukul Gandhi CLA 2010-08-29 04:48:19 EDT
Created attachment 177678 [details]
updated patch file

modifying the patch slightly. doing a slight change to XSDecimal, to make it more JDK 1.4 friendly (i got this error, while testing these changes with Xerces. the attached change to XSDecimal fixes this issue).
Comment 4 Mukul Gandhi CLA 2010-08-29 06:12:14 EDT
Created attachment 177680 [details]
updated patch file v2

doing a slight change to the patch, and attaching it again please. this looks better now.

i'm in a process to prepare the test cases for this change, and would be posting them asap.

all the latest changes including this one have gone into HEAD (but not to service branch, and we are waiting for a review there).
Comment 5 David Carver CLA 2010-08-29 09:26:22 EDT
Mukul, can we do another round of refactoring in the NodeType class.

Is there a way you can break that big multi if then else statement into something smaller (i.e. extract some of the body of that code into specific methods).  It'll make it easier to maintain going forward and easier to read as well for somebody having to maintain it.

We'll also need PMC approval now to get it into 3.2.2.

So when resubmitting the patch, please add a wtp PMC member for approval as well.
Comment 6 Mukul Gandhi CLA 2010-08-29 10:03:36 EDT
Created attachment 177682 [details]
updated patch, refactoring to NodeType
Comment 7 Mukul Gandhi CLA 2010-08-29 10:04:27 EDT
Created attachment 177683 [details]
patch having test cases for this issue
Comment 8 Mukul Gandhi CLA 2010-08-29 10:17:35 EDT
Hi Dave,

(In reply to comment #5)
> Mukul, can we do another round of refactoring in the NodeType class.
> 
> Is there a way you can break that big multi if then else statement into
> something smaller (i.e. extract some of the body of that code into specific
> methods).  It'll make it easier to maintain going forward and easier to read as
> well for somebody having to maintain it.
> 
> We'll also need PMC approval now to get it into 3.2.2.
> 
> So when resubmitting the patch, please add a wtp PMC member for approval as
> well.

As per the suggestion (and thanks :)), i've refactored the code of NodeType (i've added code-base of list and union handling to different methods). Kindly review please.

I've committed the refactoring changes to HEAD.

No changes have yet been committed to the service branch. I've also attached a patch with few test cases for this change (not yet committed).

I'm happy to report, that after this fix all existing tests still pass, and the new tests for this patch also pass. I'm positive that the solution sought by this bug report, has been achieved by this patch.

After the PMC review passes (possibly with further improvements and after some more time), we can commit the test-case additions and also the changes to the service branch.

PS: i'm asking David Williams to do a PMC review please.


Regards,
Mukul
Comment 9 David Carver CLA 2010-08-29 13:40:54 EDT
This looks better, plus there are unit tests for this now as well.
Comment 10 Mukul Gandhi CLA 2010-09-02 20:26:51 EDT
Created attachment 178112 [details]
updated patch with improvements

updating the patch making few improvements.
Comment 11 Mukul Gandhi CLA 2010-09-02 20:32:56 EDT
i did few changes to logic for the patch. now we are using few native Xerces APIs to get validation details from existing PSVI objects, instead of writing few of validation primitives again into PsychoPath engine. the test cases (in the patch for this bug report) remain same and all of them pass as before.

i've committed changes to HEAD but not to service branch. test changes are yet not committed.

i'm happy doing this change :)
Comment 12 David Carver CLA 2010-09-03 17:14:28 EDT
(In reply to comment #11)
> i did few changes to logic for the patch. now we are using few native Xerces
> APIs to get validation details from existing PSVI objects, instead of writing
> few of validation primitives again into PsychoPath engine. the test cases (in
> the patch for this bug report) remain same and all of them pass as before.
> 
> i've committed changes to HEAD but not to service branch. test changes are yet
> not committed.
> 
> i'm happy doing this change :)

Well, as I mentioned we need PMC approval, the code looks fine.

David??
Comment 13 Mukul Gandhi CLA 2010-09-04 09:30:40 EDT
Created attachment 178212 [details]
attaching an improved patch for this bug report

these changes were done into PsychoPath, to align better with XML schema 1.1 assertions implementation with Xerces, and the results are encouraging for Xerces now, with these new changes.

the test cases remain same, and success rate of existing tests is same. as of now, these new changes are committed to HEAD, but not to service branch. also new tests are still not committed to the CVS server location. as advised, the changes to service branch will be committed after a PMC review, or even during the next development & commit cycle at Eclipse Source Editing. please let me know, what's convenient for the PsychoPath and Eclipse Source Editing projects.
Comment 14 Mukul Gandhi CLA 2010-09-27 08:47:47 EDT
Since WTP 3.2.2 was released few days ago, I thought I might make commit of changes for this bug report.

I've now completed commit of changes for this bug (both for code-base and test cases) report both to PsychoPath XPath2 HEAD location and service branch.

I'm now marking this defect as resolved.