NAME
DiaColloDB::Relation::TDF::Query - collocation db, profiling relation: PDL: query hacks
SYNOPSIS
##========================================================================
## PRELIMINARIES
use DiaColloDB::Relation::TDF::Query;
##========================================================================
## Constructors etc.
$vq = CLASS_OR_OBJECT->new(%args);
##========================================================================
## API: compilation
$vq_or_undef = $vq->compile(%opts);
$vq_or_undef = $vq->compileLocal(%opts);
$vq_or_undef = $vq->compileOptions(%opts);
##========================================================================
## Utils: set operations
$vq = $vq->_intersect($vq2);
$vq = $vq->_union($vq2);
##========================================================================
## Wrappers: DDC::XS::Object
$vq = $DDC_XS_OBJECT->__dcvs_compile($vq,%opts);
DESCRIPTION
DiaColloDB::Relation::TDF::Query provides an object-oriented interface for parsing and evaluating queries in DDC syntax with respect to a sparse (term x document) frequency index as represented by a DiaColloDB::Relation::TDF object.
Globals & Constants
- Variable: @ISA
-
DiaColloDB::Relation::TDF::Query inherits from DiaColloDB::Logger.
Constructors etc.
- new
-
$vq = CLASS_OR_OBJECT->new(%args); $vq = CLASS_OR_OBJECT->new($cquery);
Create and return a new tdf-query object from a parsed DDC::XS::CQuery object. %args, %$vq:
cq => $cquery, ##-- underlying DDC::XS::CQuery object ti => $ti_pdl, ##-- pdl ($NTi) : selected term-indices (undef: all) ci => $ci_pdl, ##-- pdl ($NCi) : selected cat-indices (undef: all)
API: compilation
- compile
-
$vq_or_undef = $vq->compile(%opts);
Wraps $vq->compileLocal(). %opts: as for DiaColloDB::profile(), also
coldb => $coldb, ##-- DiaColloDB context (for enums) tdf => $tdf, ##-- DiaColloDB::Relation::TDF context (for meta-enums)
- compileLocal
-
$vq_or_undef = $vq->compileLocal(%opts);
Calls $vq->{cq}->__dcvs_compile($vq,%opts) to compile the query conditions into $vq->{ti} and $vq->{ci}, followed by $vq->compileOptions(). %opts: as for DiaColloDB::profile(), also:
coldb => $coldb, ##-- DiaColloDB context (for enums) tdf => $tdf, ##-- DiaColloDB::Relation::TDF context (for meta-enums)
- compileOptions
-
$vq_or_undef = $vq->compileOptions(%opts);
merges underlying DDC::XS::CQueryOptions restrictions into $vq piddles. %opts: as for the compile() method.
Utils: set operations
- _intersect
-
$vq = $vq->_intersect($vq2);
destructive intersection on component piddles.
- _union
-
$vq = $vq->_union($vq2);
destructive union on component piddles.
Wrappers: DDC::XS::Object
The DiaColloDB::Relation::TDF::Query package extends the DDC::XS::Object subclasses with additional methods for compiling DiaColloDB::Relation::TDF::Query objects from DDC::XS::CQuery and/or DDC::XS::CQFilter objects representing a fully parsed DDC query.
- DDC::XS::Object::__dcvs_compile
-
$vq = $DDC_XS_OBJECT->__dcvs_compile($vq,%opts);
Compiles $DDC_XS_OBJECT (a DDC::XS::Object) into a DiaColloDB::Relation::TDF::Query object $vq. Returns $vq on success, or undef on failure. %opts: as for DiaColloDB::Relation::TDF::Query::compile().
Supported subclasses:
- DDC::XS::Object
-
Fallback method to report errors.
- DDC::XS::CQTokAny
-
Dummy method for universal wildcard queries.
- DDC::XS::CQTokExact
- DDC::XS::CQTokInfl
-
Used for bareword queries, doesn't really support DDC-style re-inflection or term-expansion.
- DDC::XS::CQTokSet
- DDC::XS::CQTokSetInfl
-
Used for set-valued bareword queries, doesn't really support DDC-style re-inflection or term-expansion.
- DDC::XS::CQTokRegex
- DDC::XS::CQTokPrefix
- DDC::XS::CQTokSuffix
- DDC::XS::CQTokInfix
- DDC::XS::CQTokPrefixSet
- DDC::XS::CQTokSuffixSet
- DDC::XS::CQTokInfixSet
- DDC::XS::CQTokLemma
-
Used for %LEMMA lemma queries, doesn't really support DDC-style re-inflection or term-expansion.
- DDC::XS::CQWith
- DDC::XS::CQWithout
- DDC::XS::CQAnd
-
Boolean conjunction operator evaluates to union of sub-query term-targets and the intersection of the sub-query category-targets, restricted to the corresponding term-teargets, so a query (A && B) behaves as a sparse matrix mapping each document
d
in any categoryc
containing bothA
andB
tof(A,d)+f(B,d)
.TODO: make this restriction actually work on document (signature) level rather than category level, for better resolution.
- DDC::XS::CQOr
- DDC::XS::CQFHasFieldValue
- DDC::XS::CQFHasFieldRegex
- DDC::XS::CQueryOptions
-
Dispatch methods compiles filters.
AUTHOR
Bryan Jurish <moocow@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2015-2016 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
SEE ALSO
DDC::XS::CQuery(3pm), DiaColloDB::Relation::TDF(3pm), DiaColloDB(3pm), perl(1), ...