Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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 ()
 
 QueryText (string const &syntacticRepr)
 
 operator string () const
 
auto operator<=> (QueryText const &) const =default
 
bool empty () const
 
bool hasAtom (string const &predSymbol)
 
uint degree_of_constriction () const
 synthetic total order to classify query definitions.
 

Friends

HashVal hash_value (QueryText const &entry)
 support using queries in hashtables.
 

Private Member Functions

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

Private Attributes

string definition_
 

Constructor & Destructor Documentation

◆ QueryText() [1/2]

QueryText ( )
inline

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

◆ QueryText() [2/2]

QueryText ( string const &  syntacticRepr)
inline

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

Member Function Documentation

◆ operator string()

operator string ( ) const
inline

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

References QueryText::definition_.

◆ operator<=>()

auto operator<=> ( QueryText const &  ) const
default

◆ empty()

bool empty ( ) const
inline

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

References QueryText::definition_.

◆ hasAtom()

bool hasAtom ( string const &  predSymbol)
inline

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

References util::contains(), and QueryText::definition_.

Referenced by QueryText_test::build_from_string().

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

◆ 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 102 of file query-text.hpp.

References lib::query::countPred(), and QueryText::definition_.

Referenced by QueryKey::degree().

+ 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.

Member Data Documentation

◆ definition_

string definition_
private

Friends And Related Symbol 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.

+ Collaboration diagram for QueryText:

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