souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Protected Attributes
souffle::ram::Query Class Reference

A relational algebra query. More...

#include <Query.h>

Inheritance diagram for souffle::ram::Query:
Inheritance graph
Collaboration diagram for souffle::ram::Query:
Collaboration graph

Public Member Functions

void apply (const NodeMapper &map) override
 Apply the mapper to all child nodes. More...
 
Queryclone () const override
 Create a clone (i.e. More...
 
std::vector< const Node * > getChildNodes () const override
 Obtain list of all embedded child nodes. More...
 
const OperationgetOperation () const
 Get RAM operation. More...
 
 Query (Own< Operation > o)
 
- Public Member Functions inherited from souffle::ram::Node
bool operator!= (const Node &other) const
 Inequality check for two RAM nodes. More...
 
bool operator== (const Node &other) const
 Equivalence check for two RAM nodes. More...
 
virtual void rewrite (const Node *oldNode, Own< Node > newNode)
 Rewrite a child node. More...
 
virtual ~Node ()=default
 

Protected Member Functions

bool equal (const Node &node) const override
 Equality check for two RAM nodes. More...
 
void print (std::ostream &os, int tabpos) const override
 Pretty print with indentation. More...
 
- Protected Member Functions inherited from souffle::ram::Statement
void print (std::ostream &os) const override
 Print RAM node. More...
 

Protected Attributes

Own< Operationoperation
 RAM operation. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from souffle::ram::Statement
static void print (const Statement *statement, std::ostream &os, int tabpos)
 Pretty print jump-bed. More...
 

Detailed Description

A relational algebra query.

Corresponds to the core machinery of semi-naive evaluation

For example:

QUERY
FOR t0 in A
FOR t1 in B
...

Definition at line 50 of file Query.h.

Constructor & Destructor Documentation

◆ Query()

souffle::ram::Query::Query ( Own< Operation o)
inline

Definition at line 52 of file Query.h.

53  {
54  return *operation;

References operation.

Referenced by getChildNodes().

Member Function Documentation

◆ apply()

void souffle::ram::Query::apply ( const NodeMapper )
inlineoverridevirtual

Apply the mapper to all child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 69 of file Query.h.

69  :
70  void print(std::ostream& os, int tabpos) const override {
71  os << times(" ", tabpos) << "QUERY" << std::endl;

References operation, and souffle::times().

Here is the call graph for this function:

◆ clone()

Query* souffle::ram::Query::clone ( ) const
inlineoverridevirtual

Create a clone (i.e.

deep copy) of this node

Implements souffle::ram::Statement.

Definition at line 65 of file Query.h.

65  {
66  operation = map(std::move(operation));
67  }

References souffle::map(), and operation.

Here is the call graph for this function:

◆ equal()

bool souffle::ram::Query::equal ( const Node ) const
inlineoverrideprotectedvirtual

Equality check for two RAM nodes.

Default action is that nothing needs to be checked.

Reimplemented from souffle::ram::Node.

Definition at line 79 of file Query.h.

◆ getChildNodes()

std::vector<const Node*> souffle::ram::Query::getChildNodes ( ) const
inlineoverridevirtual

Obtain list of all embedded child nodes.

Reimplemented from souffle::ram::Node.

Definition at line 61 of file Query.h.

61  {
62  return new Query(souffle::clone(operation));
63  }

References souffle::clone(), operation, and Query().

Here is the call graph for this function:

◆ getOperation()

const Operation& souffle::ram::Query::getOperation ( ) const
inline

Get RAM operation.

Definition at line 57 of file Query.h.

57  {
58  return {operation.get()};
59  }

References operation.

Referenced by souffle::ram::transform::HoistAggregateTransformer::hoistAggregate().

◆ print()

void souffle::ram::Query::print ( std::ostream &  os,
int  tabpos 
) const
inlineoverrideprotectedvirtual

Pretty print with indentation.

Implements souffle::ram::Statement.

Definition at line 74 of file Query.h.

75  {
76  const auto& other = static_cast<const Query&>(node);
77  return equal_ptr(operation, other.operation);

References souffle::equal_ptr(), and operation.

Here is the call graph for this function:

Field Documentation

◆ operation

Own<Operation> souffle::ram::Query::operation
protected

RAM operation.

Definition at line 85 of file Query.h.

Referenced by apply(), clone(), getChildNodes(), getOperation(), print(), and Query().


The documentation for this class was generated from the following file:
souffle::ram::Query::Query
Query(Own< Operation > o)
Definition: Query.h:52
souffle::map
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
Definition: ContainerUtil.h:158
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
souffle::times
detail::multiplying_printer< T > times(const T &value, unsigned num)
A utility printing a given value multiple times.
Definition: StreamUtil.h:322
souffle::equal_ptr
bool equal_ptr(const T *a, const T *b)
Compares two values referenced by a pointer where the case where both pointers are null is also consi...
Definition: MiscUtil.h:130
souffle::ram::Query::operation
Own< Operation > operation
RAM operation.
Definition: Query.h:85
souffle::ram::Query::print
void print(std::ostream &os, int tabpos) const override
Pretty print with indentation.
Definition: Query.h:74