Biblio::Thesaurus::ModRewrite - a module to manipulate ontologies
Version 0.02
use Biblio::Thesaurus; use Biblio::Thesaurus::ModRewrite; my $code = "Lisbon 'city-of' Portugal => add (Lisbon 'city-of' Europe)."; $thesaurus = thesaurusLoad($file); $obj = Biblio::Thesaurus::ModRewrite->new($thesaurus); $obj->process($code);
This module implements a compiler to run programs written in a domain specific language that can be used to manipulate information in ontologies. This domain specific language is called OML and is descibed in the next section.
OML is a domain specific language that can be used to describe operations that manipulate information in a ontology. Programs written in OML are a set of rules that are executed in order, each rule looks something like:
pattern => action .
Which means that when the pattern is found the given action block is executed.
pattern
action
Patterns describe information in the ontology. A pattern can be used to represent terms, relations, relations between terms, or any combination of any of these.
The action block is used to describe the operations that are going to be executed if a given pattern is found.
This function creates a new object and stores the source file for the thesaurus given as argument.
This funcion processes source code written in OML. This and new should be the only functions you need to call to use this module.
new
This function parses the source code and builds a parsing tree. The parser is defined in the Biblio::Thesaurus::ModRewrite::Parser module.
This function calculates the solution node for every pattern in the parsing tree.
This funcion calculates the solution for a given pattern.
This function is used by calc_set and should not be called on it's own.
calc_set
This function executes every action for each rule in an OML program.
This function is used to execute an action.
Look in the examples and bin directory for sample programs.
Nuno Carvalho, <smash@cpan.org>
<smash@cpan.org>
J.Joao Almeida, <jj@di.uminho.pt>
<jj@di.uminho.pt>
Alberto Simoes, <albie@alfarrabio.di.uminho.pt>
<albie@alfarrabio.di.uminho.pt>
Copyright 2008 Nuno Carvalho, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Biblio::Thesaurus::ModRewrite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Biblio::Thesaurus::ModRewrite
CPAN shell
perl -MCPAN -e shell install Biblio::Thesaurus::ModRewrite
For more information on module installation, please visit the detailed CPAN module installation guide.