souffle  2.0.2-371-g6315b36
ProvenanceNegation.h
Go to the documentation of this file.
1 /*
2  * Souffle - A Datalog Compiler
3  * Copyright (c) 2018, The Souffle Developers. All rights reserved.
4  * Licensed under the Universal Permissive License v 1.0 as shown at:
5  * - https://opensource.org/licenses/UPL
6  * - <souffle root>/licenses/SOUFFLE-UPL.txt
7  */
8 
9 /************************************************************************
10  *
11  * @file ProvenanceNegation.h
12  *
13  * Defines the provenance negation class
14  *
15  ***********************************************************************/
16 
17 #pragma once
18 
19 #include "ast/Atom.h"
20 #include "ast/Negation.h"
21 #include "ast/Node.h"
23 #include <iostream>
24 #include <memory>
25 
26 namespace souffle::ast {
27 
28 /**
29  * Subclass of Literal that represents a negated atom, * e.g., !parent(x,y).
30  * A Negated atom occurs in a body of clause and cannot occur in a head of a clause.
31  *
32  * Specialised for provenance: used for existence check that tuple doesn't already exist
33  */
34 class ProvenanceNegation : public Negation {
35 public:
36  using Negation::Negation;
37 
38  ProvenanceNegation* clone() const override {
39  return new ProvenanceNegation(souffle::clone(atom), getSrcLoc());
40  }
41 
42 protected:
43  void print(std::ostream& os) const override {
44  os << "prov!" << *atom;
45  }
46 };
47 
48 } // namespace souffle::ast
souffle::ast::ProvenanceNegation::clone
ProvenanceNegation * clone() const override
Create a clone (i.e.
Definition: ProvenanceNegation.h:50
souffle::ast::ProvenanceNegation::print
void print(std::ostream &os) const override
Output to a given output stream.
Definition: ProvenanceNegation.h:55
MiscUtil.h
souffle::ast::Negation::atom
Own< Atom > atom
Negated atom.
Definition: Negation.h:83
souffle::clone
auto clone(const std::vector< A * > &xs)
Definition: ContainerUtil.h:172
Atom.h
Negation.h
Node.h
souffle::ast::Negation::Negation
Negation(Own< Atom > atom, SrcLocation loc={})
Definition: Negation.h:52
souffle::ast::Node::getSrcLoc
const SrcLocation & getSrcLoc() const
Return source location of the Node.
Definition: Node.h:46
souffle::ast
Definition: Aggregator.h:35