souffle  2.0.2-371-g6315b36
Public Member Functions | Protected Member Functions | Protected Attributes
souffle::ExplainProvenance Class Referenceabstract

#include <ExplainProvenance.h>

Inheritance diagram for souffle::ExplainProvenance:
Inheritance graph
Collaboration diagram for souffle::ExplainProvenance:
Collaboration graph

Public Member Functions

virtual Own< TreeNodeexplain (std::string relName, std::vector< std::string > tuple, size_t depthLimit)=0
 
virtual Own< TreeNodeexplainNegation (std::string relName, size_t ruleNum, const std::vector< std::string > &tuple, std::map< std::string, std::string > &bodyVariables)=0
 
virtual std::vector< std::string > explainNegationGetVariables (std::string relName, std::vector< std::string > args, size_t ruleNum)=0
 
 ExplainProvenance (SouffleProgram &prog)
 
virtual Own< TreeNodeexplainSubproof (std::string relName, RamDomain label, size_t depthLimit)=0
 
virtual std::string getRule (std::string relName, size_t ruleNum)=0
 
virtual std::vector< std::string > getRules (const std::string &relName)=0
 
virtual std::string measureRelation (std::string relName)=0
 
virtual void printRulesJSON (std::ostream &os)=0
 
virtual void queryProcess (const std::vector< std::pair< std::string, std::vector< std::string >>> &rels)=0
 Process query with given arguments. More...
 
virtual void setup ()=0
 
virtual ~ExplainProvenance ()=default
 

Protected Member Functions

std::vector< RamDomainargsToNums (const std::string &relName, const std::vector< std::string > &args) const
 
std::vector< std::string > decodeArguments (const std::string &relName, const std::vector< RamDomain > &nums) const
 Decode arguments from their ram representation and return as strings. More...
 
RamDomain valueRead (const char type, const std::string &value) const
 
std::string valueShow (const char type, const RamDomain value) const
 

Protected Attributes

SouffleProgramprog
 
SymbolTablesymTable
 

Detailed Description

Definition at line 165 of file ExplainProvenance.h.

Constructor & Destructor Documentation

◆ ExplainProvenance()

souffle::ExplainProvenance::ExplainProvenance ( SouffleProgram prog)
inline

Definition at line 167 of file ExplainProvenance.h.

◆ ~ExplainProvenance()

virtual souffle::ExplainProvenance::~ExplainProvenance ( )
virtualdefault

Member Function Documentation

◆ argsToNums()

std::vector<RamDomain> souffle::ExplainProvenance::argsToNums ( const std::string &  relName,
const std::vector< std::string > &  args 
) const
inlineprotected

Definition at line 200 of file ExplainProvenance.h.

203  {
204  nums.push_back(valueRead(rel->getAttrType(i)[0], args[i]));
205  }
206 
207  return nums;
208  }
209 
210  /**
211  * Decode arguments from their ram representation and return as strings.
212  **/
213  std::vector<std::string> decodeArguments(
214  const std::string& relName, const std::vector<RamDomain>& nums) const {

◆ decodeArguments()

std::vector<std::string> souffle::ExplainProvenance::decodeArguments ( const std::string &  relName,
const std::vector< RamDomain > &  nums 
) const
inlineprotected

Decode arguments from their ram representation and return as strings.

Definition at line 219 of file ExplainProvenance.h.

222  {
223  args.push_back(valueShow(rel->getAttrType(i)[0], nums[i]));
224  }
225 
226  return args;
227  }
228 
229  std::string valueShow(const char type, const RamDomain value) const {
230  switch (type) {
231  case 'i': return tfm::format("%d", ramBitCast<RamSigned>(value));
232  case 'u': return tfm::format("%d", ramBitCast<RamUnsigned>(value));
233  case 'f': return tfm::format("%f", ramBitCast<RamFloat>(value));

◆ explain()

virtual Own<TreeNode> souffle::ExplainProvenance::explain ( std::string  relName,
std::vector< std::string >  tuple,
size_t  depthLimit 
)
pure virtual

◆ explainNegation()

virtual Own<TreeNode> souffle::ExplainProvenance::explainNegation ( std::string  relName,
size_t  ruleNum,
const std::vector< std::string > &  tuple,
std::map< std::string, std::string > &  bodyVariables 
)
pure virtual

◆ explainNegationGetVariables()

virtual std::vector<std::string> souffle::ExplainProvenance::explainNegationGetVariables ( std::string  relName,
std::vector< std::string >  args,
size_t  ruleNum 
)
pure virtual

◆ explainSubproof()

virtual Own<TreeNode> souffle::ExplainProvenance::explainSubproof ( std::string  relName,
RamDomain  label,
size_t  depthLimit 
)
pure virtual

◆ getRule()

virtual std::string souffle::ExplainProvenance::getRule ( std::string  relName,
size_t  ruleNum 
)
pure virtual

◆ getRules()

virtual std::vector<std::string> souffle::ExplainProvenance::getRules ( const std::string &  relName)
pure virtual

◆ measureRelation()

virtual std::string souffle::ExplainProvenance::measureRelation ( std::string  relName)
pure virtual

◆ printRulesJSON()

virtual void souffle::ExplainProvenance::printRulesJSON ( std::ostream &  os)
pure virtual

◆ queryProcess()

virtual void souffle::ExplainProvenance::queryProcess ( const std::vector< std::pair< std::string, std::vector< std::string >>> &  rels)
pure virtual

Process query with given arguments.

Parameters
rels,vectorof relation, argument pairs

Implemented in souffle::ExplainProvenanceImpl.

Referenced by souffle::Explain::processCommand().

◆ setup()

virtual void souffle::ExplainProvenance::setup ( )
pure virtual

◆ valueRead()

RamDomain souffle::ExplainProvenance::valueRead ( const char  type,
const std::string &  value 
) const
inlineprotected

Definition at line 246 of file ExplainProvenance.h.

248  : fatal("not implemented");
249  default: fatal("unhandled type attr code");
250  }
251  }
252 };
253 
254 } // end of namespace souffle

◆ valueShow()

std::string souffle::ExplainProvenance::valueShow ( const char  type,
const RamDomain  value 
) const
inlineprotected

Definition at line 235 of file ExplainProvenance.h.

235  : return tfm::format("record #%d", value);
236  default: fatal("unhandled type attr code");
237  }
238  }
239 
240  RamDomain valueRead(const char type, const std::string& value) const {
241  switch (type) {
242  case 'i': return ramBitCast(RamSignedFromString(value));
243  case 'u': return ramBitCast(RamUnsignedFromString(value));
244  case 'f': return ramBitCast(RamFloatFromString(value));

Field Documentation

◆ prog

SouffleProgram& souffle::ExplainProvenance::prog
protected

Definition at line 197 of file ExplainProvenance.h.

◆ symTable

SymbolTable& souffle::ExplainProvenance::symTable
protected

Definition at line 198 of file ExplainProvenance.h.


The documentation for this class was generated from the following file:
souffle::RamSignedFromString
RamSigned RamSignedFromString(const std::string &str, std::size_t *position=nullptr, const int base=10)
Converts a string to a RamSigned.
Definition: StringUtil.h:51
souffle::RamDomain
int32_t RamDomain
Definition: RamTypes.h:56
tinyformat::format
void format(std::ostream &out, const char *fmt)
Definition: tinyformat.h:1089
i
size_t i
Definition: json11.h:663
souffle::ExplainProvenance::valueShow
std::string valueShow(const char type, const RamDomain value) const
Definition: ExplainProvenance.h:235
souffle::ExplainProvenance::valueRead
RamDomain valueRead(const char type, const std::string &value) const
Definition: ExplainProvenance.h:246
souffle::ExplainProvenance::decodeArguments
std::vector< std::string > decodeArguments(const std::string &relName, const std::vector< RamDomain > &nums) const
Decode arguments from their ram representation and return as strings.
Definition: ExplainProvenance.h:219
souffle::fatal
void fatal(const char *format, const Args &... args)
Definition: MiscUtil.h:198
souffle::RamUnsignedFromString
RamUnsigned RamUnsignedFromString(const std::string &str, std::size_t *position=nullptr, const int base=10)
Converts a string to a RamUnsigned.
Definition: StringUtil.h:110
souffle::ramBitCast
To ramBitCast(From source)
In C++20 there will be a new way to cast between types by reinterpreting bits (std::bit_cast),...
Definition: RamTypes.h:87
souffle::RamFloatFromString
RamFloat RamFloatFromString(const std::string &str, std::size_t *position=nullptr)
Converts a string to a RamFloat.
Definition: StringUtil.h:93
rel
void rel(size_t limit, bool showLimit=true)
Definition: Tui.h:1086
std::type
ElementType type
Definition: span.h:640