-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial version of gfd validation
Algorithm for checking if a graph functional dependency satisfies a given graph. The primitive interface has not yet been implemented, there is no reading data from a file, graphs are not from the boost lib.
- Loading branch information
1 parent
be78b35
commit 081d378
Showing
15 changed files
with
1,055 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
#include "literal.h" | ||
|
||
class ConstLiteral : public Literal { | ||
public: | ||
ConstLiteral(std::pair<int, std::string> node, std::string value) { | ||
this->vars.push_back(node.first); | ||
|
||
this->values.push_back(node.second); | ||
this->values.push_back(value); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <iostream> | ||
|
||
#include "gfd.h" | ||
|
||
void GFD::print() const { | ||
this->pattern.print(); | ||
std::cout << std::endl << "Premises: "; | ||
for (const Literal& l : this->premises) { | ||
std::vector<int> vars = l.getVars(); | ||
std::vector<std::string> values = l.getValues(); | ||
if (vars.size() == 1) { | ||
// ConstLiteral | ||
std::cout << vars.at(0) << "." << values.at(0) << "=" << values.at(1) << "; "; | ||
} else { | ||
// VarLiteral | ||
std::cout << vars.at(0) << "." << values.at(0) << "=" | ||
<< vars.at(1) << "." << values.at(1) << "; "; | ||
} | ||
} | ||
std::cout << std::endl << "=>" << std::endl << "Conclusion: "; | ||
for (const Literal& l : this->conclusion) { | ||
std::vector<int> vars = l.getVars(); | ||
std::vector<std::string> values = l.getValues(); | ||
if (vars.size() == 1) { | ||
// ConstLiteral | ||
std::cout << vars.at(0) << "." << values.at(0) << "=" << values.at(1) << "; "; | ||
} else { | ||
// VarLiteral | ||
std::cout << vars.at(0) << "." << values.at(0) << "=" | ||
<< vars.at(1) << "." << values.at(1) << "; "; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
#include <vector> | ||
|
||
#include "pattern.h" | ||
#include "literal.h" | ||
|
||
class GFD { | ||
private: | ||
Pattern pattern; | ||
std::vector<Literal> premises; | ||
std::vector<Literal> conclusion; | ||
public: | ||
GFD(Pattern& pattern_, std::vector<Literal>& premises_, std::vector<Literal>& conclusion_) : pattern(pattern_), premises(premises_), conclusion(conclusion_) {} | ||
|
||
Pattern getPattern() const { return this->pattern; } | ||
std::vector<Literal> getPremises() const { return this->premises; } | ||
std::vector<Literal> getConclusion() const { return this->conclusion; } | ||
|
||
void print() const; | ||
}; |
Oops, something went wrong.