NAME
SADI::Utils - what does not fit elsewhere
SYNOPSIS
# load the Utils module
use SADI::Utils;
# find a file located somewhere in @INC
my $file = SADI::Utils->find_file ('resource.file');
# get file from url
$file = SADI::Utils->getHttpRequestByURL('http://sadiframework.org');
# remove leading/trailing whitespace from a string
print SADI::Utils->trim(' http://sadiframework.org ');
DESCRIPTION
General purpose utilities.
AUTHORS
Edward Kawas (edward.kawas [at] gmail [dot] com)
Martin Senger (martin.senger [at] gmail [dot] com)
SUBROUTINES
new
Create a SADI::Utils reference; useless since the methods in this module can be called statically.
find_file
Try to locate a file whose name is created from the $default_start
and all elements of @names
. If it does not exist, try to replace the $default_start
by elements of @INC (one by one). If neither of them points to an existing file, go back and return the $default_start
and all elements of @names
(even - as we know now - such file does not exist).
There are two or more arguments: $default_start
and @names
.
getHttpRequestByURL
returns a scalar of text obtained from the url or dies if there was no success
empty_rdf
returns a string of RDF that represents a syntactically correct RDF file
trim
trims whitespace from the begining and end of a string
LSRNize
Augments LSRN records with ('has attribute' some Class and ('has value' some String))
Input: $class: the LSRN record (an OWL::Data::OWL::Class object), $id: a literal representation of the identifier
Output: $class with the following added to it:
<$class, SIO_000008, Y> <Y, rdf:type, $identifier> <Y, SIO_000300, $id>
This subroutine assumes that it can load the appropriate LSRN record as a Perl module (i.e. you have generated OWL2Perl classes for the LSRN record)
unLSRNize
Extracts the LSRN records literal value from the RDF model
Input: $input: the LSRN record RDF::Core::Resource, $core: a SADI::RDF::Core object
Output: a scalar representing the LSRN records literal value or undef if it did not exist.