From: Oren Ben-K. <or...@ri...> - 2002-08-05 15:21:02
|
Clark C . Evans [mailto:cc...@cl...] wrote: > | - Why do you need the { key: ~, value: *ROOT } pair? It is > | the first entry > | in *every* path, and as such it seems it can be omitted. > | Further, I want to > | be able to "apply-path-to-graph(path, graph)". Placing a > | reference to the > | root at the start of the path kills this useful ability. > > You need to have the root node stored since inside of a YPATH you > may need to jump up to the "top" of the tree within a predicate. I don't see how it follows... I re-thought about it, however, and I see there's not much point in applying to one graph the results of applying a YAPTH to another graph. What would be interesting would be to convert the results of a YPATH into a simpler YPATH, for example /a/../b/c into /a/c. That said, there is still a question of how to represent a path returned by the YPATH engine. Your answer was "a sequence of { key: ..., value: ... } pairs". Which leaves open the questions of: - How to represent going into a list (one possible answer - { key: ~, value: <index> }). - What happens when selecting a *key node* rather than a value node? - And, of course - what happens with structured keys. > | > - item: [] > | > role: > > | > This describes a predicate. The predicate acts as > | > a "filter" on the current selected contexts, knocking > | > out those that don't return true. Within a predicate > | > strings are treated as literals, unless prefixed with > | > ./ or / or some other way that identifies a subordinate > | > path expression. > | > | Which implies some sort of different quoting/interpretation > | rules for > | strings inside predicates. I'm not certain what you have in > | mind, but I > | think the rules should be the same inside and outside predicates. > > The quoting rules are the same. The interpretation will be different > as anything that must be a "path" inside a predicate must start with > a './' or '/' or '../' or some other path-ish marker. I see; as opposed to the start of the whole YPATH expression that may start with a word (key value). Is this distinction really called for? Can foo[bar] mean anything else other than /foo[./bar]? BTW, this touches on David's "default is string" issue. Obviously in YPATH strings values containing a '/' would have to be quoted. Have fun, Oren Ben-Kiki |