You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Javier Arauz (JIRA)" <ji...@apache.org> on 2008/03/12 16:04:48 UTC

[jira] Created: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole element

JEXL built-in Data() function cannot return a reference to a whole <data> element
---------------------------------------------------------------------------------

                 Key: SCXML-69
                 URL: https://issues.apache.org/jira/browse/SCXML-69
             Project: Commons SCXML
          Issue Type: Improvement
    Affects Versions: 0.6, 0.5, 0.7, 0.8, 1.0
            Reporter: Javier Arauz
            Priority: Minor
             Fix For: 0.8


There is no way with JEXL of building a Data() expression that refers to a whole <data> element, only to one of its children.

Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:

    <data name="myFoo"><content>Hi there!</content></data>
    <data name="foo" expr="'bar'"/>
    <assign location="/foo" expr="/myFoo/content"/>

In theory, after running the above SCXML the 'foo' data element changes from value 'bar' to 'Hi there!'.

There is no equivalent to the above SCXML using JEXL, since no Data() expression yields the root <data> element. This has the side effect that data elements as 'foo' above are effectively constants, since once defined there's no way of changing them.

The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin that takes just two arguments: the namespaces in use and the name of the <data> element, and returns an org.w3c.Node containing whatever that <data> element contains. Then you could write:

    <data name="myFoo"><content>Hi there!</content></data>
    <data name="foo" expr="'bar'"/>
    <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole element

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rahul Akolkar updated SCXML-69:
-------------------------------

    Remaining Estimate:     (was: 72h)
     Original Estimate:     (was: 72h)

> JEXL built-in Data() function cannot return a reference to a whole <data> element
> ---------------------------------------------------------------------------------
>
>                 Key: SCXML-69
>                 URL: https://issues.apache.org/jira/browse/SCXML-69
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6, 0.7
>            Reporter: Javier Arauz
>            Priority: Minor
>
> There is no way with JEXL of building a Data() expression that refers to a whole <data> element, only to one of its children.
> Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="/foo" expr="/myFoo/content"/>
> In theory, after running the above SCXML the 'foo' data element changes from value 'bar' to 'Hi there!'.
> There is no equivalent to the above SCXML using JEXL, since no Data() expression yields the root <data> element. This has the side effect that data elements as 'foo' above are effectively constants, since once defined there's no way of changing them.
> The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin that takes just two arguments: the namespaces in use and the name of the <data> element, and returns an org.w3c.Node containing whatever that <data> element contains. Then you could write:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole element

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578513#action_12578513 ] 

Rahul Akolkar commented on SCXML-69:
------------------------------------

I agree with some of your opinions in the (now deleted) JIRA comment. Please post any further discussion to the appropriate mailing list, thanks.


> JEXL built-in Data() function cannot return a reference to a whole <data> element
> ---------------------------------------------------------------------------------
>
>                 Key: SCXML-69
>                 URL: https://issues.apache.org/jira/browse/SCXML-69
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6, 0.7
>            Reporter: Javier Arauz
>            Priority: Minor
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> There is no way with JEXL of building a Data() expression that refers to a whole <data> element, only to one of its children.
> Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="/foo" expr="/myFoo/content"/>
> In theory, after running the above SCXML the 'foo' data element changes from value 'bar' to 'Hi there!'.
> There is no equivalent to the above SCXML using JEXL, since no Data() expression yields the root <data> element. This has the side effect that data elements as 'foo' above are effectively constants, since once defined there's no way of changing them.
> The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin that takes just two arguments: the namespaces in use and the name of the <data> element, and returns an org.w3c.Node containing whatever that <data> element contains. Then you could write:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole element

Posted by "Javier Arauz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Javier Arauz updated SCXML-69:
------------------------------

    Comment: was deleted

> JEXL built-in Data() function cannot return a reference to a whole <data> element
> ---------------------------------------------------------------------------------
>
>                 Key: SCXML-69
>                 URL: https://issues.apache.org/jira/browse/SCXML-69
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6, 0.7
>            Reporter: Javier Arauz
>            Priority: Minor
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> There is no way with JEXL of building a Data() expression that refers to a whole <data> element, only to one of its children.
> Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="/foo" expr="/myFoo/content"/>
> In theory, after running the above SCXML the 'foo' data element changes from value 'bar' to 'Hi there!'.
> There is no equivalent to the above SCXML using JEXL, since no Data() expression yields the root <data> element. This has the side effect that data elements as 'foo' above are effectively constants, since once defined there's no way of changing them.
> The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin that takes just two arguments: the namespaces in use and the name of the <data> element, and returns an org.w3c.Node containing whatever that <data> element contains. Then you could write:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole element

Posted by "Javier Arauz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SCXML-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578225#action_12578225 ] 

Javier Arauz commented on SCXML-69:
-----------------------------------

I agree regarding new Data() variants. Actually what I'd like to see is full support for standard XPath without the hassle of going through the Data() artifact.

In my example data model, data element 'foo' is realized by the parser as a degenerate XML tree with only one leaf node, specifically a text node initially containing the string value 'bar'.

According to the latest W3C latest draft, expressions in attribute 'expr' in <data> elements may yield any value,  i.e. it does not necessarily have to be a proper XML tree. Non-XML-tree values are realized as degenerate XML trees, as described in the commons SCXML documentation.

Using <cs:var> as you suggest poses two problems: first, decreases the portability of the scripts (which does not much in favor of an emerging technology); and second, deepens into the deviation from the W3C standard, where one can refer to a whole <data> element using the XPath "7data-name". 

I'd already tried Data(foo, '.') as you suggest, and it just doesn't work. I understand the problem comes from the fact that the Data class that models a <data> element is not an org.w3c.Node, but I'm not really sure about it.


> JEXL built-in Data() function cannot return a reference to a whole <data> element
> ---------------------------------------------------------------------------------
>
>                 Key: SCXML-69
>                 URL: https://issues.apache.org/jira/browse/SCXML-69
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6, 0.7
>            Reporter: Javier Arauz
>            Priority: Minor
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> There is no way with JEXL of building a Data() expression that refers to a whole <data> element, only to one of its children.
> Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="/foo" expr="/myFoo/content"/>
> In theory, after running the above SCXML the 'foo' data element changes from value 'bar' to 'Hi there!'.
> There is no equivalent to the above SCXML using JEXL, since no Data() expression yields the root <data> element. This has the side effect that data elements as 'foo' above are effectively constants, since once defined there's no way of changing them.
> The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin that takes just two arguments: the namespaces in use and the name of the <data> element, and returns an org.w3c.Node containing whatever that <data> element contains. Then you could write:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole element

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rahul Akolkar resolved SCXML-69.
--------------------------------

    Resolution: Won't Fix

I think this might require a different way of going about the snippet posted above, but I believe we shouldn't be adding more Data() function variants.

Not sure what "bar" refers to in the line:

 <data name="foo" expr="'bar'"/>

As general comments:
 * <data> should contain XML nodes, which would happen here if "bar" pointed to one
 * For pieces of the data model that are not nodes, <cs:var> should be used instead, where 'cs' is the Commons SCXML namespace

Separately, there is a way to obtain the root <data> element by using the current context node '.' in the query string i.e. Data(foo, '.')

Its unclear how useful that operation is (given the best practice that <data> should contain an XML "tree" rooted with an application-specific root element).


> JEXL built-in Data() function cannot return a reference to a whole <data> element
> ---------------------------------------------------------------------------------
>
>                 Key: SCXML-69
>                 URL: https://issues.apache.org/jira/browse/SCXML-69
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6, 0.7
>            Reporter: Javier Arauz
>            Priority: Minor
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> There is no way with JEXL of building a Data() expression that refers to a whole <data> element, only to one of its children.
> Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="/foo" expr="/myFoo/content"/>
> In theory, after running the above SCXML the 'foo' data element changes from value 'bar' to 'Hi there!'.
> There is no equivalent to the above SCXML using JEXL, since no Data() expression yields the root <data> element. This has the side effect that data elements as 'foo' above are effectively constants, since once defined there's no way of changing them.
> The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin that takes just two arguments: the namespaces in use and the name of the <data> element, and returns an org.w3c.Node containing whatever that <data> element contains. Then you could write:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SCXML-69) JEXL built-in Data() function cannot return a reference to a whole element

Posted by "Rahul Akolkar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SCXML-69?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rahul Akolkar updated SCXML-69:
-------------------------------

    Affects Version/s:     (was: 0.8)
                           (was: 1.0)
        Fix Version/s:     (was: 0.8)

Only released versions should be marked as affected. Best to begin with a fix version of unknown.


> JEXL built-in Data() function cannot return a reference to a whole <data> element
> ---------------------------------------------------------------------------------
>
>                 Key: SCXML-69
>                 URL: https://issues.apache.org/jira/browse/SCXML-69
>             Project: Commons SCXML
>          Issue Type: Improvement
>    Affects Versions: 0.5, 0.6, 0.7
>            Reporter: Javier Arauz
>            Priority: Minor
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> There is no way with JEXL of building a Data() expression that refers to a whole <data> element, only to one of its children.
> Using standard W3C SCXML it is possible to refer to a whole <data> element, e.g.:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="/foo" expr="/myFoo/content"/>
> In theory, after running the above SCXML the 'foo' data element changes from value 'bar' to 'Hi there!'.
> There is no equivalent to the above SCXML using JEXL, since no Data() expression yields the root <data> element. This has the side effect that data elements as 'foo' above are effectively constants, since once defined there's no way of changing them.
> The solution to this problem would consist of implementing a new method in class org.apache.commons.scxml.Builtin that takes just two arguments: the namespaces in use and the name of the <data> element, and returns an org.w3c.Node containing whatever that <data> element contains. Then you could write:
>     <data name="myFoo"><content>Hi there!</content></data>
>     <data name="foo" expr="'bar'"/>
>     <assign location="Data(foo)" expr="Data(myFoo, 'content'"/>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.