| 1 | #!/usr/local/bin/perl -w |
| 2 | |
| 3 | use libscip-perl cpan go-perl 0.15 lib/ '.'; |
| 4 | use constantscip-perl cpan go-perl 0.15 constant/ NUMTESTSscip-perl cpan go-perl 0.15 main/NUMTESTS(). => 4; |
| 5 | BEGIN { |
| 6 | eval { requirescip-perl cpan go-perl 0.15 main/require(). Test; }; |
| 7 | use Testscip-perl cpan go-perl 0.15 Test/; |
| 8 | planscip-perl cpan go-perl 0.15 main/plan(). tests => NUMTESTS; |
| 9 | } |
| 10 | # All tests must be run from the software directory; |
| 11 | # make sure we are getting the modules from here: |
| 12 | use strictscip-perl cpan go-perl 0.15 strict/; |
| 13 | use GO::Parserscip-perl cpan go-perl 0.15 GO/Parser/; |
| 14 | eval { |
| 15 | requirescip-perl cpan go-perl 0.15 main/require(). "XML/Parser/PerlSAX.pm"; |
| 16 | }; |
| 17 | if ($@scip-perl cpan go-perl 0.15 main/`$@`.) { |
| 18 | for (1..NUMTESTS) { |
| 19 | skipscip-perl cpan go-perl 0.15 main/skip().("XML::Parser::PerlSAX not installed",1); |
| 20 | } |
| 21 | exitscip-perl cpan go-perl 0.15 main/exit(). 0; |
| 22 | } |
| 23 | eval { |
| 24 | requirescip-perl cpan go-perl 0.15 main/require(). "XML/Writer.pm"; |
| 25 | }; |
| 26 | if ($@scip-perl cpan go-perl 0.15 main/`$@`.) { |
| 27 | for (1..NUMTESTS) { |
| 28 | skipscip-perl cpan go-perl 0.15 main/skip().("XML::Writer not installed",1); |
| 29 | } |
| 30 | exitscip-perl cpan go-perl 0.15 main/exit(). 0; |
| 31 | } |
| 32 | |
| 33 | # ----- REQUIREMENTS ----- |
| 34 | |
| 35 | # ------------------------ |
| 36 | |
| 37 | |
| 38 | my $f = './t/data/go-with-local-id-mapping.obo'; |
| 39 | my $parser = new GO::Parser ({format=>'obo' |
| 40 | }); |
| 41 | # handler=>'xml'}); |
| 42 | $parser->xsltscip-perl cpan go-perl 0.15 main/xslt().("oboxml_to_owl"); |
| 43 | |
| 44 | $parsescip-perl cpan go-perl 0.15 main/parse().r->parse($f); |
| 45 | my $owl = $parser->handlerscip-perl cpan go-perl 0.15 main/handler().->stagscip-perl cpan go-perl 0.15 main/stag().; |
| 46 | |
| 47 | |
| 48 | # explicitly listed relation, declared to be in relationship |
| 49 | my $part_of = $owl->getscip-perl cpan go-perl 0.15 main/get().('owl:TransitiveProperty'); |
| 50 | printscip-perl cpan go-perl 0.15 main/print(). $part_of->sxprscip-perl cpan go-perl 0.15 main/sxpr().; |
| 51 | okscip-perl cpan go-perl 0.15 main/ok().($part_of); |
| 52 | |
| 53 | printscip-perl cpan go-perl 0.15 main/print(). $part_of->sgetscip-perl cpan go-perl 0.15 main/sget().('@/rdf:about'). "\n"; |
| 54 | okscip-perl cpan go-perl 0.15 main/ok().($part_of->sgetscip-perl cpan go-perl 0.15 main/sget().('@/rdf:about') eq 'http://purl.org/obo/owl/OBO_REL#part_of'); |
| 55 | |
| 56 | my ($foo) = $owl->qmatchscip-perl cpan go-perl 0.15 main/qmatch().('owl:ObjectProperty','@/rdf:about','http://purl.org/obo/owl/obo#foo'); |
| 57 | printscip-perl cpan go-perl 0.15 main/print(). $foo->sxprscip-perl cpan go-perl 0.15 main/sxpr().; |
| 58 | okscip-perl cpan go-perl 0.15 main/ok().($foo->sgetscip-perl cpan go-perl 0.15 main/sget().('@/rdf:about') eq 'http://purl.org/obo/owl/obo#foo'); |
| 59 | |
| 60 | my ($bar) = $owl->wherescip-perl cpan go-perl 0.15 main/where().('owl:AnnotationProperty',sub {shift->sgetscip-perl cpan go-perl 0.15 shift/sget().('@/rdf:about') eq 'http://purl.org/obo/owl/obo#bar'}); |
| 61 | printscip-perl cpan go-perl 0.15 main/print(). $bar->sxprscip-perl cpan go-perl 0.15 main/sxpr().; |
| 62 | okscip-perl cpan go-perl 0.15 main/ok().($bar->sgetscip-perl cpan go-perl 0.15 main/sget().('@/rdf:about') eq 'http://purl.org/obo/owl/obo#bar'); |
| 63 |