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

 


Help: OASIS Mailing Lists Help | MarkMail Help

regrep-query message

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


Subject: ClassificationNode queries Using an XPATH based Solution


Team,

In our last meeting I had the action item to describe how to use XPATH expressions to address the use cases identified
by Len in the message at the following URL:

    http://lists.oasis-open.org/archives/regrep-query/200109/msg00041.html

Virtual Document for ClassificationSchemes
--------------------------------------------
First I will describe the missing part in RIM of the XPATH usage for getPath method of ClassificationNode.

In order to use XPATH a virtual XML document structure must be defined that matches a ClassificationScheme structure. The virtual document structure is such that the name attribute of the ClassificationScheme matched the root element name for the document, while the value attribute of each ClassificationNode in the tree maps to a descendent element with the same name within the document. For an example I list the ClassificationScheme and ClassificationNodes for a simple Geography scheme followed by its virtual document.

<ClassificationScheme id='Geography' name="Geography"/>

<ClassificationNode id="North America" parent="Geography"/>
<ClassificationNode id="United States" parent="North America"/>

<ClassificationNode id="Asia" parent="Geography"/>
<ClassificationNode id="Japan" parent="Asia"/>

Now the equivalent virtual document would be:

<Geography>
    <North America>
        <United States/>
    </North America>

    <Asia>
        <Japan/>
    </Asia>

</Geography>

Similarly Len's example scheme would map to:

<Len's Scheme>
    <None>

    <A>
        <B/>
        <C/>
    </A>

    <B>
        <A/>
        <C/>
    </B>

    <C>
        <A/>
        <B/>
    </C>

</Len's Scheme>

Use Cases And Their XPATH Based Solutions
------------------------------------------------

The table below is organized as follows. The use case column has sifted the underlying use case from Len's examples. The second column copies the corresponding Len's example verbatim. The third column lists the XPATH expression that could be used in a ClassificationNodeQuery. The fourth column gives the description of the XPATH expression in terms of XPATH and XML terminology.
 
Use Case
Len's Example
XPATH Expression
Description
Match all nodes in first level that have a specified value level="Primary" AND value="None"   -- to see which LO's satisfy no criteria /None Find all first level elements named 'None'
Match all nodes that have a specified value regardless of where in the scheme value="B"                          -- to see which LO's address criteria B //B Find all Elements named 'B'
Match all nodes in the second level that have a specified value level="Secondary" AND value="A"    -- to see which LO's address A as 
Secondary criteria
/*/A Find all grand children (second level) of root element are named 'A' 
Match all nodes in the 3rd level that have a specified value /*/*/A Find all great-grand children (third level) of root element are named 'A' 
Match all nodes in first level that have one of the specified values level="Primary" AND (value="A" OR value = "C")  -- to see which LO's treat A or C as Primary criteria /A | /C Find all first level elements that are named 'A' OR 'C'

Complete ClassificationNodeQuery
------------------------------------

The following query is from the current proposal:

>If instead, one wanted ALL nodes in the subtree beneath the given node, then the following
>query could be used:

<ClassificationNodeQuery>
    <FromSchemeBranch>
        <ClassificationSchemeFilter> id EQUAL "urn:some:known:scheme" </ClassificationSchemeFilter>
    </FromSchemeBranch>

    <HasParentBranch>
        <HasPathBranch>
            <PathFilter>path STARTSWITH "KnownPathOfGivenNode" </PathFilter>
        </HasPathBranch>
    </HasParentBranch>
</ClassificationNodeQuery>

The following Query would replace the preceding one when using XPATH syntax:

<ClassificationNodeQuery>
    <ClassificationNodeFilter>
        getPath EQUAL "/urn:some:known:scheme/*"
    </ClassificationNodeFilter>
</ClassificationNodeQuery>

My Assertions
---------------

My Plea
---------
Team, I want to make it very clear that I am very supportive of the proposal put forward by Len. I think it is an excellent start but it can be made even better if we work together instead of against each other. I feel that FilterQuery is the most important area for us to achieve perfection in all of ebXMl registry TC output. It will make or break this work gaining adoption. Please, lets not rush this and listen to ideas that people may provide to get this to perfection. There is room for new ideas and perspectives in this excellent work.

Learning XPATH
------------------
The subset of XPATH we are talking about is fairly easy to learn. Some resources are listed below:

http://www.w3.org/TR/xpath
http://www.zvon.org/xxl/XPathTutorial/General/examples.html
 
 
 
 
 
 
 
 
 

--
Regards,
Farrukh
 

begin:vcard 
n:Najmi;Farrukh
tel;work:781-442-0703
x-mozilla-html:FALSE
url:www.sun.com
org:Sun Microsystems;Java Software
adr:;;1 Network Dr. MS BUR02-302;Burlington;MA;01803-0902;USA
version:2.1
email;internet:najmi@east.sun.com
fn:Farrukh Najmi
end:vcard


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


Powered by eList eXpress LLC