memgraph/tests/manual/queries.cpp
Kruno Tomola Fabro 5a42e15c4a Alpha version of label indexes.
Squashed messages from 9 commits:

9.
Properties now uses PropertyFamily and contained classes.
Fetching,seting,clearing properties can be done with PropertyFamilyKey or PropertyTypeKey.
Hierarchy of newly added clases is:
Vertices -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}
Edges -n-> PropertyFamily {name: String} <-1-n-> PropertyType {type: Property::Flags}

PropertyFamilyKey -> PropertyType
PropertyTypeKey -> PropertyType

PropertyType t0,t1;
let t0!=t1 be true
let t0.family==t1.family be true

then next is true
PropertyTypeKey{&t0}!=PropertyTypeKey{&t1}
PropertyFamilyKey{&t0}==PropertyFamilyKey{&t1}
PropertyFamilyKey{&t0}==PropertyTypeKey{&t1}
PropertyTypeKey{&t0}==PropertyFamilyKey{&t1}

8.
Intermedate commit.
Noticed that integration queries throw SEGFAULT.

7.
Defined interface for indexes.
Fixed three memory leaks.
Fixed integration_queries test which now passes.

6.
Commit which return Xorshift128plus to valid shape.

5.
Tmp commit.

4.
Label Index is compiling.

3.
tmp

2.
Vertex::Accessor now updates Label index.

1.
Applied changes for code review.
2016-08-18 15:34:36 +01:00

50 lines
1.3 KiB
C++

#include <iostream>
#include "query_engine/hardcode/queries.hpp"
#include "storage/edges.cpp"
#include "storage/edges.hpp"
#include "storage/vertices.cpp"
#include "storage/vertices.hpp"
using namespace std;
int main(int argc, char **argv)
{
Db db;
auto queries = load_queries(db);
// auto arguments = all_arguments(argc, argv);
// auto input_query = extract_query(arguments);
auto stripper = make_query_stripper(TK_LONG, TK_FLOAT, TK_STR, TK_BOOL);
// auto stripped = stripper.strip(input_query);
//
// auto time = timer<ms>([&stripped, &queries]() {
// for (int i = 0; i < 1000000; ++i) {
// queries[stripped.hash](stripped.arguments);
// }
// });
// std::cout << time << std::endl;
vector<string> history;
string command;
cout << "-- Memgraph query engine --" << endl;
do {
cout << "> ";
getline(cin, command);
history.push_back(command);
auto stripped = stripper.strip(command);
if (queries.find(stripped.hash) == queries.end()) {
cout << "unsupported query" << endl;
continue;
}
auto result = queries[stripped.hash](stripped.arguments);
cout << "RETURN: " << result << endl;
} while (command != "quit");
return 0;
}