Skip to content

Commit cc7c890

Browse files
committed
Minor changes related mainly to the resolution of the variables, on checking the removal (also by back-navigating)
1 parent c7ab80f commit cc7c890

5 files changed

Lines changed: 41 additions & 9 deletions

File tree

include/database/LinearGSM.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,16 @@ namespace gsm2 {
7373
const std::map<size_t, std::string>::const_iterator findLabelFromID(size_t k) const {
7474
DEBUG_ASSERT(minRecordToContaimentLabel.begin()->first == 0);
7575
auto it = minRecordToContaimentLabel.lower_bound(k);
76-
if (it->first>k) it--;
76+
if ((it == minRecordToContaimentLabel.end())) {
77+
if (!minRecordToContaimentLabel.empty()) {
78+
auto it2 = minRecordToContaimentLabel.end();
79+
return std::prev(it2);
80+
}else {
81+
return it;
82+
}
83+
}
84+
if ((it->first>k))
85+
it--;
7786
return it;
7887
}
7988
const std::map<size_t, std::string>::const_iterator notALabel() const {
@@ -82,6 +91,15 @@ namespace gsm2 {
8291
const gsm2::tables::PhiTable::record* resolveRecord(size_t k) const {
8392
DEBUG_ASSERT(minRecordToContaimentLabel.begin()->first == 0);
8493
auto it = minRecordToContaimentLabel.lower_bound(k);
94+
if ((it == minRecordToContaimentLabel.end())) {
95+
if (!minRecordToContaimentLabel.empty()) {
96+
auto it2 = minRecordToContaimentLabel.end();
97+
it2 = std::prev(it2);
98+
return &containment_tables.at(it->second).table.at(k-it2->first);
99+
}else {
100+
return nullptr;
101+
}
102+
}
85103
if (it->first>k) it--;
86104
return &containment_tables.at(it->second).table.at(k-it->first);
87105
}

include/queries/closure.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ struct closure {
122122
for (const auto& [idX,object] : delta_updates_per_graph.at(i).delta_plus_db.O) {
123123
if (delta_updates_per_graph.at(i).removed_objects.contains(idX))
124124
continue;
125-
// if (idX == 6)
125+
// if (idX == 3)
126126
// std::cout << "HERE" << std::endl;
127127
for (const auto& [edgelabel,records] : object.phi) {
128128
size_t recordsId = 0;
129129
for (const auto& record: records) {
130-
if (delta_updates_per_graph.at(i).removed_objects.contains(record.id)) {
130+
if (delta_updates_per_graph.at(i).hasXBeenRemoved(record.id)) {
131131
// std::cout << idX << "R.." << record.id <<std::endl;
132132
recordsId++;
133133
continue;
@@ -1306,15 +1306,16 @@ struct closure {
13061306
Interpret I(graph_id, pattern_id, pattern_result.first, it->second, table_offset, *this, pr.morphisms,
13071307
forloading);
13081308
if (pattern.has_where) {
1309+
// std::cout << "TGraph #" << graph_id << ": applying pattern " << pattern.pattern_name << " for node " << vertex << std::endl;
13091310
if ((I.interpret(pattern.where, 1).empty())) {
13101311
table_offset++;
13111312
continue; //next entry
13121313
}
13131314
}
13141315

1315-
// std::cout << "Graph #" << graph_id << ": applying pattern " << pattern.pattern_name << " for node " << vertex << std::endl;
1316-
// if ((vertex == 0) && (pattern.pattern_name == "p3"))
1317-
// std::cout << "HERE" << std::endl;
1316+
1317+
if ((vertex == 3) && (graph_id == 2))
1318+
std::cout << "HERE" << std::endl;
13181319
for (const auto& operation : pattern.rwr_to) {
13191320
switch (operation.t) {
13201321

include/queries/delta_updates.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ struct delta_updates {
7777
*/
7878
inline void set_removed(size_t default_val){
7979
size_t toRemove = getOrDefault(replacement_map, default_val, default_val);
80-
// if ((toRemove == 8) || (default_val == 8))
81-
// std::cerr << "EHRE" << std::endl;
80+
if ((toRemove == 6) || (default_val == 6))
81+
std::cerr << "EHRE" << std::endl;
8282
if (!newIterationInsertedObjects.contains(toRemove))
8383
removed_objects.insert(toRemove);
8484
else
@@ -89,6 +89,15 @@ struct delta_updates {
8989
removed_edges.insert(default_val);
9090
}
9191

92+
inline void expandInto(size_t val, std::set<size_t>& res) {
93+
res.insert(val);
94+
auto it = replacement_map.find(val);
95+
if (it != replacement_map.end()) {
96+
res.insert(it->second);
97+
expandInto(it->second, res);
98+
}
99+
}
100+
92101
/**
93102
* Determining that "dest" should replace "orig"
94103
* @param orig
@@ -132,6 +141,8 @@ struct delta_updates {
132141

133142
void updateWith(const std::vector<delta_updates> &vector1);
134143

144+
145+
135146
inline size_t replacedWith(size_t x) const {
136147
auto it = replacement_map.find(x);
137148
std::unordered_set<size_t> RB;

src/queries/closure.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ void closure::generate_materialised_view() {
308308
size_t new_id = legacy_object_old_data.id;
309309
auto& obj = updates.delta_plus_db.O[new_id];
310310
obj.id = new_id;
311+
if ((graphid== 2) && (legacy_object_old_data.id == 3))
312+
std::cout << "DREBUG" << std::endl;
311313
obj.updateWith(legacy_object_old_data);
312314
for (auto& [k, v] :obj.phi) {
313315
i = 0;

src/scriptv2/ScriptAST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ std::function<DPtr<script::structures::ScriptAST>(DPtr<script::structures::Scrip
537537
}
538538

539539
DPtr<script::structures::ScriptAST> script::structures::ScriptAST::variableEval() {
540-
// if (string.contains("S.NN"))
540+
// if (string.contains("*.TB"))
541541
// std::cout << "DEBUG" << std::endl;
542542
// auto it3 = globals.find(string);
543543
if (!idxers->contains(string)) {

0 commit comments

Comments
 (0)