CQL::Relation - object for CQL Relations


CQL-Parser documentation Contained in the CQL-Parser distribution.

Index


Code Index:

NAME

Top

CQL::Relation - object for CQL Relations

SYNOPSIS

Top

DESCRIPTION

Top

CQL::Relation represents the common CQL relation operations ( =, >, <, any, all and exact. In addition modifiers may be applied (stem, relevant, fuzzy, phonetic). The operators are passed into the constructor as the base relation.

METHODS

Top

new()

Creates a new CQL::Relation object with the specified base relation.

getBase()

Returns the base relation with which the CQL::Relation object was originally created.

addModifier()

Adds a new relation modifier to the specified CQLRelation. Typical relation modifiers include relevant, fuzzy stem and phonetic. On the whole, these modifiers have a meaningful interpretation only for the text relations.

getModifiers()

Returns a list of modifiers associated with a CQL relation.

toCQL()

toSwish()

toXCQL()

toLucene()


CQL-Parser documentation Contained in the CQL-Parser distribution.
package CQL::Relation;

use strict;
use warnings;
use Class::Accessor;
use CQL::ModifierSet;
use base qw( CQL::Node );

sub new {
    my ($class,$base) = @_;
    my $ms = CQL::ModifierSet->new( $base );
    return bless { modifierSet => $ms }, ref($class) || $class;
}

sub getBase {
    return shift->{modifierSet}->getBase();
}

sub addModifier {
    my ($self,$modifier) = @_;
    $self->{modifierSet}->addModifier( undef, $modifier );
}

sub getModifiers {
    return shift->{modifierSet}->getModifiers();
}

sub toCQL {
    return shift->{modifierSet}->toCQL();
}

sub toSwish {
    return shift->{modifierSet}->toSwish();
}

sub toXCQL {
    my ($self,$level) = @_;
    my $xml = $self->{modifierSet}->toXCQL( $level, "relation" );
    return $self->addNamespace( $level, $xml );
}

sub toLucene {
    return shift->{modifierSet}->toLucene();
}

1;