Replies: 7 comments
-
|
problem here seems to be the 'or' in the expression - when changing to 'and' the additional '@selected' nodes will be added |
Beta Was this translation helpful? Give feedback.
-
|
This hits a problem with the approach. To get referenced nodes we have to evaluate the expr though we would rather want a static analysis. So we get the cost of building the graph even before a recalculation happens. |
Beta Was this translation helpful? Give feedback.
-
|
I have tried something out with using more static analysis on XPaths. That would at least give us fewer moments where we need to recalculate the dependencies. Instead of always having to recalculate (assuming the dependencies have been touched), we'll only have to recalculate when the document structure is changed. This should shave off a tremendous amount of time. Feel free to check out my small spike at https://github.com/DrRataplan/xpath-dep-scan. I'll spend some time soon to see how we can improve the data model and the granularity. Thinking of something like And I also need to spend some time on branches within predicates. If we're going to allow |
Beta Was this translation helpful? Give feedback.
-
|
the static analysis is needed during rebuild - just creating the recalcuation main graph. Ideally without the need to evaluate at that stage. For that ideally we would get all referenced nodes in an expression regardless of where they occur (wether inside a function, an 'if' or predicate) - not sure if that's possible. if a one-time evaluation is needed we can probably skip or use the results in first recalculate? (just a thought) During recalculate there are 2 situations:
{ What you are referring to exactly with "data model and granularity" ? |
Beta Was this translation helpful? Give feedback.
-
|
ah - will have to test your code - thks for that. See some mods and test looks good. Will check it out. |
Beta Was this translation helpful? Give feedback.
-
That is possible. I did something with extracting all sub-paths from the expression, evaluating them one by one to get hold of the instances of the nodes the expression may reference. There are still some caveats, like
That is a possible solution, and it is the most straight-forward one. It's the way to get the minimal dependency chain. The behaviour will be equal to the current one though; it just saves us an evaluation cycle but the dependencies will be very minimal. Noting this down also for myself because the XForms spec is still foreign to me:Reading up the spec (https://www.w3.org/community/xformsusers/wiki/XForms_2.0#Dependencies) this actually makes sense. Even though the It is however a reference as described here:
That is clear. Having changed no nodes is supposed to be a rare event right? That is why it pays off to keep hold of that list of referenced nodes.
I was thinking of making the dependency list granular: hold absent attributes in it and making a difference between depending on an elements attributes, child list or just data. But reading the spec more thoroughly I see this is not needed at all. Just a Set of Nodes is fine. |
Beta Was this translation helpful? Give feedback.
-
|
@DrRataplan i'm actually coming quite near a first more complete implementation. I've setup another array in model to hold changed ModelItems. When it comes to recalculate and the array is non-empty it will be used to build the subgraph. Using the depGraph API its easy to get the dependants. It's just creating a subgraph that adds the list of dependants to the graph for each changed modelItem. depGraph will already ignore duplicates when using addNode(). Created a simple demo to ensure only the touched subgraph would be used without actually switching the processing but i guess it's just another hour or two to get it going. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
DependencyNotifyingDomFade should report all dependent nodes for a given context and expression but fails to report the
@selectednode in the following example:Thus the dependencyGraph is missing nodes and will create a vertex for each 'facet' node and a node for the 'running' node but does not report the '@selected' node.
Beta Was this translation helpful? Give feedback.
All reactions