ddc
|
Truly abstract (index-independent) representation of a parsed query Should eventually replace old ad-hoc QueryNode.h. More...
#include <Query.h>
Public Member Functions | |
Constructors etc. | |
CQuery (const string &label=string("")) | |
Default constructor. More... | |
virtual | ~CQuery (void) |
API | |
virtual bool | CheckSatisfiable (CQueryCompiler *compiler) |
virtual bool | Compile (CQueryCompiler *compiler) |
virtual bool | CompileOptions (CQueryCompiler *compiler=NULL) |
virtual void | Evaluate () |
virtual bool | Negated () |
For sanity checks. Default just returns false. More... | |
virtual bool | Negate () |
Toggle negation flag, returns new value. Default throws an exception. More... | |
virtual BYTE | GetMatchId () const |
Get current match-id (should return a nontrivial match-id if any was used, else 0; default just returns 0) More... | |
virtual BYTE | SetMatchId (BYTE matchId) |
Set match-id, returns new value. Default throws an exception. More... | |
virtual bool | HasMatchId () const |
Returns true iff this query uses a nontrival match-id operator; default checks (this->GetMatchId() != 0) More... | |
virtual bool | RootOK () |
Is this query an admissible root of a compiled parse tree (default returns !this->Negated()) More... | |
Object Substructure (ddcObject API) | |
virtual ddcObjectList | Children () const |
virtual void | DisownChildren () |
Stringification (ddcObject API & associated utilities) | |
virtual string | toString () |
DEBUG: return a canonical string form for this query (default just returns m_Label) More... | |
virtual string | optionsToString () |
DEBUG: return canonical option string More... | |
virtual string | optionsToJson () |
return json format option string More... | |
virtual string | toJson () |
virtual string | jsonClass () |
virtual string | jsonData () |
Misc Utilities | |
void | SetCompiler (CQueryCompiler *compiler) |
virtual void | ClearNode () |
deletes m_Node if non-NULL More... | |
virtual void | ClearOptions () |
deletes m_Options if non-NULL More... | |
virtual void | Clear (bool deep=true) |
clear query contents. if deep is true, propagates operation to daughters More... | |
virtual void | SetOptions (CQueryOptions *opts) |
set global query options ; deletes any pre-existing m_Options More... | |
Public Member Functions inherited from ddcObject | |
ddcObject () | |
Default constructor. More... | |
virtual | ~ddcObject () |
virtual destructor does nothing More... | |
template<typename Visit > | |
ddcObject * | Traverse (Visit &visit) |
template<typename Visit > | |
ddcObject * | Traverse (Visit &visit) const |
template<typename Visit > | |
ddcObject * | TraverseR (Visit &visit) |
template<typename Visit > | |
ddcObject * | TraverseR (Visit &visit) const |
virtual ddcObjectList | Descendants () const |
Public Attributes | |
string | m_Label |
arbitrary name for this query node (e.g. string from which it was parsed) More... | |
CQueryCompiler * | m_Compiler |
associated query compiler (only set on Compile()) More... | |
CQueryNode * | m_Node |
underlying CQueryNode (DDC-v1.x API) More... | |
CQueryOptions * | m_Options |
root-level options (root queries only) More... | |
Public Attributes inherited from ddcObject | |
void * | m_User |
user data associated with this object (for use e.g. by perl wrappers) More... | |
Truly abstract (index-independent) representation of a parsed query Should eventually replace old ad-hoc QueryNode.h.
|
inline |
Default constructor.
|
virtual |
Default destructor.
References Clear().
|
virtual |
Run fast (un)satisfiability checks for query before Compile() is called.
Reimplemented in CQCount.
References CQueryOptions::CheckSatisfiable(), and m_Options.
Referenced by CQueryCompiler::CheckSatisfiable(), and CQCount::CheckSatisfiable().
|
virtual |
Compile index-dependent query properties (required for evaluation). Required.
Reimplemented in CQSeq, CQNear, CQKeys, CQToken, CQCount, CQWithor, CQWithout, CQWith, CQCountKeyExprList, CQOr, CQAnd, CQCountKeyExprToken, CQBinOp, CQCountKeyExprRegex, CQCountKeyExprBibl, CQNegatable, CQCountKeyExprDateSlice, CQCountKeyExprDate, CQCountKeyExprIndexed, and CQCountKeyExpr.
References errParseError.
Referenced by CQueryCompiler::Compile(), CQSeq::Compile(), CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), CQNegatable::Negated(), CQAnd::RootOK(), CQOr::RootOK(), CQToken::~CQToken(), CQWith::~CQWith(), CQWithor::~CQWithor(), and CQWithout::~CQWithout().
|
virtual |
Compile index-dependent options in m_Options. Optional.
References CQueryOptions::Compile(), m_Compiler, and m_Options.
Referenced by CQueryCompiler::Compile(), and CQueryCompiler::CompileFilters().
|
virtual |
Wrapper for m_Node->Evaluate()
Reimplemented in CQKeys, and CQCount.
References CQueryNode::Evaluate(), CQueryOptions::m_bSeparateHits, m_Node, and m_Options.
Referenced by CQueryCompiler::Evaluate().
|
inlinevirtual |
For sanity checks. Default just returns false.
Reimplemented in CQNegatable.
References GetMatchId(), HasMatchId(), Negate(), and SetMatchId().
Referenced by Negate(), and RootOK().
|
virtual |
Toggle negation flag, returns new value. Default throws an exception.
Reimplemented in CQNegatable.
References errParseError, Negated(), and toString().
Referenced by Negated(), and CQNegatable::~CQNegatable().
|
virtual |
Get current match-id (should return a nontrivial match-id if any was used, else 0; default just returns 0)
Reimplemented in CQSeq, CQNear, CQKeys, CQToken, CQCount, CQWith, CQCountKeyExprList, CQCountKeyExprToken, and CQBinOp.
Referenced by CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), HasMatchId(), Negated(), CQToken::~CQToken(), and CQWith::~CQWith().
Set match-id, returns new value. Default throws an exception.
Reimplemented in CQSeq, CQNear, CQKeys, CQToken, CQWith, CQCountKeyExprToken, and CQBinOp.
References errParseError, and toString().
Referenced by CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), Negated(), CQToken::~CQToken(), and CQWith::~CQWith().
|
virtual |
Returns true iff this query uses a nontrival match-id operator; default checks (this->GetMatchId() != 0)
References GetMatchId().
Referenced by Negated().
|
inlinevirtual |
Is this query an admissible root of a compiled parse tree (default returns !this->Negated())
Reimplemented in CQOr, and CQAnd.
References Children(), DisownChildren(), m_Label, Negated(), optionsToJson(), optionsToString(), and toString().
Referenced by CQueryCompiler::Compile().
|
virtual |
get a list of direct non-NULL CQuery direct daughters of this node
Reimplemented from ddcObject.
Reimplemented in CQSeq, CQNear, CQKeys, CQCount, CQCountKeyExprList, CQBinOp, and CQCountKeyExprRegex.
References m_Options.
Referenced by CQCountKeyExprRegex::Children(), CQBinOp::Children(), CQCountKeyExprList::Children(), CQCount::Children(), CQKeys::Children(), CQNear::Children(), CQSeq::Children(), CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), and RootOK().
|
virtual |
"disown" any direct child nodes, preventing their destruction if the current object is deleted
Reimplemented from ddcObject.
Reimplemented in CQSeq, CQNear, CQKeys, CQCount, CQCountKeyExprList, CQBinOp, and CQCountKeyExprRegex.
References m_Options.
Referenced by CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), CQCountKeyExprRegex::DisownChildren(), CQBinOp::DisownChildren(), CQCountKeyExprList::DisownChildren(), CQCount::DisownChildren(), CQKeys::DisownChildren(), CQNear::DisownChildren(), CQSeq::DisownChildren(), and RootOK().
|
inlinevirtual |
DEBUG: return a canonical string form for this query (default just returns m_Label)
Reimplemented from ddcObject.
Reimplemented in CQSeq, CQNear, CQKeys, CQToken, CQCount, CQWith, CQCountKeyExprList, CQCountKeyExprToken, CQBinOp, CQCountKeyExprRegex, CQCountKeyExprBibl, CQCountKeyExprDateSlice, CQCountKeyExprConstant, and CQCountKeyExpr.
Referenced by CQueryCompiler::Compile(), CQBinOp::Compile(), CQAnd::Compile(), CQOr::Compile(), CQWith::Compile(), CQWithout::Compile(), CQWithor::Compile(), CQToken::Compile(), CQNear::Compile(), CQSeq::Compile(), CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), CQTokMorph::Create(), CQTokThes::Create(), CQTokChunk::Create(), CQTokFile::Create(), CQTokInfl::GetChain(), CConcSession::GetHits(), CQWith::jsonClass(), Negate(), CQToken::OperatorKey(), CQueryCompiler::QueryToString(), RootOK(), and SetMatchId().
|
virtual |
DEBUG: return canonical option string
References m_Options, and CQueryOptions::toString().
Referenced by CConcSession::GetHits(), CQueryCompiler::QueryToString(), and RootOK().
|
virtual |
return json format option string
References m_Options, and ddcObject::toJson().
Referenced by CQueryCompiler::QueryToJson(), and RootOK().
|
inlinevirtual |
return a JSON representation of this query
Reimplemented from ddcObject.
References jsonClass(), jsonData(), and jsonStr().
Referenced by CQFPrune::jsonData(), and CQueryCompiler::QueryToJson().
|
inlinevirtual |
class-name for json strinfication
Reimplemented from ddcObject.
Reimplemented in CQSeq, CQNear, CQTokFile, CQTokChunk, CQTokThes, CQTokLemma, CQTokMorph, CQTokInfixSet, CQTokSuffixSet, CQTokPrefixSet, CQTokInfix, CQTokSuffix, CQTokPrefix, CQTokSetInfl, CQTokInfl, CQTokSet, CQTokRegex, CQKeys, CQTokAnchor, CQTokAny, CQTokExact, CQToken, CQCount, CQWithor, CQWithout, CQWith, CQCountKeyExprList, CQOr, CQAndImplicit, CQAnd, CQCountKeyExprToken, CQBinOp, CQCountKeyExprRegex, CQAtomic, CQCountKeyExprBibl, CQNegatable, CQCountKeyExprDateSlice, CQCountKeyExprDate, CQCountKeyExprFileName, CQCountKeyExprIndexed, CQCountKeyExprFileId, CQCountKeyExprConstant, and CQCountKeyExpr.
Referenced by toJson().
|
inlinevirtual |
instance data for json stringification
Reimplemented from ddcObject.
Reimplemented in CQSeq, CQNear, CQTokInfl, CQKeys, CQToken, CQCount, CQWith, CQCountKeyExprList, CQCountKeyExprToken, CQBinOp, CQCountKeyExprRegex, CQNegatable, CQCountKeyExprDateSlice, and CQCountKeyExpr.
References Clear(), ClearNode(), ClearOptions(), SetCompiler(), and SetOptions().
Referenced by CQBinOp::jsonClass(), CQWith::jsonClass(), CQToken::jsonClass(), CQNear::jsonClass(), CQSeq::jsonClass(), CQTokInfl::jsonValue(), and toJson().
void CQuery::SetCompiler | ( | CQueryCompiler * | compiler | ) |
References ClearNode(), and m_Compiler.
Referenced by CQBinOp::Compile(), CQToken::Compile(), CQNear::Compile(), CQSeq::Compile(), and jsonData().
|
virtual |
deletes m_Node if non-NULL
Reimplemented in CQSeq, CQNear, CQKeys, CQCount, and CQBinOp.
References m_Node.
Referenced by Clear(), CQBinOp::Clear(), CQNear::Clear(), CQSeq::Clear(), CQBinOp::ClearNode(), CQCount::ClearNode(), CQKeys::ClearNode(), CQNear::ClearNode(), CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), jsonData(), and SetCompiler().
|
virtual |
deletes m_Options if non-NULL
References m_Options.
Referenced by Clear(), CQBinOp::Clear(), CQNear::Clear(), CQSeq::Clear(), and jsonData().
|
virtual |
clear query contents. if deep
is true, propagates operation to daughters
Reimplemented in CQSeq, CQNear, CQKeys, CQCount, and CQBinOp.
References ClearNode(), and ClearOptions().
Referenced by CQBinOp::CQBinOp(), CQNear::CQNear(), CQSeq::CQSeq(), jsonData(), CQBinOp::~CQBinOp(), CQNear::~CQNear(), CQSeq::~CQSeq(), and ~CQuery().
|
virtual |
set global query options ; deletes any pre-existing m_Options
References m_Options.
Referenced by jsonData(), and CQueryCompiler::SetQuery().
string CQuery::m_Label |
arbitrary name for this query node (e.g. string from which it was parsed)
Referenced by RootOK().
CQueryCompiler* CQuery::m_Compiler |
associated query compiler (only set on Compile())
Referenced by CQToken::BreakName(), CompileOptions(), CQToken::Create(), CQTokAny::Create(), CQTokAnchor::Create(), CQTokRegex::Create(), CQTokSet::Create(), CQTokInfl::Create(), CQTokSetInfl::Create(), CQTokPrefix::Create(), CQTokSuffix::Create(), CQTokInfix::Create(), CQTokPrefixSet::Create(), CQTokSuffixSet::Create(), CQTokInfixSet::Create(), CQTokMorph::Create(), CQTokLemma::Create(), CQTokThes::Create(), CQTokChunk::Create(), CQTokFile::Create(), CQueryCompiler::Evaluate(), CQTokInfl::GetChain(), CConcSession::GetHits(), CQToken::IndexName(), CQFPrune::PruneHitsIndex(), and SetCompiler().
CQueryNode* CQuery::m_Node |
underlying CQueryNode (DDC-v1.x API)
Referenced by ClearNode(), CQBinOp::ClearNode(), CQNear::ClearNode(), CQSeq::ClearNode(), CQNegatable::Compile(), CQAnd::Compile(), CQOr::Compile(), CQWith::Compile(), CQWithout::Compile(), CQWithor::Compile(), CQToken::Compile(), CQNear::Compile(), CQSeq::Compile(), Evaluate(), CConcSession::GetAllHits(), CConcSession::InitSortByContext(), CConcSession::InitSortByRandom(), CConcSession::InitSortByRank(), CConcSession::InitSortBySize(), CConcSession::InitSortKeyForHits(), and CQFPrune::PruneHitsIndex().
CQueryOptions* CQuery::m_Options |
root-level options (root queries only)
Referenced by CheckSatisfiable(), Children(), ClearOptions(), CompileOptions(), CQCount::CountLocal(), CQCount::CountUniversal(), DisownChildren(), Evaluate(), CConcSession::GetAllHits(), CConcSession::InitSortByRank(), optionsToJson(), optionsToString(), and SetOptions().