Can anyone suggest documentation or tutorials for developing path queries and indices for (XML-like) tree-structured data?
Suppose data is organized hierarchically in key->value pairs, eg:
In[220]:= data = {row1 -> {key1 -> value1, key2 -> value2},
row2 -> {key1 -> value3, key2 -> value4}}
Out[220]= {row1 -> {key1 -> value1, key2 -> value2},
row2 -> {key1 -> value3, key2 -> value4}}
In[221]:= row1 /. data
Out[221]= {key1 -> value1, key2 -> value2}
In[222]:= key2 /. (row1 /. data)
Out[222]= value2
This is a primitive form of tree-structured data that enables building up basic path queries out of Rule
and ReplaceAll
. However, it's desirable to also have wildcard functionality (e.g. like All
) and range-like queries (e.g. like Span
), but again where query parameters are named entities rather than Position expressions as in more common in relational data structures.