File: 08_tmdm.pl

package info (click to toggle)
libtm-perl 1.56-7
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,692 kB
  • ctags: 1,084
  • sloc: perl: 35,266; makefile: 48
file content (57 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download | duplicates (5)
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
use Data::Dumper;

use TM::Materialized::AsTMa;
my $tm = new TM::Materialized::AsTMa (inline => '
sacklpicka (cat)
bn: Der Sacklpicka
bn (nickname): Sleeping Devil
sin: http://kill.devc.at/system/files/aad.small.jpg

rho (person)
oc (blog): http://kill.devc.at/

(owns)
owner: rho
owned: sacklpicka
')->sync_in;

use TM::DM;
my $tmdm = new TM::DM (map => $tm);

my $topicmap = $tmdm->topicmap;

my @ts = $topicmap->topics (\ '+all -infrastructure');

warn join "," , (map { $_->id } @ts);

#my $sp = $topicmap->topic ('sacklpicka');
#my $sp = $topicmap->topic ('tm://nirvana/sacklpicka');
my $sp = $topicmap->topic (\ 'http://kill.devc.at/system/files/aad.small.jpg');
warn $sp->id;
foreach my $n ($sp->names) {
   next if $n->type->id eq 'tm://nirvana/nickname';
   warn $n->value;
}

my $rho = $topicmap->topic ('rho');
foreach my $o ($rho->occurrences) {
   warn $o->value->[0];
}

foreach my $r ( $rho->roles ) {
   warn "player: ".$r->player->id;
   warn " for role: ".$r->type->id;
}

my @as = $topicmap->associations (iplayer => 'rho');

foreach my $a (@as) {
   warn $a->type->id;
   warn $a->scope->id;
   warn map { $_->type->id } $a->roles;
}


__END__