Rechercher une page de manuel
TM::QL.3pm
Langue: en
Version: 2008-06-12 (debian - 07/07/09)
Section: 3 (Bibliothèques de fonctions)
NAME
TM::QL - Topic Maps, Query Language ExpressionsSYNOPSIS
use TM::QL; # compile a TMQL query (here path expression style) my $q = new TM::QL ('// hypocrite [ . <- employee -> organisation == $org ]');
use TM; my $tm = new TM (....); # get a map from somewhere
my $or = $tm->mids ('vagabond-university'); # find internal id my $ts = $q->eval ('%_' => $tm, # explicitly pass in a default map '$o' => $or); # and any number of other variable bindings
foreach my $tuple (@$ts) { # iterate through the tuple sequence foreach my $value (@$tuple) { # do something with the tuple print ref ($value) ? $value->[0] # literal : $value # internal map identifier } }
DESCRIPTION
This class implements TMQL expression handling. A TMQL expression can be parsed, stored in an object, optimized and then evaluated. The results of this process is a tuple sequence as described inhttp://topicmaps.it.bond.edu.au/junk/tmql.html
NOTE: This is work in progress, so there might be discrepancies.
Constructor
Given a TMQL query expression, this constructor will build a compiled version of the query, which then can be executed with the method "eval".
If an already compiled is passed as parameter, the constructor behaves as a cloner. (Note: no deep copy of the compiled query).
Methods
- eval
- Given a query object, this method will evaluate it according to the TMQL semantics. The result is a tuple sequence (TM::QL::TS).
Optionally, a hash reference can be passed into this method. It will be used as variable binding.
AUTHOR
Robert Barta, <drrho@cpan.org>COPYRIGHT AND LICENSE
Copyright (C) 200[4-6] by Robert BartaThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre