Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tm::tree(3pm) [debian man page]

TM::Tree(3pm)						User Contributed Perl Documentation					     TM::Tree(3pm)

NAME
TM::Tree - Topic Maps, trait for induced tree retrieval SYNOPSIS
use TM::Materialized::AsTMa; my $tm = new TM::Materialized::AsTMa (file => 'old_testament.atm'); Class::Trait->apply ( $tm => 'TM::Tree' ); $tm->sync_in; # old-testament pedigree print Dumper $tm->tree (lid => 'adam', type => 'has-parent', arole => 'parent', brole => 'child' ); # new-testament inverse pedigree print Dumper $tm->tree (lid => 'gw-bush', type => 'has-parent', arole => 'child', brole => 'parent' ); DESCRIPTION
Obviously, topic maps can carry information which is tree structured. A family pedigree is a typical example of it; associations having a particular type, particular roles and you can derive a tree structure from that. This is exactly what this operator does: it takes one topic map basis and primed with a starting node, an association type and two roles a tree will be returned to the caller. INTERFACE
Methods tree $treeref = $tm->tree ( $start_topic, $type_topic, $role_topic, $role_topic, [ depth => $integer ]) $treeref = $tm->tree_x ( $start_topic, $type_topic, $role_topic, $role_topic, [ depth => $integer ]) This function will analyze the topic map and will detect all maplets of the given type (direct and indirect ones) having the specified roles. Starting from the start topic it will so find other topics playing the brole. Those will be used as a next starting point, and so forth. To avoid the tree to become too big, you can impose an optional limit. Loops are detected. Every output tree node contains following fields: "lid": the lid of the node "children": a list reference of child nodes, there is no specific sort order "children*": Note: This is currently deactivated. for convenience this list reference contains all children, grand-children, grand-grand children.... of this node (this list is neither sorted nor unique out of performance considerations). The version "tree_x" does not honor subclassing of roles and type (but "tree" does). This means that is can be considerably faster, especially if you use it for taxonomy stuff with "isa" and "is-subclass-of". taxonomy $treeref = $tm->taxonomy ([ $start_lid ]) This function is a specialization of "tree", in that it looks at a particular association type ("is-subclass-of") and the appropriate roles ("superclass", "subclass"). Obviously the result is a tree holding all subtypes. The only optional parameter is a toplet "lid"; that becomes the starting point of the tree. If that parameter is missing, "thing" is assumed. SEE ALSO
TM COPYRIGHT AND LICENSE
Copyright 200[3-6] by Robert Barta, <drrho@cpan.org> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-02-15 TM::Tree(3pm)

Check Out this Related Man Page

Blt_TreeCreateNode(3)					      BLT Library Procedures					     Blt_TreeCreateNode(3)

__________________________________________________________________________________________________________________________________________________

NAME
Blt_TreeCreateNode - Creates a node in a tree data object. SYNOPSIS
#include <bltTree.h> Blt_TreeNode Blt_TreeCreateNode(tree, parent, name, position) ARGUMENTS
Blt_Tree tree (in) Tree containing the parent node. Blt_TreeNode parent (in) Node in which to insert the new child. const char *name (in) Node label. If NULL, a label will automatically be generated. int position (in) Position in the parent's list of children to insert the new node. _________________________________________________________________ DESCRIPTION
This procedure creates a new node is a tree data object. The node is initially empty, but data values can be added with Blt_TreeSetValue. Each node has a serial number that identifies it within the tree. No two nodes in the same tree will ever have the same ID. You can find a node's ID with Blt_TreeNodeId. The arguments are as follows: tree The tree containing the parent node. parent Node in which the new child will be inserted. name Label of the new node. If name is NULL, a label in the form "node0", "node1", etc. will automatically be generated. Name can be any string. Labels are non-unique. A parent can contain two nodes with the same label. Nodes can be relabeled using Blt_TreeRe- labelNode. position Position the parent's list of children to insert the new node. For example, if position is 0, then the new node is prepended to the beginning of the list. If position is -1, then the node is appended onto the end of the parent's list. RETURNS
The new node returned is of type Blt_TreeNode. It's a token that can be used with other routines to add/delete data values or children nodes. EXAMPLE
The following example creates a new node from the root node. Blt_Tree token; Blt_TreeNode root, node; if (Blt_TreeGetToken(interp, "myTree", &token) != TCL_OK) { return TCL_ERROR; } root = Blt_TreeRootNode(token); node = Blt_TreeCreateNode(token, root, "myNode", -1); NOTIFICATIONS
Blt_TreeCreateNode can trigger tree notify events. You can be notified whenever a node is created by using the Blt_TreeCreateNotifyHan- dler. A callback routine is registered that will be automatically invoked whenever a new node is added via Blt_TreeCreateNode to the tree. KEYWORDS
tree, token BLT
2.4 Blt_TreeCreateNode(3)
Man Page