NAME

XTM::topic - Topic Map management, Topic

SYNOPSIS

use XTM::topic;

my $t = new XTM::topic;
...
print join (",", @{$t->occurrences()});
print "bliss and happiness" if $t->has_instanceOf ('t-billionair');

# now this time I am providing the id myself
my $t2 = new XTM::topic (id => '1234');

# there is also a cheap way to populate the topic with a default
my $t3 = new XTM::topic (id => '1234', populate => \&XTM::topic::default_populate);


# see XTM::generic for more methods

DESCRIPTION

This package provides the primitive class Topic for Topic Maps.

INTERFACE

Constructor

The constructor expects a hash with following (optional) fields:

id:

a topic id (unique in the map in use), if not given, it will be generated

populate:

a code reference to a subroutine populating the topic. There are the following predefined subroutines:

default_populate

This routine expects as first parameter a XTM::topic-blessed object and fills in the PSI topic as 'instanceOf', global scope where appropriate. It also generates in a fairly ad-hoc manner a 'baseName' from the topic id (substituting '-' by ' ').

$t = new XTM::topic ('id' => 'x123');

Methods

occurrences

returns the occurrences of the topic as a list reference. If provided with a CODEREF parameter, this subroutine will be used to filter the occurrences. If provided with a ARRAYREF parameter, this will be used as new value.

map

is an accessor method for the map component.

has_instanceOf

returns true if the topic is a direct subtype of a topic specified as tid for the only parameter.

Example:

print "bliss and happiness" if $t->has_instanceOf ('t-billionair');
canonicalize

This method will simplify the topic by eliminating duplicates as prescribed in F.6.

$t->canonicalize();
connected

returns a list reference of all topic references mentioned in this topic. These references might be 'internal' or 'external' ones.

Example:

foreach (@{$t->connected}) {
  print "$t->id mentions $_\n";
}
xml

returns an XML representation of the topic.

Example: $xmlwriter = new XML::Writer ... ... $t->xml($xmlwriter); # outputs all onto $xmlwriter

SEE ALSO

XTM

AUTHOR INFORMATION

Copyright 200[1-2], Robert Barta <rho@telecoma.net>, All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. http://www.perl.com/perl/misc/Artistic.html

1 POD Error

The following errors were encountered while parsing the POD:

Around line 91:

=back doesn't take any parameters, but you said =back Example: