From: Clark C . E. <cc...@cl...> - 2001-11-13 16:26:02
|
YAML Path (or YPATH) is a syntax used to identify particular nodes within a YAML tree. Assume the folowing document. --- a: &001 - &002 a - &003 \ scalar value b: &004 x: &005 boo y: &006 p: &007 - &008 yippe - &009 yappo q: &010 c: &011 x: &012 moo y: *006 d: *004 A path is a query that returns a set of nodes (which I will write using their identity). Path | Set of nodes | Notes ----------------+-------------------------------------- /a/0 | *002 | Goes to "a" then to "0" /*/x | *005 *012 | Matches anything, then "x" /d/x/p | *007 | /b/x/p/* | *008 *009 | //*[.='boo'] | *005 | Matches any node in the tree | with a scalar value 'boo' YAML path is useful for extracting parts of a YAML graph, setting up various processing or notification systems: "tell me when a document arrives such that this ypath expression returns at least one node". Or choosing which program is used to process an incoming YAML document on the basis of it's content. Basically... it's horribly useful stuff. By the way... by attaching an identity to each node we an *really* be clear how YPATH works; explaining it will be easy (compared to xpath). Anyway, this relates to the Information Model since these expressions will be queries on the information model... they will know *nothing* of the syntax. So, if we distinguish between a map (with integer keys) and a sequence, then YPATH must also do this. Thus, we'd probably need a different way to express an "index" of a node in a sequence, or some other way to differentiate between the two of them (yuck). The decisions about the Informaiton Model have a direct affect on YPATH... unlike decisions about scalar styles and other syntax sugar. Best, Clark |