The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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);


  # 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
  $t = new XTM::topic ('id' => '#123');

Methods

occurrences

returns the occurrences of the topic as a list reference. If provided with a parameter, this value will be used as new occurrences list reference (no validation will happen).

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');
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 2001, 2002, 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