File: t270oborel_in_owl.t

package info (click to toggle)
libgo-perl 0.15-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,112 kB
  • sloc: perl: 13,147; sh: 21; makefile: 7
file content (63 lines) | stat: -rw-r--r-- 1,563 bytes parent folder | download | duplicates (8)
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
58
59
60
61
62
63
#!/usr/local/bin/perl -w

use lib '.';
use constant NUMTESTS => 4;
BEGIN {
    eval { require Test; };
    use Test;    
    plan tests => NUMTESTS;
}
# All tests must be run from the software directory;
# make sure we are getting the modules from here:
use strict;
use GO::Parser;
eval {
    require "XML/Parser/PerlSAX.pm";
};
if ($@) {
    for (1..NUMTESTS) {
        skip("XML::Parser::PerlSAX not installed",1);
    }
    exit 0;
}
eval {
    require "XML/Writer.pm";
};
if ($@) {
    for (1..NUMTESTS) {
        skip("XML::Writer not installed",1);
    }
    exit 0;
}

# ----- REQUIREMENTS -----

# ------------------------


my $f = './t/data/go-with-local-id-mapping.obo';
my $parser = new GO::Parser ({format=>'obo'
                             });
#                              handler=>'xml'});
$parser->xslt("oboxml_to_owl"); 

$parser->parse($f);
my $owl =  $parser->handler->stag;


# explicitly listed relation, declared to be in relationship
my $part_of = $owl->get('owl:TransitiveProperty');
print $part_of->sxpr;
ok($part_of);

print $part_of->sget('@/rdf:about'). "\n";
ok($part_of->sget('@/rdf:about') eq 'http://purl.org/obo/owl/OBO_REL#part_of');

my ($foo) = $owl->qmatch('owl:ObjectProperty','@/rdf:about','http://purl.org/obo/owl/obo#foo');
print $foo->sxpr;
ok($foo->sget('@/rdf:about') eq 'http://purl.org/obo/owl/obo#foo');

my ($bar) = $owl->where('owl:AnnotationProperty',sub {shift->sget('@/rdf:about') eq 'http://purl.org/obo/owl/obo#bar'});
print $bar->sxpr;
ok($bar->sget('@/rdf:about') eq 'http://purl.org/obo/owl/obo#bar');