flowquery 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/python-publish.yml +97 -0
- package/dist/compute/runner.d.ts +3 -2
- package/dist/compute/runner.d.ts.map +1 -1
- package/dist/compute/runner.js +7 -7
- package/dist/compute/runner.js.map +1 -1
- package/dist/flowquery.min.js +1 -1
- package/dist/graph/data.d.ts +31 -0
- package/dist/graph/data.d.ts.map +1 -0
- package/dist/graph/data.js +110 -0
- package/dist/graph/data.js.map +1 -0
- package/dist/graph/database.d.ts +20 -0
- package/dist/graph/database.d.ts.map +1 -0
- package/dist/graph/database.js +77 -0
- package/dist/graph/database.js.map +1 -0
- package/dist/graph/hops.d.ts +11 -0
- package/dist/graph/hops.d.ts.map +1 -0
- package/dist/graph/hops.js +25 -0
- package/dist/graph/hops.js.map +1 -0
- package/dist/graph/node.d.ts +35 -0
- package/dist/graph/node.d.ts.map +1 -0
- package/dist/graph/node.js +113 -0
- package/dist/graph/node.js.map +1 -0
- package/dist/graph/node_data.d.ts +11 -0
- package/dist/graph/node_data.d.ts.map +1 -0
- package/dist/graph/node_data.js +20 -0
- package/dist/graph/node_data.js.map +1 -0
- package/dist/graph/node_reference.d.ts +10 -0
- package/dist/graph/node_reference.d.ts.map +1 -0
- package/dist/graph/node_reference.js +52 -0
- package/dist/graph/node_reference.js.map +1 -0
- package/dist/graph/pattern.d.ts +18 -0
- package/dist/graph/pattern.d.ts.map +1 -0
- package/dist/graph/pattern.js +114 -0
- package/dist/graph/pattern.js.map +1 -0
- package/dist/graph/pattern_expression.d.ts +14 -0
- package/dist/graph/pattern_expression.d.ts.map +1 -0
- package/dist/graph/pattern_expression.js +58 -0
- package/dist/graph/pattern_expression.js.map +1 -0
- package/dist/graph/patterns.d.ts +11 -0
- package/dist/graph/patterns.d.ts.map +1 -0
- package/dist/graph/patterns.js +49 -0
- package/dist/graph/patterns.js.map +1 -0
- package/dist/graph/physical_node.d.ts +10 -0
- package/dist/graph/physical_node.d.ts.map +1 -0
- package/dist/graph/physical_node.js +40 -0
- package/dist/graph/physical_node.js.map +1 -0
- package/dist/graph/physical_relationship.d.ts +10 -0
- package/dist/graph/physical_relationship.d.ts.map +1 -0
- package/dist/graph/physical_relationship.js +40 -0
- package/dist/graph/physical_relationship.js.map +1 -0
- package/dist/graph/relationship.d.ts +40 -0
- package/dist/graph/relationship.d.ts.map +1 -0
- package/dist/graph/relationship.js +124 -0
- package/dist/graph/relationship.js.map +1 -0
- package/dist/graph/relationship_data.d.ts +12 -0
- package/dist/graph/relationship_data.d.ts.map +1 -0
- package/dist/graph/relationship_data.js +40 -0
- package/dist/graph/relationship_data.js.map +1 -0
- package/dist/graph/relationship_match_collector.d.ts +19 -0
- package/dist/graph/relationship_match_collector.d.ts.map +1 -0
- package/dist/graph/relationship_match_collector.js +55 -0
- package/dist/graph/relationship_match_collector.js.map +1 -0
- package/dist/graph/relationship_reference.d.ts +8 -0
- package/dist/graph/relationship_reference.d.ts.map +1 -0
- package/dist/graph/relationship_reference.js +37 -0
- package/dist/graph/relationship_reference.js.map +1 -0
- package/dist/parsing/base_parser.d.ts +1 -0
- package/dist/parsing/base_parser.d.ts.map +1 -1
- package/dist/parsing/base_parser.js +4 -1
- package/dist/parsing/base_parser.js.map +1 -1
- package/dist/parsing/context.d.ts +2 -2
- package/dist/parsing/context.js +5 -5
- package/dist/parsing/expressions/boolean.d.ts +8 -0
- package/dist/parsing/expressions/boolean.d.ts.map +1 -0
- package/dist/parsing/expressions/boolean.js +26 -0
- package/dist/parsing/expressions/boolean.js.map +1 -0
- package/dist/parsing/expressions/expression.d.ts +4 -1
- package/dist/parsing/expressions/expression.d.ts.map +1 -1
- package/dist/parsing/expressions/expression.js +15 -8
- package/dist/parsing/expressions/expression.js.map +1 -1
- package/dist/parsing/expressions/expression_map.d.ts +1 -0
- package/dist/parsing/expressions/expression_map.d.ts.map +1 -1
- package/dist/parsing/expressions/expression_map.js +3 -0
- package/dist/parsing/expressions/expression_map.js.map +1 -1
- package/dist/parsing/expressions/operator.d.ts +1 -1
- package/dist/parsing/expressions/operator.d.ts.map +1 -1
- package/dist/parsing/expressions/operator.js.map +1 -1
- package/dist/parsing/functions/function_factory.d.ts +13 -13
- package/dist/parsing/functions/function_factory.d.ts.map +1 -1
- package/dist/parsing/functions/function_factory.js +20 -18
- package/dist/parsing/functions/function_factory.js.map +1 -1
- package/dist/parsing/operations/call.d.ts.map +1 -1
- package/dist/parsing/operations/call.js +3 -1
- package/dist/parsing/operations/call.js.map +1 -1
- package/dist/parsing/operations/create_node.d.ts +14 -0
- package/dist/parsing/operations/create_node.d.ts.map +1 -0
- package/dist/parsing/operations/create_node.js +51 -0
- package/dist/parsing/operations/create_node.js.map +1 -0
- package/dist/parsing/operations/create_relationship.d.ts +14 -0
- package/dist/parsing/operations/create_relationship.d.ts.map +1 -0
- package/dist/parsing/operations/create_relationship.js +51 -0
- package/dist/parsing/operations/create_relationship.js.map +1 -0
- package/dist/parsing/operations/match.d.ts +15 -0
- package/dist/parsing/operations/match.d.ts.map +1 -0
- package/dist/parsing/operations/match.js +45 -0
- package/dist/parsing/operations/match.js.map +1 -0
- package/dist/parsing/operations/operation.d.ts +1 -0
- package/dist/parsing/operations/operation.d.ts.map +1 -1
- package/dist/parsing/operations/operation.js +6 -0
- package/dist/parsing/operations/operation.js.map +1 -1
- package/dist/parsing/operations/return.d.ts +1 -0
- package/dist/parsing/operations/return.d.ts.map +1 -1
- package/dist/parsing/operations/return.js +7 -1
- package/dist/parsing/operations/return.js.map +1 -1
- package/dist/parsing/operations/where.d.ts +1 -1
- package/dist/parsing/operations/where.d.ts.map +1 -1
- package/dist/parsing/operations/where.js +4 -0
- package/dist/parsing/operations/where.js.map +1 -1
- package/dist/parsing/parser.d.ts +10 -0
- package/dist/parsing/parser.d.ts.map +1 -1
- package/dist/parsing/parser.js +344 -5
- package/dist/parsing/parser.js.map +1 -1
- package/dist/parsing/token_to_node.d.ts.map +1 -1
- package/dist/parsing/token_to_node.js +7 -0
- package/dist/parsing/token_to_node.js.map +1 -1
- package/dist/tokenization/keyword.d.ts +1 -0
- package/dist/tokenization/keyword.d.ts.map +1 -1
- package/dist/tokenization/keyword.js +1 -0
- package/dist/tokenization/keyword.js.map +1 -1
- package/dist/tokenization/token.d.ts +4 -0
- package/dist/tokenization/token.d.ts.map +1 -1
- package/dist/tokenization/token.js +14 -1
- package/dist/tokenization/token.js.map +1 -1
- package/dist/tokenization/token_type.d.ts +1 -0
- package/dist/tokenization/token_type.d.ts.map +1 -1
- package/dist/tokenization/token_type.js +1 -0
- package/dist/tokenization/token_type.js.map +1 -1
- package/dist/tokenization/tokenizer.d.ts +2 -1
- package/dist/tokenization/tokenizer.d.ts.map +1 -1
- package/dist/tokenization/tokenizer.js +25 -12
- package/dist/tokenization/tokenizer.js.map +1 -1
- package/docs/flowquery.min.js +1 -1
- package/flowquery-py/README.md +166 -0
- package/flowquery-py/pyproject.toml +75 -0
- package/flowquery-py/setup_env.ps1 +92 -0
- package/flowquery-py/setup_env.sh +87 -0
- package/flowquery-py/src/__init__.py +34 -0
- package/flowquery-py/src/__main__.py +10 -0
- package/flowquery-py/src/compute/__init__.py +5 -0
- package/flowquery-py/src/compute/runner.py +60 -0
- package/flowquery-py/src/extensibility.py +52 -0
- package/flowquery-py/src/graph/__init__.py +31 -0
- package/flowquery-py/src/graph/data.py +118 -0
- package/flowquery-py/src/graph/database.py +82 -0
- package/flowquery-py/src/graph/hops.py +43 -0
- package/flowquery-py/src/graph/node.py +112 -0
- package/flowquery-py/src/graph/node_data.py +26 -0
- package/flowquery-py/src/graph/node_reference.py +49 -0
- package/flowquery-py/src/graph/pattern.py +125 -0
- package/flowquery-py/src/graph/pattern_expression.py +62 -0
- package/flowquery-py/src/graph/patterns.py +42 -0
- package/flowquery-py/src/graph/physical_node.py +40 -0
- package/flowquery-py/src/graph/physical_relationship.py +36 -0
- package/flowquery-py/src/graph/relationship.py +135 -0
- package/flowquery-py/src/graph/relationship_data.py +33 -0
- package/flowquery-py/src/graph/relationship_match_collector.py +77 -0
- package/flowquery-py/src/graph/relationship_reference.py +21 -0
- package/flowquery-py/src/io/__init__.py +5 -0
- package/flowquery-py/src/io/command_line.py +67 -0
- package/flowquery-py/src/parsing/__init__.py +17 -0
- package/flowquery-py/src/parsing/alias.py +20 -0
- package/flowquery-py/src/parsing/alias_option.py +11 -0
- package/flowquery-py/src/parsing/ast_node.py +146 -0
- package/flowquery-py/src/parsing/base_parser.py +84 -0
- package/flowquery-py/src/parsing/components/__init__.py +19 -0
- package/flowquery-py/src/parsing/components/csv.py +8 -0
- package/flowquery-py/src/parsing/components/from_.py +10 -0
- package/flowquery-py/src/parsing/components/headers.py +12 -0
- package/flowquery-py/src/parsing/components/json.py +8 -0
- package/flowquery-py/src/parsing/components/null.py +10 -0
- package/flowquery-py/src/parsing/components/post.py +8 -0
- package/flowquery-py/src/parsing/components/text.py +8 -0
- package/flowquery-py/src/parsing/context.py +50 -0
- package/flowquery-py/src/parsing/data_structures/__init__.py +15 -0
- package/flowquery-py/src/parsing/data_structures/associative_array.py +41 -0
- package/flowquery-py/src/parsing/data_structures/json_array.py +30 -0
- package/flowquery-py/src/parsing/data_structures/key_value_pair.py +38 -0
- package/flowquery-py/src/parsing/data_structures/lookup.py +49 -0
- package/flowquery-py/src/parsing/data_structures/range_lookup.py +42 -0
- package/flowquery-py/src/parsing/expressions/__init__.py +57 -0
- package/flowquery-py/src/parsing/expressions/boolean.py +20 -0
- package/flowquery-py/src/parsing/expressions/expression.py +138 -0
- package/flowquery-py/src/parsing/expressions/expression_map.py +26 -0
- package/flowquery-py/src/parsing/expressions/f_string.py +27 -0
- package/flowquery-py/src/parsing/expressions/identifier.py +20 -0
- package/flowquery-py/src/parsing/expressions/number.py +32 -0
- package/flowquery-py/src/parsing/expressions/operator.py +169 -0
- package/flowquery-py/src/parsing/expressions/reference.py +47 -0
- package/flowquery-py/src/parsing/expressions/string.py +27 -0
- package/flowquery-py/src/parsing/functions/__init__.py +75 -0
- package/flowquery-py/src/parsing/functions/aggregate_function.py +60 -0
- package/flowquery-py/src/parsing/functions/async_function.py +62 -0
- package/flowquery-py/src/parsing/functions/avg.py +55 -0
- package/flowquery-py/src/parsing/functions/collect.py +75 -0
- package/flowquery-py/src/parsing/functions/function.py +68 -0
- package/flowquery-py/src/parsing/functions/function_factory.py +173 -0
- package/flowquery-py/src/parsing/functions/function_metadata.py +149 -0
- package/flowquery-py/src/parsing/functions/functions.py +59 -0
- package/flowquery-py/src/parsing/functions/join.py +47 -0
- package/flowquery-py/src/parsing/functions/keys.py +34 -0
- package/flowquery-py/src/parsing/functions/predicate_function.py +46 -0
- package/flowquery-py/src/parsing/functions/predicate_sum.py +47 -0
- package/flowquery-py/src/parsing/functions/rand.py +28 -0
- package/flowquery-py/src/parsing/functions/range_.py +34 -0
- package/flowquery-py/src/parsing/functions/reducer_element.py +15 -0
- package/flowquery-py/src/parsing/functions/replace.py +37 -0
- package/flowquery-py/src/parsing/functions/round_.py +32 -0
- package/flowquery-py/src/parsing/functions/size.py +32 -0
- package/flowquery-py/src/parsing/functions/split.py +47 -0
- package/flowquery-py/src/parsing/functions/stringify.py +47 -0
- package/flowquery-py/src/parsing/functions/sum.py +51 -0
- package/flowquery-py/src/parsing/functions/to_json.py +33 -0
- package/flowquery-py/src/parsing/functions/type_.py +47 -0
- package/flowquery-py/src/parsing/functions/value_holder.py +24 -0
- package/flowquery-py/src/parsing/logic/__init__.py +15 -0
- package/flowquery-py/src/parsing/logic/case.py +29 -0
- package/flowquery-py/src/parsing/logic/else_.py +12 -0
- package/flowquery-py/src/parsing/logic/end.py +8 -0
- package/flowquery-py/src/parsing/logic/then.py +12 -0
- package/flowquery-py/src/parsing/logic/when.py +10 -0
- package/flowquery-py/src/parsing/operations/__init__.py +35 -0
- package/flowquery-py/src/parsing/operations/aggregated_return.py +24 -0
- package/flowquery-py/src/parsing/operations/aggregated_with.py +22 -0
- package/flowquery-py/src/parsing/operations/call.py +74 -0
- package/flowquery-py/src/parsing/operations/create_node.py +34 -0
- package/flowquery-py/src/parsing/operations/create_relationship.py +34 -0
- package/flowquery-py/src/parsing/operations/group_by.py +130 -0
- package/flowquery-py/src/parsing/operations/limit.py +22 -0
- package/flowquery-py/src/parsing/operations/load.py +140 -0
- package/flowquery-py/src/parsing/operations/match.py +29 -0
- package/flowquery-py/src/parsing/operations/operation.py +69 -0
- package/flowquery-py/src/parsing/operations/projection.py +21 -0
- package/flowquery-py/src/parsing/operations/return_op.py +50 -0
- package/flowquery-py/src/parsing/operations/unwind.py +37 -0
- package/flowquery-py/src/parsing/operations/where.py +41 -0
- package/flowquery-py/src/parsing/operations/with_op.py +18 -0
- package/flowquery-py/src/parsing/parser.py +1011 -0
- package/flowquery-py/src/parsing/token_to_node.py +109 -0
- package/flowquery-py/src/tokenization/__init__.py +23 -0
- package/flowquery-py/src/tokenization/keyword.py +48 -0
- package/flowquery-py/src/tokenization/operator.py +29 -0
- package/flowquery-py/src/tokenization/string_walker.py +158 -0
- package/flowquery-py/src/tokenization/symbol.py +19 -0
- package/flowquery-py/src/tokenization/token.py +659 -0
- package/flowquery-py/src/tokenization/token_mapper.py +52 -0
- package/flowquery-py/src/tokenization/token_type.py +21 -0
- package/flowquery-py/src/tokenization/tokenizer.py +214 -0
- package/flowquery-py/src/tokenization/trie.py +124 -0
- package/flowquery-py/src/utils/__init__.py +6 -0
- package/flowquery-py/src/utils/object_utils.py +20 -0
- package/flowquery-py/src/utils/string_utils.py +113 -0
- package/flowquery-py/tests/__init__.py +1 -0
- package/flowquery-py/tests/compute/__init__.py +1 -0
- package/flowquery-py/tests/compute/test_runner.py +1335 -0
- package/flowquery-py/tests/graph/__init__.py +1 -0
- package/flowquery-py/tests/graph/test_create.py +56 -0
- package/flowquery-py/tests/graph/test_data.py +73 -0
- package/flowquery-py/tests/graph/test_match.py +40 -0
- package/flowquery-py/tests/parsing/__init__.py +1 -0
- package/flowquery-py/tests/parsing/test_context.py +34 -0
- package/flowquery-py/tests/parsing/test_expression.py +49 -0
- package/flowquery-py/tests/parsing/test_parser.py +674 -0
- package/flowquery-py/tests/test_extensibility.py +611 -0
- package/flowquery-py/tests/tokenization/__init__.py +1 -0
- package/flowquery-py/tests/tokenization/test_token_mapper.py +60 -0
- package/flowquery-py/tests/tokenization/test_tokenizer.py +164 -0
- package/flowquery-py/tests/tokenization/test_trie.py +30 -0
- package/flowquery-vscode/flowQueryEngine/flowquery.min.js +1 -1
- package/misc/apps/RAG/package.json +1 -1
- package/misc/apps/RAG/src/components/AdaptiveCardRenderer.tsx +76 -8
- package/misc/apps/RAG/src/components/index.ts +19 -10
- package/misc/apps/RAG/src/plugins/loaders/CatFacts.ts +21 -26
- package/misc/apps/RAG/src/plugins/loaders/FetchJson.ts +24 -25
- package/misc/apps/RAG/src/plugins/loaders/Form.ts +163 -147
- package/misc/apps/RAG/src/plugins/loaders/Llm.ts +103 -90
- package/misc/apps/RAG/src/plugins/loaders/MockData.ts +80 -130
- package/misc/apps/RAG/src/plugins/loaders/Table.ts +104 -101
- package/misc/apps/RAG/src/plugins/loaders/Weather.ts +47 -36
- package/misc/apps/RAG/src/prompts/FlowQuerySystemPrompt.ts +89 -78
- package/package.json +1 -1
- package/src/compute/runner.ts +24 -19
- package/src/graph/data.ts +112 -0
- package/src/graph/database.ts +63 -0
- package/src/graph/hops.ts +22 -0
- package/src/graph/node.ts +99 -0
- package/src/graph/node_data.ts +18 -0
- package/src/graph/node_reference.ts +33 -0
- package/src/graph/pattern.ts +101 -0
- package/src/graph/pattern_expression.ts +37 -0
- package/src/graph/patterns.ts +36 -0
- package/src/graph/physical_node.ts +23 -0
- package/src/graph/physical_relationship.ts +23 -0
- package/src/graph/relationship.ts +116 -0
- package/src/graph/relationship_data.ts +27 -0
- package/src/graph/relationship_match_collector.ts +58 -0
- package/src/graph/relationship_reference.ts +24 -0
- package/src/parsing/base_parser.ts +20 -14
- package/src/parsing/context.ts +14 -14
- package/src/parsing/expressions/boolean.ts +21 -0
- package/src/parsing/expressions/expression.ts +34 -26
- package/src/parsing/expressions/expression_map.ts +3 -0
- package/src/parsing/expressions/operator.ts +19 -1
- package/src/parsing/functions/function_factory.ts +45 -45
- package/src/parsing/operations/call.ts +3 -1
- package/src/parsing/operations/create_node.ts +39 -0
- package/src/parsing/operations/create_relationship.ts +38 -0
- package/src/parsing/operations/match.ts +31 -0
- package/src/parsing/operations/operation.ts +3 -0
- package/src/parsing/operations/return.ts +11 -7
- package/src/parsing/operations/where.ts +10 -6
- package/src/parsing/parser.ts +346 -8
- package/src/parsing/token_to_node.ts +6 -0
- package/src/tokenization/keyword.ts +41 -40
- package/src/tokenization/token.ts +21 -1
- package/src/tokenization/token_type.ts +2 -1
- package/src/tokenization/tokenizer.ts +52 -31
- package/tests/compute/runner.test.ts +660 -6
- package/tests/extensibility.test.ts +97 -93
- package/tests/graph/create.test.ts +36 -0
- package/tests/graph/data.test.ts +58 -0
- package/tests/graph/match.test.ts +29 -0
- package/tests/parsing/parser.test.ts +276 -8
- package/tests/tokenization/tokenizer.test.ts +107 -17
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class IndexEntry {
|
|
4
|
+
constructor(positions = []) {
|
|
5
|
+
this._index = -1;
|
|
6
|
+
this._positions = positions;
|
|
7
|
+
}
|
|
8
|
+
add(position) {
|
|
9
|
+
this._positions.push(position);
|
|
10
|
+
}
|
|
11
|
+
get position() {
|
|
12
|
+
return this._positions[this._index];
|
|
13
|
+
}
|
|
14
|
+
reset() {
|
|
15
|
+
this._index = -1;
|
|
16
|
+
}
|
|
17
|
+
next() {
|
|
18
|
+
if (this._index < this._positions.length - 1) {
|
|
19
|
+
this._index++;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
clone() {
|
|
25
|
+
return new IndexEntry([...this._positions]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class Layer {
|
|
29
|
+
constructor(index) {
|
|
30
|
+
this._index = new Map();
|
|
31
|
+
this._current = -1;
|
|
32
|
+
this._index = index;
|
|
33
|
+
}
|
|
34
|
+
get index() {
|
|
35
|
+
return this._index;
|
|
36
|
+
}
|
|
37
|
+
get current() {
|
|
38
|
+
return this._current;
|
|
39
|
+
}
|
|
40
|
+
set current(value) {
|
|
41
|
+
this._current = value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
class Data {
|
|
45
|
+
constructor(records = []) {
|
|
46
|
+
this._records = [];
|
|
47
|
+
this._layers = new Map();
|
|
48
|
+
this._records = records;
|
|
49
|
+
this._layers.set(0, new Layer(new Map()));
|
|
50
|
+
}
|
|
51
|
+
_buildIndex(key, level = 0) {
|
|
52
|
+
this.layer(level).index.clear();
|
|
53
|
+
this._records.forEach((record, idx) => {
|
|
54
|
+
if (record.hasOwnProperty(key)) {
|
|
55
|
+
if (!this.layer(level).index.has(record[key])) {
|
|
56
|
+
this.layer(level).index.set(record[key], new IndexEntry());
|
|
57
|
+
}
|
|
58
|
+
this.layer(level).index.get(record[key]).add(idx);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
layer(level = 0) {
|
|
63
|
+
if (!this._layers.has(level)) {
|
|
64
|
+
const first = this._layers.get(0);
|
|
65
|
+
const cloned = new Map();
|
|
66
|
+
for (const [key, entry] of first.index) {
|
|
67
|
+
cloned.set(key, entry.clone());
|
|
68
|
+
}
|
|
69
|
+
this._layers.set(level, new Layer(cloned));
|
|
70
|
+
}
|
|
71
|
+
return this._layers.get(level);
|
|
72
|
+
}
|
|
73
|
+
_find(key, level = 0) {
|
|
74
|
+
if (!this.layer(level).index.has(key)) {
|
|
75
|
+
this.layer(level).current = this._records.length; // Move to end
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
const entry = this.layer(level).index.get(key);
|
|
80
|
+
const more = entry.next();
|
|
81
|
+
if (!more) {
|
|
82
|
+
this.layer(level).current = this._records.length; // Move to end
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
this.layer(level).current = entry.position;
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
reset() {
|
|
90
|
+
this.layer(0).current = -1;
|
|
91
|
+
for (const entry of this.layer(0).index.values()) {
|
|
92
|
+
entry.reset();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
next(level = 0) {
|
|
96
|
+
if (this.layer(level).current < this._records.length - 1) {
|
|
97
|
+
this.layer(level).current++;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
current(level = 0) {
|
|
103
|
+
if (this.layer(level).current < this._records.length) {
|
|
104
|
+
return this._records[this.layer(level).current];
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.default = Data;
|
|
110
|
+
//# sourceMappingURL=data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/graph/data.ts"],"names":[],"mappings":";;AAAA,MAAM,UAAU;IAIZ,YAAY,YAAsB,EAAE;QAF5B,WAAM,GAAW,CAAC,CAAC,CAAC;QAGxB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IACM,GAAG,CAAC,QAAgB;QACvB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IACD,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IACM,KAAK;QACR,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrB,CAAC;IACM,IAAI;QACP,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAA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CAAC;YACnD,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,kBAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ASTNode from "../parsing/ast_node";
|
|
2
|
+
import Node from "./node";
|
|
3
|
+
import NodeData from "./node_data";
|
|
4
|
+
import PhysicalNode from "./physical_node";
|
|
5
|
+
import PhysicalRelationship from "./physical_relationship";
|
|
6
|
+
import Relationship from "./relationship";
|
|
7
|
+
import RelationshipData from "./relationship_data";
|
|
8
|
+
declare class Database {
|
|
9
|
+
private static instance;
|
|
10
|
+
private static nodes;
|
|
11
|
+
private static relationships;
|
|
12
|
+
static getInstance(): Database;
|
|
13
|
+
addNode(node: Node, statement: ASTNode): void;
|
|
14
|
+
getNode(node: Node): PhysicalNode | null;
|
|
15
|
+
addRelationship(relationship: Relationship, statement: ASTNode): void;
|
|
16
|
+
getRelationship(relationship: Relationship): PhysicalRelationship | null;
|
|
17
|
+
getData(element: Node | Relationship): Promise<NodeData | RelationshipData>;
|
|
18
|
+
}
|
|
19
|
+
export default Database;
|
|
20
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/graph/database.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,QAAwB,MAAM,aAAa,CAAC;AACnD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAwC,MAAM,qBAAqB,CAAC;AAE3E,cAAM,QAAQ;IACV,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAW;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAwC;IAC5D,OAAO,CAAC,MAAM,CAAC,aAAa,CAAgD;WAE9D,WAAW,IAAI,QAAQ;IAM9B,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAQ7C,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,GAAG,IAAI;IAGxC,eAAe,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAQrE,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,oBAAoB,GAAG,IAAI;IAGlE,OAAO,CAAC,OAAO,EAAE,IAAI,GAAG,YAAY,GAAG,OAAO,CAAC,QAAQ,GAAG,gBAAgB,CAAC;CAmB3F;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const node_1 = __importDefault(require("./node"));
|
|
16
|
+
const node_data_1 = __importDefault(require("./node_data"));
|
|
17
|
+
const physical_node_1 = __importDefault(require("./physical_node"));
|
|
18
|
+
const physical_relationship_1 = __importDefault(require("./physical_relationship"));
|
|
19
|
+
const relationship_1 = __importDefault(require("./relationship"));
|
|
20
|
+
const relationship_data_1 = __importDefault(require("./relationship_data"));
|
|
21
|
+
class Database {
|
|
22
|
+
static getInstance() {
|
|
23
|
+
if (!Database.instance) {
|
|
24
|
+
Database.instance = new Database();
|
|
25
|
+
}
|
|
26
|
+
return Database.instance;
|
|
27
|
+
}
|
|
28
|
+
addNode(node, statement) {
|
|
29
|
+
if (node.label === null) {
|
|
30
|
+
throw new Error("Node label is null");
|
|
31
|
+
}
|
|
32
|
+
const physical = new physical_node_1.default(null, node.label);
|
|
33
|
+
physical.statement = statement;
|
|
34
|
+
Database.nodes.set(node.label, physical);
|
|
35
|
+
}
|
|
36
|
+
getNode(node) {
|
|
37
|
+
return Database.nodes.get(node.label) || null;
|
|
38
|
+
}
|
|
39
|
+
addRelationship(relationship, statement) {
|
|
40
|
+
if (relationship.type === null) {
|
|
41
|
+
throw new Error("Relationship type is null");
|
|
42
|
+
}
|
|
43
|
+
const physical = new physical_relationship_1.default(null, relationship.type);
|
|
44
|
+
physical.statement = statement;
|
|
45
|
+
Database.relationships.set(relationship.type, physical);
|
|
46
|
+
}
|
|
47
|
+
getRelationship(relationship) {
|
|
48
|
+
return Database.relationships.get(relationship.type) || null;
|
|
49
|
+
}
|
|
50
|
+
getData(element) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
if (element instanceof node_1.default) {
|
|
53
|
+
const node = this.getNode(element);
|
|
54
|
+
if (node === null) {
|
|
55
|
+
throw new Error(`Physical node not found for label ${element.label}`);
|
|
56
|
+
}
|
|
57
|
+
const data = yield node.data();
|
|
58
|
+
return new node_data_1.default(data);
|
|
59
|
+
}
|
|
60
|
+
else if (element instanceof relationship_1.default) {
|
|
61
|
+
const relationship = this.getRelationship(element);
|
|
62
|
+
if (relationship === null) {
|
|
63
|
+
throw new Error(`Physical relationship not found for type ${element.type}`);
|
|
64
|
+
}
|
|
65
|
+
const data = yield relationship.data();
|
|
66
|
+
return new relationship_data_1.default(data);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
throw new Error("Element is neither Node nor Relationship");
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
Database.nodes = new Map();
|
|
75
|
+
Database.relationships = new Map();
|
|
76
|
+
exports.default = Database;
|
|
77
|
+
//# sourceMappingURL=database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/graph/database.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,kDAA0B;AAC1B,4DAAmD;AACnD,oEAA2C;AAC3C,oFAA2D;AAC3D,kEAA0C;AAC1C,4EAA2E;AAE3E,MAAM,QAAQ;IAKH,MAAM,CAAC,WAAW;QACrB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACrB,QAAQ,CAAC,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QACvC,CAAC;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC;IAC7B,CAAC;IACM,OAAO,CAAC,IAAU,EAAE,SAAkB;QACzC,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC1C,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,uBAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACpD,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;QAC/B,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACM,OAAO,CAAC,IAAU;QACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAM,CAAC,IAAI,IAAI,CAA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gBACvC,OAAO,IAAI,2BAAgB,CAAC,IAA4B,CAAC,CAAC;YAC9D,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAChE,CAAC;QACL,CAAC;KAAA;;AAjDc,cAAK,GAA8B,IAAI,GAAG,EAAE,CAAC;AAC7C,sBAAa,GAAsC,IAAI,GAAG,EAAE,CAAC;AAmDhF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hops.d.ts","sourceRoot":"","sources":["../../src/graph/hops.ts"],"names":[],"mappings":"AAAA,cAAM,IAAI;IACN,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,IAAI,CAAa;IAEzB,IAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAEzB;IACD,IAAW,GAAG,IAAI,MAAM,CAEvB;IACD,IAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAEzB;IACD,IAAW,GAAG,IAAI,MAAM,CAEvB;IACM,KAAK,IAAI,OAAO;CAG1B;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Hops {
|
|
4
|
+
constructor() {
|
|
5
|
+
this._min = 0;
|
|
6
|
+
this._max = 1;
|
|
7
|
+
}
|
|
8
|
+
set min(min) {
|
|
9
|
+
this._min = min;
|
|
10
|
+
}
|
|
11
|
+
get min() {
|
|
12
|
+
return this._min;
|
|
13
|
+
}
|
|
14
|
+
set max(max) {
|
|
15
|
+
this._max = max;
|
|
16
|
+
}
|
|
17
|
+
get max() {
|
|
18
|
+
return this._max;
|
|
19
|
+
}
|
|
20
|
+
multi() {
|
|
21
|
+
return this._max > 1 || this._max === -1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = Hops;
|
|
25
|
+
//# sourceMappingURL=hops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hops.js","sourceRoot":"","sources":["../../src/graph/hops.ts"],"names":[],"mappings":";;AAAA,MAAM,IAAI;IAAV;QACY,SAAI,GAAW,CAAC,CAAC;QACjB,SAAI,GAAW,CAAC,CAAC;IAiB7B,CAAC;IAfG,IAAW,GAAG,CAAC,GAAW;QACtB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IACD,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,IAAW,GAAG,CAAC,GAAW;QACtB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IACD,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IACM,KAAK;QACR,OAAO,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC;CACJ;AAED,kBAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import ASTNode from "../parsing/ast_node";
|
|
2
|
+
import Expression from "../parsing/expressions/expression";
|
|
3
|
+
import NodeData, { NodeRecord } from "./node_data";
|
|
4
|
+
import Relationship from "./relationship";
|
|
5
|
+
declare class Node extends ASTNode {
|
|
6
|
+
protected _identifier: string | null;
|
|
7
|
+
protected _label: string | null;
|
|
8
|
+
protected _properties: Map<string, Expression>;
|
|
9
|
+
protected _value: NodeRecord | null;
|
|
10
|
+
protected _incoming: Relationship | null;
|
|
11
|
+
protected _outgoing: Relationship | null;
|
|
12
|
+
private _data;
|
|
13
|
+
private _todoNext;
|
|
14
|
+
constructor(identifier?: string | null, label?: string | null);
|
|
15
|
+
set identifier(identifier: string);
|
|
16
|
+
get identifier(): string | null;
|
|
17
|
+
set label(label: string);
|
|
18
|
+
get label(): string | null;
|
|
19
|
+
get properties(): Map<string, Expression>;
|
|
20
|
+
setProperty(key: string, value: Expression): void;
|
|
21
|
+
getProperty(key: string): Expression | null;
|
|
22
|
+
setValue(value: NodeRecord): void;
|
|
23
|
+
value(): NodeRecord | null;
|
|
24
|
+
set outgoing(relationship: Relationship | null);
|
|
25
|
+
get outgoing(): Relationship | null;
|
|
26
|
+
set incoming(relationship: Relationship | null);
|
|
27
|
+
get incoming(): Relationship | null;
|
|
28
|
+
setData(data: NodeData | null): void;
|
|
29
|
+
next(): Promise<void>;
|
|
30
|
+
find(id: string, hop?: number): Promise<void>;
|
|
31
|
+
set todoNext(func: (() => Promise<void>) | null);
|
|
32
|
+
runTodoNext(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export default Node;
|
|
35
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/graph/node.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAM,IAAK,SAAQ,OAAO;IACtB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IACvC,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;IAC3D,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAQ;IAE3C,SAAS,CAAC,SAAS,EAAE,YAAY,GAAG,IAAI,CAAQ;IAChD,SAAS,CAAC,SAAS,EAAE,YAAY,GAAG,IAAI,CAAQ;IAEhD,OAAO,CAAC,KAAK,CAAyB;IAOtC,OAAO,CAAC,SAAS,CAAsC;gBAE3C,UAAU,GAAE,MAAM,GAAG,IAAW,EAAE,KAAK,GAAE,MAAM,GAAG,IAAW;IAKzE,IAAW,UAAU,CAAC,UAAU,EAAE,MAAM,EAEvC;IACD,IAAW,UAAU,IAAI,MAAM,GAAG,IAAI,CAErC;IACD,IAAW,KAAK,CAAC,KAAK,EAAE,MAAM,EAE7B;IACD,IAAW,KAAK,IAAI,MAAM,GAAG,IAAI,CAEhC;IACD,IAAW,UAAU,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAE/C;IACM,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAGjD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAG3C,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAGjC,KAAK,IAAI,UAAU,GAAG,IAAI;IAGjC,IAAW,QAAQ,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,EAEpD;IACD,IAAW,QAAQ,IAAI,YAAY,GAAG,IAAI,CAEzC;IACD,IAAW,QAAQ,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,EAEpD;IACD,IAAW,QAAQ,IAAI,YAAY,GAAG,IAAI,CAEzC;IACM,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI;IAG9B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQrB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAU7D,IAAW,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,EAErD;IACY,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5C;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const ast_node_1 = __importDefault(require("../parsing/ast_node"));
|
|
16
|
+
class Node extends ast_node_1.default {
|
|
17
|
+
constructor(identifier = null, label = null) {
|
|
18
|
+
super();
|
|
19
|
+
this._identifier = null;
|
|
20
|
+
this._label = null;
|
|
21
|
+
this._properties = new Map();
|
|
22
|
+
this._value = null;
|
|
23
|
+
this._incoming = null;
|
|
24
|
+
this._outgoing = null;
|
|
25
|
+
this._data = null;
|
|
26
|
+
// Function to be called after each 'next' and 'find' operation
|
|
27
|
+
// It is used to chain operations in a traversal
|
|
28
|
+
// For example, after matching on a graph pattern, we may want to
|
|
29
|
+
// continue to the next node or relationship in the pattern, or
|
|
30
|
+
// perform the next operation in a statement.
|
|
31
|
+
this._todoNext = null;
|
|
32
|
+
this._identifier = identifier;
|
|
33
|
+
this._label = label;
|
|
34
|
+
}
|
|
35
|
+
set identifier(identifier) {
|
|
36
|
+
this._identifier = identifier;
|
|
37
|
+
}
|
|
38
|
+
get identifier() {
|
|
39
|
+
return this._identifier;
|
|
40
|
+
}
|
|
41
|
+
set label(label) {
|
|
42
|
+
this._label = label;
|
|
43
|
+
}
|
|
44
|
+
get label() {
|
|
45
|
+
return this._label;
|
|
46
|
+
}
|
|
47
|
+
get properties() {
|
|
48
|
+
return this._properties;
|
|
49
|
+
}
|
|
50
|
+
setProperty(key, value) {
|
|
51
|
+
this._properties.set(key, value);
|
|
52
|
+
}
|
|
53
|
+
getProperty(key) {
|
|
54
|
+
return this._properties.get(key) || null;
|
|
55
|
+
}
|
|
56
|
+
setValue(value) {
|
|
57
|
+
this._value = value;
|
|
58
|
+
}
|
|
59
|
+
value() {
|
|
60
|
+
return this._value;
|
|
61
|
+
}
|
|
62
|
+
set outgoing(relationship) {
|
|
63
|
+
this._outgoing = relationship;
|
|
64
|
+
}
|
|
65
|
+
get outgoing() {
|
|
66
|
+
return this._outgoing;
|
|
67
|
+
}
|
|
68
|
+
set incoming(relationship) {
|
|
69
|
+
this._incoming = relationship;
|
|
70
|
+
}
|
|
71
|
+
get incoming() {
|
|
72
|
+
return this._incoming;
|
|
73
|
+
}
|
|
74
|
+
setData(data) {
|
|
75
|
+
this._data = data;
|
|
76
|
+
}
|
|
77
|
+
next() {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
var _a, _b, _c, _d;
|
|
80
|
+
(_a = this._data) === null || _a === void 0 ? void 0 : _a.reset();
|
|
81
|
+
while ((_b = this._data) === null || _b === void 0 ? void 0 : _b.next()) {
|
|
82
|
+
this.setValue((_c = this._data) === null || _c === void 0 ? void 0 : _c.current());
|
|
83
|
+
yield ((_d = this._outgoing) === null || _d === void 0 ? void 0 : _d.find(this._value.id));
|
|
84
|
+
yield this.runTodoNext();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
find(id_1) {
|
|
89
|
+
return __awaiter(this, arguments, void 0, function* (id, hop = 0) {
|
|
90
|
+
var _a, _b, _c, _d, _e;
|
|
91
|
+
(_a = this._data) === null || _a === void 0 ? void 0 : _a.reset();
|
|
92
|
+
while ((_b = this._data) === null || _b === void 0 ? void 0 : _b.find(id, hop)) {
|
|
93
|
+
this.setValue((_c = this._data) === null || _c === void 0 ? void 0 : _c.current(hop));
|
|
94
|
+
(_d = this._incoming) === null || _d === void 0 ? void 0 : _d.setEndNode(this);
|
|
95
|
+
yield ((_e = this._outgoing) === null || _e === void 0 ? void 0 : _e.find(this._value.id, hop));
|
|
96
|
+
yield this.runTodoNext();
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// For setting a function to be called after each 'next' and 'find' operation
|
|
101
|
+
set todoNext(func) {
|
|
102
|
+
this._todoNext = func;
|
|
103
|
+
}
|
|
104
|
+
runTodoNext() {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
if (this._todoNext) {
|
|
107
|
+
yield this._todoNext();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.default = Node;
|
|
113
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/graph/node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mEAA0C;AAK1C,MAAM,IAAK,SAAQ,kBAAO;IAkBtB,YAAY,aAA4B,IAAI,EAAE,QAAuB,IAAI;QACrE,KAAK,EAAE,CAAC;QAlBF,gBAAW,GAAkB,IAAI,CAAC;QAClC,WAAM,GAAkB,IAAI,CAAC;QAC7B,gBAAW,GAA4B,IAAI,GAAG,EAAE,CAAC;QACjD,WAAM,GAAsB,IAAI,CAAC;QAEjC,cAAS,GAAwB,IAAI,CAAC;QACtC,cAAS,GAAwB,IAAI,CAAC;QAExC,UAAK,GAAoB,IAAI,CAAC;QAEtC,+DAA+D;QAC/D,gDAAgD;QAChD,iEAAiE;QACjE,+DAA+D;QAC/D,6CAA6C;QACrC,cAAS,GAAiC,IAAI,CAAC;QAInD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IACD,IAAW,UAAU,CAAC,UAAkB;QACpC,IAAI,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constructor(records?: NodeRecord[]);
|
|
7
|
+
find(id: string, hop?: number): boolean;
|
|
8
|
+
current(hop?: number): NodeRecord | null;
|
|
9
|
+
}
|
|
10
|
+
export default NodeData;
|
|
11
|
+
//# sourceMappingURL=node_data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_data.d.ts","sourceRoot":"","sources":["../../src/graph/node_data.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE9D,cAAM,QAAS,SAAQ,IAAI;gBACX,OAAO,GAAE,UAAU,EAAO;IAI/B,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU,GAAG,OAAO;IAG1C,OAAO,CAAC,GAAG,GAAE,MAAU,GAAG,UAAU,GAAG,IAAI;CAGrD;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const data_1 = __importDefault(require("./data"));
|
|
7
|
+
class NodeData extends data_1.default {
|
|
8
|
+
constructor(records = []) {
|
|
9
|
+
super(records);
|
|
10
|
+
super._buildIndex("id");
|
|
11
|
+
}
|
|
12
|
+
find(id, hop = 0) {
|
|
13
|
+
return super._find(id, hop);
|
|
14
|
+
}
|
|
15
|
+
current(hop = 0) {
|
|
16
|
+
return super.current(hop);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = NodeData;
|
|
20
|
+
//# sourceMappingURL=node_data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_data.js","sourceRoot":"","sources":["../../src/graph/node_data.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAI1B,MAAM,QAAS,SAAQ,cAAI;IACvB,YAAY,UAAwB,EAAE;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IACM,IAAI,CAAC,EAAU,EAAE,MAAc,CAAC;QACnC,OAAO,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;IACM,OAAO,CAAC,MAAc,CAAC;QAC1B,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAsB,CAAC;IACnD,CAAC;CACJ;AAED,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Node from "./node";
|
|
2
|
+
declare class NodeReference extends Node {
|
|
3
|
+
private _reference;
|
|
4
|
+
constructor(base: Node, reference: Node);
|
|
5
|
+
get reference(): Node | null;
|
|
6
|
+
next(): Promise<void>;
|
|
7
|
+
find(id: string, hop?: number): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export default NodeReference;
|
|
10
|
+
//# sourceMappingURL=node_reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_reference.d.ts","sourceRoot":"","sources":["../../src/graph/node_reference.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,cAAM,aAAc,SAAQ,IAAI;IAC5B,OAAO,CAAC,UAAU,CAAqB;gBAC3B,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI;IASvC,IAAW,SAAS,IAAI,IAAI,GAAG,IAAI,CAElC;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAShE;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const node_1 = __importDefault(require("./node"));
|
|
16
|
+
class NodeReference extends node_1.default {
|
|
17
|
+
constructor(base, reference) {
|
|
18
|
+
super();
|
|
19
|
+
this._reference = null;
|
|
20
|
+
this._identifier = base.identifier;
|
|
21
|
+
this._label = base.label;
|
|
22
|
+
this._properties = base.properties;
|
|
23
|
+
this._outgoing = base.outgoing;
|
|
24
|
+
this._incoming = base.incoming;
|
|
25
|
+
this._reference = reference;
|
|
26
|
+
}
|
|
27
|
+
get reference() {
|
|
28
|
+
return this._reference;
|
|
29
|
+
}
|
|
30
|
+
next() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
var _a;
|
|
33
|
+
this.setValue(this._reference.value());
|
|
34
|
+
yield ((_a = this._outgoing) === null || _a === void 0 ? void 0 : _a.find(this._value.id));
|
|
35
|
+
yield this.runTodoNext();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
find(id_1) {
|
|
39
|
+
return __awaiter(this, arguments, void 0, function* (id, hop = 0) {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const referenced = (_a = this._reference) === null || _a === void 0 ? void 0 : _a.value();
|
|
42
|
+
if (id !== (referenced === null || referenced === void 0 ? void 0 : referenced.id)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.setValue(referenced);
|
|
46
|
+
yield ((_b = this._outgoing) === null || _b === void 0 ? void 0 : _b.find(this._value.id, hop));
|
|
47
|
+
yield this.runTodoNext();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.default = NodeReference;
|
|
52
|
+
//# sourceMappingURL=node_reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node_reference.js","sourceRoot":"","sources":["../../src/graph/node_reference.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,MAAM,aAAc,SAAQ,cAAI;IAE5B,YAAY,IAAU,EAAE,SAAe;QACnC,KAAK,EAAE,CAAC;QAFJ,eAAU,GAAgB,IAAI,CAAC;QAGnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IACD,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACY,IAAI;;;YACb,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAW,CAAC,KAAK,EAAG,CAAC,CAAC;YACzC,MAAM,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,IAAI,CAAC,IAAI,CAAC,MAAO,CAAC,EAAE,CAAC,CAAA,CAAC;YAC5C,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;KAAA;IACY,IAAI;6DAAC,EAAU,EAAE,MAAc,CAAC;;YACzC,MAAM,UAAU,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,EAAE,CAAC;YAC5C,IAAI,EAAE,MAAK,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,EAAE,CAAA,EAAE,CAAC;gBACxB,OAAO;YACX,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,UAAW,CAAC,CAAC;YAC3B,MAAM,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,IAAI,CAAC,IAAI,CAAC,MAAO,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA,CAAC;YACjD,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;KAAA;CACJ;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import ASTNode from "../parsing/ast_node";
|
|
2
|
+
import Node from "./node";
|
|
3
|
+
import Relationship from "./relationship";
|
|
4
|
+
declare class Pattern extends ASTNode {
|
|
5
|
+
private _identifier;
|
|
6
|
+
protected _chain: (Node | Relationship)[];
|
|
7
|
+
set identifier(id: string | null);
|
|
8
|
+
get identifier(): string | null;
|
|
9
|
+
addElement(element: Relationship | Node): void;
|
|
10
|
+
get chain(): (Node | Relationship)[];
|
|
11
|
+
get startNode(): Node;
|
|
12
|
+
get endNode(): Node;
|
|
13
|
+
value(): any;
|
|
14
|
+
values(): Generator<any>;
|
|
15
|
+
fetchData(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export default Pattern;
|
|
18
|
+
//# sourceMappingURL=pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/graph/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,OAAO,IAAI,MAAM,QAAQ,CAAC;AAG1B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAI1C,cAAM,OAAQ,SAAQ,OAAO;IACzB,OAAO,CAAC,WAAW,CAAuB;IAC1C,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,GAAG,YAAY,CAAC,EAAE,CAAM;IAC/C,IAAW,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,EAEtC;IACD,IAAW,UAAU,IAAI,MAAM,GAAG,IAAI,CAErC;IACM,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI;IAsBrD,IAAW,KAAK,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,EAAE,CAE1C;IACD,IAAW,SAAS,IAAI,IAAI,CAS3B;IACD,IAAW,OAAO,IAAI,IAAI,CASzB;IACM,KAAK,IAAI,GAAG;IAGX,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC;IAgBnB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAiB1C;AACD,eAAe,OAAO,CAAC"}
|