NAME
OWL::Simple::Parser
SYNOPSIS
use OWL::Simple::Parser;
# load Experimental Factor Ontology (http://www.ebi.ac.uk/efo/efo.owl)
my $parser = OWL::Simple::Parser->new( owlfile => 'efo.owl',
synonym_tag => 'efo:alternative_term',
definition_tag => 'efo:definition' );
# parse file
$parser->parse();
# iterate through all the classes
for my $id (keys %{ $parser->class }){
my $OWLClass = $parser->class->{$id};
print $id . ' ' . $OWLClass->label . "\n";
# list synonyms
for my $syn (@{ $OWLClass->synonyms }){
print "\tsynonym - $syn\n";
}
# list definitions
for my $def (@{ $OWLClass->definitions }){
print "\tdef - $def\n";
}
# list parents
for my $parent (@{ $OWLClass->subClassOf }){
print "\tsubClassOf - $parent\n";
}
}
DESCRIPTION
A simple OWL parser loading accessions, labels and synonyms and exposes them as a collection of OWL::Simple::Class objects.
This module wraps XML::Parser, which is a sequential event-driven XML parser that can potentially handle very large XML documents. The whole XML structure is never loaded into memory completely, only the bits of interest.
In the constructor specify the owlfile to be loaded and two optional tags - synonym_tag or definition_tag that define custom annotations in the ontology for synonyms and definitions respectively. Note both tags have to be fully specified exactly as in the OWL XML to be loaded, e.g. FULL_SYN for NCI Thesaurus or efo:alternative_term for EFO.
METHODS
- class_count()
-
Number of classes loaded by the parser.
- synonyms_count()
-
Number of synonyms loaded by the parser.
- version()
-
Version of the ontology extracted from the owl:versionInfo.
- class
-
Hash collection of all the OWL::Simple::Class objects
AUTHOR
Tomasz Adamusiak <tomasz@cpan.org>
COPYRIGHT AND LICENSE
Copyright (c) 2010-2011 European Bioinformatics Institute. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under lGPLv3.
This software is provided "as is" without warranty of any kind.