File: treeapi.xml

package info (click to toggle)
tcllib 1.20%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 68,064 kB
  • sloc: tcl: 216,842; ansic: 14,250; sh: 2,846; xml: 1,766; yacc: 1,145; pascal: 881; makefile: 107; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (98 lines) | stat: -rw-r--r-- 3,456 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?xml version="1.0" ?>
<?xml-stylesheet href="api.css" type="text/css" ?>
<!DOCTYPE api SYSTEM "api.dtd" [
]>
  <api>
  <title>Tree API</title>
  <header>
    <p>Treeql is a fairly thin query facility over Trees.  It implements an ordered set of nodes which are generated and filtered by application of the treeql query language to each node in turn.</p>

    <p>Some naming confusion arises because some interesting trees can represent things which have 'attributes', whereas some tree abstractions also provide per-node 'attributes'.  We try, in this, to adopt the convention that the abstract tree has 'attributes', whereas the concrete tree may implement node 'properties'.</p>

    <p>As treeql iterates over the ordered set of nodes applying query terms to each node in the set - the functionality of treeql is therefore determined by that of the underlying tree.</p>

    <p>The main value add of Treeql is that it maintains a node set and handles the distribution of functions over that node set.</p>

    <p>Several more abstract 'pre-canned' queries are provided by Treeql, implemented in terms of lower level tree functions.</p>

    <p>Some minimal functionality of the underlying tree is assumed by treeql to implement a minimal set of queries deemed necessary.</p>

    <p>The underlying tree must provide the following API:</p>

  </header>

  <group used="$query apply">
    <name>Structural generators</name>
    
    <method>
      <object><arg>tree</arg></object>
      <name>rootname</name>
      <args></args>
      <result>returns the tree's root</result>
    </method>
    
    <method>
      <object><arg>tree</arg></object>
      <name>children</name>
      <args><arg>node</arg></args>
      <result>return all immediate children of <arg>node</arg></result>
    </method>
    
    <method>
      <object><arg>tree</arg></object>
      <name>next</name>
      <args><arg>node</arg></args>
      <result>return next right sibling of <arg>node</arg></result>
    </method>

    <method>
      <object><arg>tree</arg></object>
      <name>parent</name>
      <args><arg>node</arg></args>
      <result>return <arg>node</arg>'s parent</result>
    </method>

    <method>
      <object><arg>tree</arg></object>
      <name>previous</name>
      <args><arg>node</arg></args>
      <result>return left sibling of <arg>node</arg></result>
    </method>
  </group>

  <group used="$query apply">
    <name>Property generators</name>
    
    <method>
      <object><arg>tree</arg></object>
      <name>get</name>
      <args><arg>node</arg> <arg>key</arg></args>
      <result>get value of property named <arg>key</arg></result>
    </method>

    <method>
      <object><arg>tree</arg></object>
      <name>keys</name>
      <args><arg>node</arg> <arg>glob</arg></args>
      <result>get all <arg>node</arg> property (names,values) whose keys match <arg>glob</arg> (default *)</result>
    </method>
    
    <method>
      <object><arg>tree</arg></object>
      <name>set</name>
      <args><arg>node</arg> <arg>prop</arg> <arg>val</arg></args>
      <result>set <arg>node</arg> <arg>key</arg> to <arg>value</arg></result>
    </method>
  </group>

  <group used="$query bool">
    <name>Predicates</name>

    <method>
      <object><arg>tree</arg></object>
      <name>keyexists</name>
      <args><arg>node</arg> <arg>key</arg></args>
      <result><arg>node</arg> has property <arg>key</arg></result>
    </method>
  </group>
</api>