Lumiera  0.pre.03
»edit your freedom«
QueryText Class Reference

#include "lib/query-text.hpp"

Description

Syntactical query representation.

Used as a backbone to allow for generic queries and to enable programmatically rebuilding and remolding of queries.

Todo:
this is placeholder code and just embeds a string with the raw query definition, instead of parsing the definition and transforming it into an AST
See also
Query

Definition at line 61 of file query-text.hpp.

Public Member Functions

 QueryText (string const &syntacticRepr)
 
uint degree_of_constriction () const
 synthetic total order to classify query definitions. More...
 
bool empty () const
 
bool hasAtom (string const &predSymbol)
 
 operator string () const
 

Friends

HashVal hash_value (QueryText const &entry)
 support using queries in hashtables. More...
 
bool operator< (QueryText const &q1, QueryText const &q2)
 
bool operator== (QueryText const &q1, QueryText const &q2)
 

Private Member Functions

string normalise (string const &rawDefinition)
 Parse, verify and normalise the raw query definition. More...
 

Private Attributes

string definition_
 

Member Function Documentation

◆ degree_of_constriction()

uint degree_of_constriction ( ) const
inline

synthetic total order to classify query definitions.

Queries with more specific conditions should yield larger values.

Warning
this is rather a design idea and it's not clear if this metric can be made to work in practice
Todo:
using a rather deaf placeholder implementation based just on counting the top level predicates.

Definition at line 101 of file query-text.hpp.

References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), QueryText::hash_value, and QueryText::normalise().

Referenced by QueryKey::QueryKey().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalise()

string normalise ( string const &  rawDefinition)
private

Parse, verify and normalise the raw query definition.

Warning
right now (2012) we don't normalise at all
Todo:
when integrating a real resolution engine, we need to parse and verify the given string.

Definition at line 37 of file query-text.cpp.

Referenced by QueryText::degree_of_constriction().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ hash_value

HashVal hash_value ( QueryText const &  entry)
friend

support using queries in hashtables.

Warning
right now (2012) the dummy implementation of QueryText doesn't normalise the query in any way, which makes the generated hash value dependent on the actual textual form used to build the QueryText. This is not how it's intended to work, it should rely on a normalised form after parsing the query definition.

Definition at line 52 of file query-text.cpp.

Referenced by QueryText::degree_of_constriction().

+ Collaboration diagram for QueryText:

The documentation for this class was generated from the following files: