From 84db4b6657a42901f6206b6e4d85d14970d29a98 Mon Sep 17 00:00:00 2001
From: Marko Budiselic <mbudiselicbuda@gmail.com>
Date: Sat, 9 Jul 2016 14:50:04 +0100
Subject: [PATCH] cypher parser update

---
 CMakeLists.txt                                |   4 +-
 src/cypher/ast/ast.hpp                        |   1 +
 src/cypher/ast/ast_visitor.hpp                |  26 +++-
 src/cypher/ast/identifier.hpp                 |   6 +
 src/cypher/ast/match.hpp                      |   6 +-
 src/cypher/ast/operators.hpp                  |  24 ++--
 src/cypher/ast/pattern.hpp                    |   5 +
 src/cypher/ast/queries.hpp                    |  56 ++++++---
 src/cypher/ast/with.hpp                       |  41 +++++++
 src/cypher/cypher.y                           | 112 ++++++++++++++++--
 src/cypher/debug/tree_print.hpp               |  36 ++++++
 src/cypher/tokenizer/cypher_lexer.hpp         |   1 +
 src/cypher/visitor/traverser.hpp              |  58 +++++++--
 tests/CMakeLists.txt                          |   2 +-
 .../cypher_queries/sprint_0/query_0.cypher    |   1 +
 .../cypher_queries/sprint_0/query_1.cypher    |   1 +
 .../cypher_queries/sprint_0/query_2.cypher    |   1 +
 .../cypher_queries/sprint_0/query_3.cypher    |   1 +
 .../cypher_queries/sprint_0/query_4.cypher    |   1 +
 .../cypher_queries/sprint_0/query_5.cypher    |   1 +
 .../cypher_queries/sprint_0/query_6.cypher    |   1 +
 .../cypher_queries/sprint_1/query_0.cypher    |   1 +
 .../cypher_queries/sprint_1/query_1.cypher    |   1 +
 .../cypher_queries/sprint_1/query_5.cypher    |   1 +
 tests/unit/cypher_traversal.cpp               |   1 +
 25 files changed, 327 insertions(+), 62 deletions(-)
 create mode 100644 src/cypher/ast/with.hpp
 create mode 100644 tests/data/cypher_queries/sprint_0/query_0.cypher
 create mode 100644 tests/data/cypher_queries/sprint_0/query_1.cypher
 create mode 100644 tests/data/cypher_queries/sprint_0/query_2.cypher
 create mode 100644 tests/data/cypher_queries/sprint_0/query_3.cypher
 create mode 100644 tests/data/cypher_queries/sprint_0/query_4.cypher
 create mode 100644 tests/data/cypher_queries/sprint_0/query_5.cypher
 create mode 100644 tests/data/cypher_queries/sprint_0/query_6.cypher
 create mode 100644 tests/data/cypher_queries/sprint_1/query_0.cypher
 create mode 100644 tests/data/cypher_queries/sprint_1/query_1.cypher
 create mode 100644 tests/data/cypher_queries/sprint_1/query_5.cypher

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0175ae6a..87786c00f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -202,8 +202,8 @@ set(memgraph_src_files
 )
 
 # hard coded implementation of queries
-add_executable(queries src/query_engine/main_queries.cpp ${memgraph_src_files})
-target_link_libraries(queries ${fmt_static_lib})
+# add_executable(queries src/query_engine/main_queries.cpp ${memgraph_src_files})
+# target_link_libraries(queries ${fmt_static_lib})
 
 # tests
 enable_testing()
diff --git a/src/cypher/ast/ast.hpp b/src/cypher/ast/ast.hpp
index 0ce90bc85..29e2e9408 100644
--- a/src/cypher/ast/ast.hpp
+++ b/src/cypher/ast/ast.hpp
@@ -18,3 +18,4 @@
 #include "start.hpp"
 #include "set.hpp"
 #include "expr.hpp"
+#include "with.hpp"
diff --git a/src/cypher/ast/ast_visitor.hpp b/src/cypher/ast/ast_visitor.hpp
index 43c2421f7..1edb58fad 100644
--- a/src/cypher/ast/ast_visitor.hpp
+++ b/src/cypher/ast/ast_visitor.hpp
@@ -6,6 +6,7 @@ namespace ast
 {
 
 struct Identifier;
+struct IdentifierList;
 struct Alias;
 
 // properties
@@ -42,6 +43,7 @@ struct Node;
 struct LabelList;
 struct Pattern;
 struct PatternExpr;
+struct PatternList;
 
 struct Return;
 struct ReturnList;
@@ -58,17 +60,29 @@ struct WriteQuery;
 struct ReadQuery;
 struct UpdateQuery;
 struct DeleteQuery;
+struct ReadWriteQuery;
 
 struct SetKey;
 struct SetValue;
 struct SetElement;
 struct SetList;
 
-struct AstVisitor : public Visitor<Accessor, Boolean, Float, Identifier, Alias,
-    Integer, String, Property, And, Or, Lt, Gt, Ge, Le, Eq, Ne, Plus, Minus,
-    Star, Slash, Rem, PropertyList, RelationshipList, Relationship, Node,
-    RelationshipSpecs, LabelList, ReturnList, Pattern, PatternExpr, Match, ReadQuery,
-    Start, Where, WriteQuery, Create, Return, Distinct, Delete,
-    DeleteQuery, UpdateQuery, Set, SetKey, SetValue, SetElement, SetList> {};
+struct WithList;
+struct WithClause;
+struct WithQuery;
+
+struct AstVisitor
+    : public Visitor<Accessor, Boolean, Float, Identifier, Alias, Integer,
+                     String, Property, And, Or, Lt, Gt, Ge, Le, Eq, Ne, Plus,
+                     Minus, Star, Slash, Rem, PropertyList, RelationshipList,
+                     Relationship, Node, RelationshipSpecs, LabelList,
+                     ReturnList, Pattern, PatternExpr, PatternList, Match,
+                     ReadQuery, Start, Where, WriteQuery, Create, Return,
+                     Distinct, Delete, DeleteQuery, UpdateQuery, Set, SetKey,
+                     ReadWriteQuery, IdentifierList,
+                     WithList, WithClause, WithQuery,
+                     SetValue, SetElement, SetList>
+{
+};
 
 }
diff --git a/src/cypher/ast/identifier.hpp b/src/cypher/ast/identifier.hpp
index 2221aacac..f9c7a6934 100644
--- a/src/cypher/ast/identifier.hpp
+++ b/src/cypher/ast/identifier.hpp
@@ -3,6 +3,7 @@
 #include <string>
 
 #include "ast_node.hpp"
+#include "list.hpp"
 
 namespace ast
 {
@@ -15,4 +16,9 @@ struct Identifier : public AstNode<Identifier>
     std::string name;
 };
 
+struct IdentifierList : public List<Identifier, IdentifierList>
+{
+    using List::List;
+};
+
 }
diff --git a/src/cypher/ast/match.hpp b/src/cypher/ast/match.hpp
index 3033b39fc..e14bc0247 100644
--- a/src/cypher/ast/match.hpp
+++ b/src/cypher/ast/match.hpp
@@ -9,10 +9,10 @@ namespace ast
 
 struct Match : public AstNode<Match>
 {
-    Match(Pattern* pattern, Where* where)
-        : pattern(pattern), where(where) {}
+    Match(PatternList* pattern_list, Where* where)
+        : pattern_list(pattern_list), where(where) {}
 
-    Pattern* pattern;
+    PatternList* pattern_list;
     Where* where;
 };
 
diff --git a/src/cypher/ast/operators.hpp b/src/cypher/ast/operators.hpp
index 16d221bcc..a3418ef2b 100644
--- a/src/cypher/ast/operators.hpp
+++ b/src/cypher/ast/operators.hpp
@@ -10,62 +10,62 @@ struct And : public BinaryExpr<And>
     using BinaryExpr::BinaryExpr;
 };
 
-struct Or : public BinaryExpr<And>
+struct Or : public BinaryExpr<Or>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Lt : public BinaryExpr<And>
+struct Lt : public BinaryExpr<Lt>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Gt : public BinaryExpr<And>
+struct Gt : public BinaryExpr<Gt>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Ge : public BinaryExpr<And>
+struct Ge : public BinaryExpr<Ge>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Le : public BinaryExpr<And>
+struct Le : public BinaryExpr<Le>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Eq : public BinaryExpr<And>
+struct Eq : public BinaryExpr<Eq>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Ne : public BinaryExpr<And>
+struct Ne : public BinaryExpr<Ne>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Plus : public BinaryExpr<And>
+struct Plus : public BinaryExpr<Plus>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Minus : public BinaryExpr<And>
+struct Minus : public BinaryExpr<Minus>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Star : public BinaryExpr<And>
+struct Star : public BinaryExpr<Star>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Slash : public BinaryExpr<And>
+struct Slash : public BinaryExpr<Slash>
 {
     using BinaryExpr::BinaryExpr;
 };
 
-struct Rem : public BinaryExpr<And>
+struct Rem : public BinaryExpr<Rem>
 {
     using BinaryExpr::BinaryExpr;
 };
diff --git a/src/cypher/ast/pattern.hpp b/src/cypher/ast/pattern.hpp
index 0b93e57bd..ac65d712d 100644
--- a/src/cypher/ast/pattern.hpp
+++ b/src/cypher/ast/pattern.hpp
@@ -17,4 +17,9 @@ struct Pattern : public AstNode<Pattern>
     Pattern* next;
 };
 
+struct PatternList : public List<Pattern, PatternList>
+{
+    using List::List;
+};
+
 }
diff --git a/src/cypher/ast/queries.hpp b/src/cypher/ast/queries.hpp
index 4c004fbf7..6e33430cb 100644
--- a/src/cypher/ast/queries.hpp
+++ b/src/cypher/ast/queries.hpp
@@ -2,52 +2,72 @@
 
 #include "ast_node.hpp"
 #include "create.hpp"
-#include "match.hpp"
-#include "set.hpp"
 #include "delete.hpp"
+#include "match.hpp"
 #include "return.hpp"
+#include "set.hpp"
 
 namespace ast
 {
 
 struct WriteQuery : public AstNode<WriteQuery>
 {
-    WriteQuery(Create* create, Return* return_clause)
-        : create(create), return_clause(return_clause) {}
+    WriteQuery(Create *create, Return *return_clause)
+        : create(create), return_clause(return_clause)
+    {
+    }
 
-    Create* create;
-    Return* return_clause;
+    Create *create;
+    Return *return_clause;
 };
 
 struct ReadQuery : public AstNode<ReadQuery>
 {
-    ReadQuery(Match* match, Return* return_clause)
-        : match(match), return_clause(return_clause) {}
+    ReadQuery(Match *match, Return *return_clause)
+        : match(match), return_clause(return_clause)
+    {
+    }
 
-    Match* match;
-    Return* return_clause;
+    Match *match;
+    Return *return_clause;
 };
 
 struct UpdateQuery : public AstNode<UpdateQuery>
 {
-    UpdateQuery(Match* match_clause, Set* set_clause, Return* return_clause)
+    UpdateQuery(Match *match_clause, Set *set_clause, Return *return_clause)
         : match_clause(match_clause), set_clause(set_clause),
           return_clause(return_clause)
     {
     }
 
-    Match* match_clause;
-    Set* set_clause;
-    Return* return_clause;
+    Match *match_clause;
+    Set *set_clause;
+    Return *return_clause;
 };
 
 struct DeleteQuery : public AstNode<DeleteQuery>
 {
-    DeleteQuery(Match* match, Delete* delete_clause)
-        : match(match), delete_clause(delete_clause) {}
+    DeleteQuery(Match *match, Delete *delete_clause)
+        : match(match), delete_clause(delete_clause)
+    {
+    }
 
-    Match* match;
-    Delete* delete_clause;
+    Match *match;
+    Delete *delete_clause;
+};
+
+struct ReadWriteQuery : public AstNode<ReadWriteQuery>
+{
+    ReadWriteQuery(Match *match_clause,
+                   Create *create_clause, Return *return_clause)
+        : match_clause(match_clause),
+          create_clause(create_clause), return_clause(return_clause)
+    {
+    }
+
+    Match *match_clause;
+    Create *create_clause;
+    Return *return_clause;
 };
 
 }
diff --git a/src/cypher/ast/with.hpp b/src/cypher/ast/with.hpp
new file mode 100644
index 000000000..d44d2e53f
--- /dev/null
+++ b/src/cypher/ast/with.hpp
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <string>
+
+#include "ast_node.hpp"
+#include "identifier.hpp"
+#include "match.hpp"
+
+namespace ast
+{
+
+struct WithClause : public AstNode<WithClause>
+{
+    WithClause(IdentifierList *identifier_list, Match *match_clause)
+        : identifier_list(identifier_list), match_clause(match_clause)
+    {
+    }
+
+    IdentifierList *identifier_list;
+    Match *match_clause;
+};
+
+struct WithList : public List<WithClause, WithList>
+{
+    using List::List;
+};
+
+struct WithQuery : public AstNode<WithQuery>
+{
+    WithQuery(Match *match_clause, WithList *with_list, Return *return_clause)
+        : match_clause(match_clause), with_list(with_list),
+          return_clause(return_clause)
+    {
+    }
+
+    Match *match_clause;
+    WithList *with_list;
+    Return *return_clause;
+};
+
+}
diff --git a/src/cypher/cypher.y b/src/cypher/cypher.y
index b09fbeb63..226eb88ca 100644
--- a/src/cypher/cypher.y
+++ b/src/cypher/cypher.y
@@ -55,22 +55,71 @@
 %left PLUS MINUS.
 %left STAR SLASH REM.
 
-// start structure
+// -- start structure
 
-start ::= write_query(WQ). {
-    ast->root = WQ;
+start ::= with_query(Q). {
+    ast->root = Q;
 }
 
-start ::= read_query(RQ). {
-    ast->root = RQ;
+start ::= write_query(Q). {
+    ast->root = Q;
 }
 
-start ::= update_query(UQ). {
-    ast->root = UQ;
+start ::= read_query(Q). {
+    ast->root = Q;
 }
 
-start ::= delete_query(DQ). {
-    ast->root = DQ;
+start ::= update_query(Q). {
+    ast->root = Q;
+}
+
+start ::= delete_query(Q). {
+    ast->root = Q;
+}
+
+start ::= read_write_query(Q). {
+    ast->root = Q;
+}
+
+// -- with query
+
+%type with_query {ast::WithQuery*}
+
+with_query(WQ) ::= with_start_clause(SQ) with_list(WL) return_clause(RC). {
+    WQ = ast->create<ast::WithQuery>(SQ, WL, RC);
+}
+
+%type with_list {ast::WithList*}
+
+with_list(L) ::= WITH with_clause(WC) with_list(N). {
+    L = ast->create<ast::WithList>(WC, N);    
+}
+
+with_list(L) ::= . {
+    L = nullptr;
+}
+
+// TODO: replace Match with something that has Match, Create, etc.
+%type with_start_clause {ast::Match*}
+
+with_start_clause(WSC) ::= match_clause(MC). {
+    WSC = MC;
+}
+
+%type with_clause {ast::WithClause*}
+
+with_clause(WC) ::= identifier_list(IL) with_match_clause(MC). {
+    WC = ast->create<ast::WithClause>(IL, MC);
+}
+
+%type with_match_clause {ast::Match*}
+
+with_match_clause(WMC) ::= match_clause(M). {
+    WMC = M;
+}
+
+with_match_clause(WMC) ::= where_clause(WC). {
+    WMC = ast->create<ast::Match>(nullptr, WC);
 }
 
 // write query structure
@@ -93,6 +142,21 @@ read_query(RQ) ::= match_clause(M) return_clause(R). {
     RQ = ast->create<ast::ReadQuery>(M, R);
 }
 
+// -- match create query
+
+%type read_write_query {ast::ReadWriteQuery*}
+
+read_write_query(Q) ::= match_clause(M) create_clause(C) return_clause(R). {
+    Q = ast->create<ast::ReadWriteQuery>(M, C, R);
+}
+
+read_write_query(Q) ::= match_clause(M) create_clause(C). {
+    Q = ast->create<ast::ReadWriteQuery>(M, C, nullptr);
+}
+
+// ---------------------
+
+
 // update query structure
 
 %type update_query {ast::UpdateQuery*}
@@ -129,7 +193,7 @@ create_clause(C) ::= CREATE pattern(P). {
 
 %type match_clause {ast::Match*}
 
-match_clause(M) ::= MATCH pattern(P) where_clause(W). {
+match_clause(M) ::= MATCH pattern_list(P) where_clause(W). {
     M = ast->create<ast::Match>(P, W);
 }
 
@@ -139,6 +203,20 @@ delete_clause(D) ::= DELETE idn(I). {
     D = ast->create<ast::Delete>(I);
 }
 
+// ---- pattern list
+
+%type pattern_list {ast::PatternList*}
+
+pattern_list(L) ::= pattern(P) COMMA pattern_list(N). {
+    L = ast->create<ast::PatternList>(P, N);
+}
+
+pattern_list(L) ::= pattern(P). {
+    L = ast->create<ast::PatternList>(P, nullptr);
+}
+
+// ----
+
 %type pattern {ast::Pattern*}
 
 pattern(P) ::= node(N) rel(R) pattern(NEXT). {
@@ -372,6 +450,20 @@ idn(I) ::= IDN(X). {
     I = ast->create<ast::Identifier>(X->value);
 }
 
+// ---- identifier list
+
+%type identifier_list {ast::IdentifierList*}
+
+identifier_list(L) ::= idn(I) COMMA identifier_list(N). {
+    L = ast->create<ast::IdentifierList>(I, N);
+}
+
+identifier_list(L) ::= idn(I). {
+    L = ast->create<ast::IdentifierList>(I, nullptr);
+}
+
+// ----
+
 value_expr(E) ::= INT(V). {
     auto value = std::stoi(V->value);
     E = ast->create<ast::Integer>(value);
diff --git a/src/cypher/debug/tree_print.hpp b/src/cypher/debug/tree_print.hpp
index 8e2994397..46d03673f 100644
--- a/src/cypher/debug/tree_print.hpp
+++ b/src/cypher/debug/tree_print.hpp
@@ -94,6 +94,12 @@ public:
         Traverser::visit(read_query);
     }
 
+    void visit(ast::ReadWriteQuery& query) override
+    {
+        auto entry = printer.advance("Read Write Query");
+        Traverser::visit(query);
+    }
+
     void visit(ast::Match& match) override
     {
         auto entry = printer.advance("Match");
@@ -112,6 +118,12 @@ public:
         Traverser::visit(pattern_expr);
     }
 
+    void visit(ast::PatternList& pattern_list) override
+    {
+        auto entry = printer.advance("Pattern List");
+        Traverser::visit(pattern_list);
+    }
+
     void visit(ast::Node& node) override
     {
         auto entry = printer.advance("Node");
@@ -130,6 +142,12 @@ public:
         entry << "Identifier '" << idn.name << "'";
     }
 
+    void visit(ast::IdentifierList& list) override
+    {
+        auto entry = printer.advance("Identifier List");
+        Traverser::visit(list);
+    }
+
     void visit(ast::Return& return_clause) override
     {
         auto entry = printer.advance("Return");
@@ -353,6 +371,24 @@ public:
         Traverser::visit(set_list);
     }
 
+    void visit(ast::WithClause& with_clause) override
+    {
+        auto entry = printer.advance("With Clause");
+        Traverser::visit(with_clause);
+    }
+
+    void visit(ast::WithList& with_list) override
+    {
+        auto entry = printer.advance("With List");
+        Traverser::visit(with_list);
+    }
+
+    void visit(ast::WithQuery& with_query) override
+    {
+        auto entry = printer.advance("With Query");
+        Traverser::visit(with_query);
+    }
+
 private:
     Printer printer;
 };
diff --git a/src/cypher/tokenizer/cypher_lexer.hpp b/src/cypher/tokenizer/cypher_lexer.hpp
index e77ac8ff5..2ca0e3146 100644
--- a/src/cypher/tokenizer/cypher_lexer.hpp
+++ b/src/cypher/tokenizer/cypher_lexer.hpp
@@ -49,6 +49,7 @@ public:
         rule("(?i:RETURN)", TK_RETURN);
         rule("(?i:DISTINCT)", TK_DISTINCT);
         rule("(?i:DELETE)", TK_DELETE);
+        rule("(?i:WITH)", TK_WITH);
 
         rule("(?i:AND)", TK_AND);
         rule("(?i:OR)", TK_OR);
diff --git a/src/cypher/visitor/traverser.hpp b/src/cypher/visitor/traverser.hpp
index 833b5f2de..ddfbd4a69 100644
--- a/src/cypher/visitor/traverser.hpp
+++ b/src/cypher/visitor/traverser.hpp
@@ -10,8 +10,9 @@ public:
     using uptr = std::unique_ptr<Traverser>;
     using sptr = std::shared_ptr<Traverser>;
 
-    void visit(ast::Start& start) override
+    void visit(ast::Start& start_query) override
     {
+        // DELETE
     }
 
     void visit(ast::DeleteQuery& delete_query) override
@@ -26,9 +27,19 @@ public:
         accept(read_query.return_clause);
     }
 
+    void visit(ast::ReadWriteQuery& query) override
+    {
+        accept(query.match_clause);
+
+        accept(query.create_clause);
+
+        if (query.return_clause != nullptr)
+            accept(query.return_clause);
+    }
+
     void visit(ast::Match& match) override
     {
-        accept(match.pattern);
+        accept(match.pattern_list);
         accept(match.where);
     }
 
@@ -53,10 +64,8 @@ public:
 
     void visit(ast::Return& return_clause) override
     {
-        if (return_clause.return_list != nullptr)
-            accept(return_clause.return_list);
-        if (return_clause.distinct != nullptr)
-            accept(return_clause.distinct);
+        accept(return_clause.return_list);
+        accept(return_clause.distinct);
     }
 
     void visit(ast::Accessor& accessor) override
@@ -154,12 +163,24 @@ public:
         accept(prop_list.next);
     }
 
+    void visit(ast::PatternList& pattern_list) override
+    {
+        accept(pattern_list.value);
+        accept(pattern_list.next);
+    }
+
     void visit(ast::RelationshipList& rel_list) override
     {
         accept(rel_list.value);
         accept(rel_list.next);
     }
 
+    void visit(ast::IdentifierList& list) override
+    {
+        accept(list.value);
+        accept(list.next);
+    }
+
     void visit(ast::Relationship& rel) override
     {
         accept(rel.specs);
@@ -199,8 +220,7 @@ public:
     {
         accept(update_query.match_clause);
         accept(update_query.set_clause);
-        if (update_query.return_clause != nullptr)
-            accept(update_query.return_clause);
+        accept(update_query.return_clause);
     }
 
     void visit(ast::Set& set_clause) override
@@ -222,8 +242,7 @@ public:
     void visit(ast::SetList& set_list) override
     {
         accept(set_list.value);
-        if (set_list.next != nullptr)
-            accept(set_list.next);
+        accept(set_list.next);
     }
 
     void visit(ast::Create& create) override
@@ -241,6 +260,25 @@ public:
         accept(delete_clause.identifier);
     }
 
+    void visit(ast::WithClause& with_clause) override
+    {
+        accept(with_clause.identifier_list);
+        accept(with_clause.match_clause);
+    }
+
+    void visit(ast::WithList& with_list) override
+    {
+        accept(with_list.value);
+        accept(with_list.next);
+    }
+
+    void visit(ast::WithQuery& with_query) override
+    {
+        accept(with_query.match_clause);
+        accept(with_query.with_list);
+        accept(with_query.return_clause);
+    }
+
 protected:
     template<class T>
     void accept(T* node)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 116857a3a..00ae177ea 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -50,7 +50,7 @@ foreach(test ${concurrency_test_names})
 endforeach()
 
 # build integration tests
-message(STATUS ${memgraph_src_files})
+# message(STATUS ${memgraph_src_files})
 add_executable(integration_queries integration/queries.cpp ${memgraph_src_files})
 target_link_libraries(integration_queries ${fmt_static_lib})
 add_test(NAME integration_queries COMMAND integration_queries)
diff --git a/tests/data/cypher_queries/sprint_0/query_0.cypher b/tests/data/cypher_queries/sprint_0/query_0.cypher
new file mode 100644
index 000000000..53751af0d
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_0/query_0.cypher
@@ -0,0 +1 @@
+CREATE (n {id: 2322, name: "TEST", country: "Croatia", created_at: 2352352}) RETURN n
diff --git a/tests/data/cypher_queries/sprint_0/query_1.cypher b/tests/data/cypher_queries/sprint_0/query_1.cypher
new file mode 100644
index 000000000..7b862f8ea
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_0/query_1.cypher
@@ -0,0 +1 @@
+CREATE (n:ACCOUNT {id: 2322, name: "TEST", country: "Croatia", created_at: 2352352}) RETURN n
diff --git a/tests/data/cypher_queries/sprint_0/query_2.cypher b/tests/data/cypher_queries/sprint_0/query_2.cypher
new file mode 100644
index 000000000..c90753561
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_0/query_2.cypher
@@ -0,0 +1 @@
+MATCH (n {id: 0}) RETURN n
diff --git a/tests/data/cypher_queries/sprint_0/query_3.cypher b/tests/data/cypher_queries/sprint_0/query_3.cypher
new file mode 100644
index 000000000..c8b62c1de
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_0/query_3.cypher
@@ -0,0 +1 @@
+MATCH (a {id:0}), (p {id: 1}) CREATE (a)-[r:IS]->(p) RETURN r
diff --git a/tests/data/cypher_queries/sprint_0/query_4.cypher b/tests/data/cypher_queries/sprint_0/query_4.cypher
new file mode 100644
index 000000000..f76d46faa
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_0/query_4.cypher
@@ -0,0 +1 @@
+MATCH (n {id: 0}) SET n.name = "TEST100" RETURN n
diff --git a/tests/data/cypher_queries/sprint_0/query_5.cypher b/tests/data/cypher_queries/sprint_0/query_5.cypher
new file mode 100644
index 000000000..68976d24c
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_0/query_5.cypher
@@ -0,0 +1 @@
+MATCH (n:LABEL) RETURN n
diff --git a/tests/data/cypher_queries/sprint_0/query_6.cypher b/tests/data/cypher_queries/sprint_0/query_6.cypher
new file mode 100644
index 000000000..bac9cd276
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_0/query_6.cypher
@@ -0,0 +1 @@
+MATCH (a {id:0}), (p {id: 1}) CREATE (a)-[r:IS]->(p)
diff --git a/tests/data/cypher_queries/sprint_1/query_0.cypher b/tests/data/cypher_queries/sprint_1/query_0.cypher
new file mode 100644
index 000000000..174cd08c0
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_1/query_0.cypher
@@ -0,0 +1 @@
+MATCH (n:Data) WHERE n.queryID = "KMeasyKMID" OR n.queryID = "easyQueryID" RETURN n
diff --git a/tests/data/cypher_queries/sprint_1/query_1.cypher b/tests/data/cypher_queries/sprint_1/query_1.cypher
new file mode 100644
index 000000000..6f23df2d5
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_1/query_1.cypher
@@ -0,0 +1 @@
+MATCH (n:Data) WHERE n.queryID = "KMeasyKMID" OR n.queryID = "easyQueryID" WITH n MATCH (n)-[r:Fact]->(m) WHERE r.relationshipType = 'recommended exercise' WITH n,r,m WHERE n.value = 'G' AND m.value = 'HK.03 - Aqua Walking' return n, r, m
diff --git a/tests/data/cypher_queries/sprint_1/query_5.cypher b/tests/data/cypher_queries/sprint_1/query_5.cypher
new file mode 100644
index 000000000..bd69d1256
--- /dev/null
+++ b/tests/data/cypher_queries/sprint_1/query_5.cypher
@@ -0,0 +1 @@
+# MATCH (n:Data) WHERE n.queryID IN ["KMeasyKMID", 'easyQueryID'] WITH n MATCH n-[r:Fact]->(m) WHERE r.relationshipType = 'recommended exercise' WITH n,r,m WHERE n.value = 'G' AND m.value = 'HK.03 - Aqua Walking' return n, r, m
diff --git a/tests/unit/cypher_traversal.cpp b/tests/unit/cypher_traversal.cpp
index 746af3884..9cbc19891 100644
--- a/tests/unit/cypher_traversal.cpp
+++ b/tests/unit/cypher_traversal.cpp
@@ -60,6 +60,7 @@ int main()
             cout << "Query is commented out: " << query << endl;
             continue;
         }
+        cout << "QUERY IS: " << query << endl;
         auto print_visitor = new PrintVisitor(cout);
         cypher::Compiler compiler;
         auto tree = compiler.syntax_tree(query);