sidewinderlabs / backplanejs

Other
12 stars 3 forks source link

Add ability to obtain sub-expressions from an XPath expression #54

Open backplane-import opened 13 years ago

backplane-import commented 13 years ago

Imported from backplanejs Google Code issue 54.

Reporter markbirbeck
Date 3 May 2010 8:35:46 PM UTC

The dependency-graph tracks dependencies within XPath expressions, so as to optimise evaluation. This means that we need a function that returns an array of sub-expressions, given an XPath statement.

For example, given the XPath statement "a[b]" we would want to know that the expression is dependent on the value of 'b'.

Similarly, if we had "a[b or c]" we would want to know that the expression is dependent on both the value of 'b' and the value of 'c'.

These values are currently generated by modifications made to Ajaxslt, so that the sub-expressions are obtained during ordinary XPath evaluation.

However, since we want to replace Ajaxslt (issue 44 and issue 50) then we'll need to be able to obtain sub-expressions if we're to keep the dependency-graph correct.


Ticket status set to Accepted

Priority: Medium Type: Enhancement

backplane-import commented 13 years ago

Comment by markbirbeck on 25 Jun 2010 6:54:55 AM UTC

The way we currently do this is in the function:

NodesetExpression.prototype.determineDependentExpressions()

which is in the file:

third-party/uxf/src/lib/xforms/VertexTargets.js

The Ajaxslt code has been modified so that as the XPath expression is broken up, the various parts are stored for later use. The Ajaxslt function only does this if the global variable 'g_bSaveDependencies' is true.

backplane-import commented 13 years ago

Comment by markbirbeck on 25 Jun 2010 7:18:51 AM UTC

I'd suggest that the easiest way to do this is as follows:

  1. Create a new sub-directory called:

    third-party/uxf/src/lib/backplane/xpath

  2. Into this directory place a fresh copy of the latest version of Ajaxslt, and commit it to Mercurial so that we can more easily see the modifications that are made.
  3. Modify the code in such a way that we can break apart the XPath. Don't use a global variable like the current technique, but instead write a function that will return an array of expressions.
  4. Create some unit-tests to verify that the expressions are being correctly broken apart.

(Creating unit-tests is described in the [http://code.google.com/p/backplanejs/wiki/TestingGuidelines TestingGuidelines] wiki page.)


Updates

Owner set to creaven

backplane-import commented 13 years ago

Comment by creaven on 2 Jul 2010 12:58:27 PM UTC

implemented in http://code.google.com/r/creavenmoro-backplanejs/source/detail?r=c3908b20d6375f25e65c5be73abb70200defdc13