NAME
TM - Perl extension for TmTk
SYNOPSIS
use TM;
$tm = TM::TopicMap->new();
$tm->load_file("/opt/maps/mymap.xtm","xtm_simple","xml");
$tm->require("SAM");
$tm->dump();
$t = $tm->get_topic("IS13250::UniqueName","RoleBaseName");
$val = $tm->get_property($t,"IS13250::UniqueName");
DESCRIPTION
TM - Perl extension for TmTk, the Topic Maps Toolkit. TmTk is available at Gooseworks.org [http://www.gooseworks.org].
Creating A Topic Map
$tm = TM::TopicMap->new();
Loading A Topic Map
$tm->load_file("/opt/maps/mymap.xtm","xtm_simple","xml");
Loading a Topic Map Application (TMA)
$tm->require("SAM") or die("cannot load SAM, " . $tm->get_error());
Using the 'topic'-view
$tm = TM::TopicMap->new;
sub topic_start { my ($ud, $name, $href) = @_; #print " start $name\n"; if( $name eq "topic" ) { my $hr = {};
$hr->{topic} = $href->{topic};
$hr->{indicators} = $href->{indicators};
$hr->{names} = [];
$$ud->{last_topic} = $hr;
}
if( $name eq "basename" )
{
push(@{$$ud->{last_topic}->{names}}, $href->{string});
}
}
sub topic_end
{
my ($ud,$name) = @_;
#print " end $name\n";
if( $name eq "topic" )
{
my $hr = $$ud->{last_topic};
print "Topic: $hr->{topic}\n";
foreach(@{$hr->{indicators}})
{
print " $_\n";
}
foreach(@{$hr->{names}})
{
print " $_\n";
}
print "\n\n";
}
}
$tm->query(\$user_data, \&topic_start, \&topic_end, "VIEW topic(topic=200)" );
AUTHOR
Jan Algermissen algermissen@acm.org