Skip to content

Commit bc16d45

Browse files
committed
Bugfix
- null expression type, ignoring now both strings and nulls, as the function for nulls is sometimes returning strings - updating the query
1 parent 2de5722 commit bc16d45

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

data/test/einstein/einstein_query.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
p1 = (X)--[l:det||nmod_poss||amod||mark||case||punct||advmod||advcl||cc]->(Y) // Graph matching, First pattern
1+
p1 = (X)--[l:det||nmod_poss||amod||mark||case||punct||advmod||advcl||cc||dep]->(Y) // Graph matching, First pattern
22
where ((TEST "= |𝜑 ⦃\"Y\"⦄ | 0 ") ∧ ((Y unmatched p2 . K) ∧ ((Y unmatched p3 . T) ∧ ((Y unmatched p2 . Z) ∧ ((ℓ 0 @ Y ≠ noun) ∧ (ℓ 0 @ Y ≠ verb))))))
33
↪ set (𝜋 (label l) @ X) as (𝜉 0 @ Y) // Property extension
44
del Y // Removing a node
@@ -32,6 +32,14 @@ p2 = (>> H)<-[∀l:]--(X) // Graph matching, S
3232

3333
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3434

35+
p3fauxcop = (V)--[∀n:nsubj]->(S)
36+
--[aux]->(A)
37+
where ((( FILL ( 𝜋 lemma @ A )= be )) ∧ ((V unmatched p4 . V) ∧((V unmatched p3 . V) ∧ ((V unmatched p3pass . V) ∧ ((V unmatched p3expl . V) ∧((ℓ 0 @ V = verb)))))))
38+
↪ set (𝜋 cop @ S) as (𝜉 0 @ V) // Property extension
39+
del A // Removing a node
40+
del V
41+
(S); // Instance of reference to be returned
42+
3543

3644
p3simple = (V)--[∀n:nsubj]->(>>S)
3745
--[? mark]->(M)
@@ -68,7 +76,7 @@ p3 = (>> V)<-[∀ ? w:]--(B)
6876
--[∀ ge: dobj||ccomp||nmod||dep||obj||obl||xcomp]->( Z) // Future work: nested join between >>Z and >>Z from the join, when required. This might require to re-do the join semantics
6977
(Z)--[? case]->(T)
7078
(S)--[? neg]->(NN)
71-
where ((V unmatched p3pass . V) ∧ ((V unmatched p3expl . V) ∧((V unmatched p3simple . V) ∧(ℓ 0 @ V = verb))))
79+
where ((V unmatched p3pass . V) ∧ ((V unmatched p3expl . V) ∧((ℓ 0 @ V = verb))))
7280
7381
//new s
7482
set(φ (SCRIPT "[(° (fun y → { l cp (fun x → { ^ (^ ([⦃x⦄ 0]) \" \") ([⦃x⦄ 1]) }) (\" \") y } ) ( zip ( a { (° (fun y → {[(𝜉 y) 0]}) ⦃\"*.A\"⦄) ; (° (fun y → {[(𝜉 y) 0]}) ⦃\"*.N\"⦄) ; (° (fun y → {[(𝜉 y) 0]}) ⦃\"*.V\"⦄) ; (° (fun y → {[(𝜉 y) 0]}) ⦃\"*.T\"⦄) } ) )) 0]"), S) as Z

src/queries/closure.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ void closure::interpret_closure_set(rewrite_expr *ptr,
427427
NestedResultTable VAL = I.interpret_closure_evaluate(target_ptr, true, true);
428428
NestedResultTable NAME = I.interpret_closure_evaluate(ptr->pi_key_arg_or_then.get(), false, true);
429429
std::function<void(size_t, size_t, const std::string&, const std::string&)> resolve = [this](size_t graph_id, size_t var, const std::string& x, const std::string& val) {
430-
431430
delta_updates_per_graph[graph_id].delta_plus_db.generateId(var).content[x] = val;
432431
};
433432
std::function<std::string(const std::set<std::string>&)> resolve2 = [](const std::set<std::string>& v) {
@@ -461,6 +460,8 @@ void closure::interpret_closure_set(rewrite_expr *ptr,
461460
NestedResultTable NAME = I.interpret_closure_evaluate(ptr->pi_key_arg_or_then.get(), false, true);
462461

463462
std::function<void(size_t, size_t, const std::string&, const std::vector<gsm_object_xi_content>&)> resolve = [this,&I,&ptr](size_t graph_id, size_t var, const std::string& x, const std::vector<gsm_object_xi_content>& val) {
463+
if (x.contains("is is"))
464+
std::cout << "ERROR" << std::endl;
464465
delta_updates_per_graph[graph_id].delta_plus_db.generateId(var).phi[x] = val;
465466
};
466467
std::function<std::vector<gsm_object_xi_content>(const std::set<std::vector<gsm_object_xi_content>>&)> resolve2 = [](const std::set<std::vector<gsm_object_xi_content>>& v) {

src/scriptv2/ScriptAST.cpp

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

539539
DPtr<script::structures::ScriptAST> script::structures::ScriptAST::variableEval() {
540-
540+
// if (string.contains("S.NN"))
541+
// std::cout << "DEBUG" << std::endl;
541542
// auto it3 = globals.find(string);
542543
if (!idxers->contains(string)) {
543544

@@ -1012,7 +1013,7 @@ DPtr<script::structures::ScriptAST> script::structures::ScriptAST::run(bool impl
10121013
id = (size_t) arrayList[0]->toInteger();
10131014
} else {
10141015
auto it = arrayList[0]->run(implode);
1015-
if (it->type == t::NullE) {
1016+
if ((it->type == t::NullE) || (it->type == t::String)) {
10161017
return script::structures::ScriptAST::array_(std::move(v));
10171018
} else {
10181019
id = it->toInteger();
@@ -1045,7 +1046,7 @@ DPtr<script::structures::ScriptAST> script::structures::ScriptAST::run(bool impl
10451046
id = (size_t) arrayList[0]->toInteger();
10461047
} else {
10471048
auto it = arrayList[0]->run(implode);
1048-
if (it->type == t::NullE) {
1049+
if ((it->type == t::NullE) || (it->type == t::String)) {
10491050
return script::structures::ScriptAST::array_(std::move(v));
10501051
} else {
10511052
id = it->toInteger();
@@ -1072,7 +1073,7 @@ DPtr<script::structures::ScriptAST> script::structures::ScriptAST::run(bool impl
10721073
id = (size_t) arrayList[0]->toInteger();
10731074
} else {
10741075
auto it = arrayList[0]->run(implode);
1075-
if (it->type == t::NullE) {
1076+
if ((it->type == t::NullE) || (it->type == t::String)) {
10761077
return script::structures::ScriptAST::array_(std::move(v));
10771078
} else {
10781079
id = it->toInteger();
@@ -1102,7 +1103,7 @@ DPtr<script::structures::ScriptAST> script::structures::ScriptAST::run(bool impl
11021103
id = (size_t) arrayList[0]->toInteger();
11031104
} else {
11041105
auto it = arrayList[0]->run(implode);
1105-
if (it->type == t::NullE) {
1106+
if ((it->type == t::NullE) || (it->type == t::String)) {
11061107
return script::structures::ScriptAST::array_(std::move(v));
11071108
} else {
11081109
id = it->toInteger();
@@ -1126,7 +1127,7 @@ DPtr<script::structures::ScriptAST> script::structures::ScriptAST::run(bool impl
11261127
id = (size_t) arrayList[0]->toInteger();
11271128
} else {
11281129
auto it = arrayList[0]->run(implode);
1129-
if (it->type == t::NullE) {
1130+
if ((it->type == t::NullE) || (it->type == t::String)) {
11301131
script::structures::ScriptAST::tuple_(std::move(vv));
11311132
} else {
11321133
id = it->toInteger();

0 commit comments

Comments
 (0)