exonware-xwnode 0.0.1.13__py3-none-any.whl → 0.0.1.14__py3-none-any.whl
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.
- exonware/__init__.py +1 -1
- exonware/xwnode/__init__.py +1 -1
- exonware/xwnode/base.py +1 -1
- exonware/xwnode/common/__init__.py +20 -0
- exonware/xwnode/common/management/__init__.py +26 -0
- exonware/xwnode/{strategies → common/management}/manager.py +2 -2
- exonware/xwnode/common/monitoring/__init__.py +26 -0
- exonware/xwnode/{strategies → common/monitoring}/metrics.py +2 -2
- exonware/xwnode/{strategies → common/monitoring}/pattern_detector.py +2 -2
- exonware/xwnode/{strategies → common/monitoring}/performance_monitor.py +2 -2
- exonware/xwnode/common/patterns/__init__.py +26 -0
- exonware/xwnode/{strategies → common/patterns}/advisor.py +1 -1
- exonware/xwnode/{strategies → common/patterns}/flyweight.py +4 -4
- exonware/xwnode/{strategies → common/patterns}/registry.py +109 -112
- exonware/xwnode/common/utils/__init__.py +26 -0
- exonware/xwnode/{strategies/edges → edges/strategies}/__init__.py +1 -1
- exonware/xwnode/{strategies/edges → edges/strategies}/base.py +3 -3
- exonware/xwnode/facade.py +4 -3
- exonware/xwnode/{strategies/nodes → nodes/strategies}/__init__.py +1 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/adjacency_list.py +7 -2
- exonware/xwnode/{strategies/nodes → nodes/strategies}/aho_corasick.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/array_list.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/base.py +24 -4
- exonware/xwnode/nodes/strategies/contracts.py +116 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/deque.py +7 -2
- exonware/xwnode/{strategies/nodes → nodes/strategies}/hash_map.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/heap.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/linked_list.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_aho_corasick.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_array_list.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_avl_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_b_plus_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_bitmap.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_bitset_dynamic.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_bloom_filter.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_btree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_count_min_sketch.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_cow_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_fenwick_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_hash_map.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_heap.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_hyperloglog.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_linked_list.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_lsm_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_ordered_map.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_ordered_map_balanced.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_patricia.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_persistent_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_radix_trie.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_red_black_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_roaring_bitmap.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_segment_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_set_hash.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_set_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_skip_list.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_splay_tree.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_suffix_array.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_treap.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_tree_graph_hybrid.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_trie.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_union_find.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/node_xdata_optimized.py +4 -0
- exonware/xwnode/{strategies/nodes → nodes/strategies}/priority_queue.py +7 -2
- exonware/xwnode/{strategies/nodes → nodes/strategies}/queue.py +7 -2
- exonware/xwnode/{strategies/nodes → nodes/strategies}/sparse_matrix.py +7 -2
- exonware/xwnode/{strategies/nodes → nodes/strategies}/stack.py +7 -2
- exonware/xwnode/{strategies/nodes → nodes/strategies}/trie.py +6 -1
- exonware/xwnode/{strategies/nodes → nodes/strategies}/union_find.py +6 -1
- exonware/xwnode/queries/executors/__init__.py +47 -0
- exonware/xwnode/queries/executors/advanced/__init__.py +37 -0
- exonware/xwnode/queries/executors/advanced/aggregate_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/ask_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/construct_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/describe_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/for_loop_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/foreach_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/join_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/let_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/mutation_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/options_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/pipe_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/subscribe_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/subscription_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/union_executor.py +50 -0
- exonware/xwnode/queries/executors/advanced/window_executor.py +51 -0
- exonware/xwnode/queries/executors/advanced/with_cte_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/__init__.py +21 -0
- exonware/xwnode/queries/executors/aggregation/avg_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/count_executor.py +38 -0
- exonware/xwnode/queries/executors/aggregation/distinct_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/group_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/having_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/max_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/min_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/sum_executor.py +50 -0
- exonware/xwnode/queries/executors/aggregation/summarize_executor.py +50 -0
- exonware/xwnode/queries/executors/array/__init__.py +9 -0
- exonware/xwnode/queries/executors/array/indexing_executor.py +51 -0
- exonware/xwnode/queries/executors/array/slicing_executor.py +51 -0
- exonware/xwnode/queries/executors/base.py +257 -0
- exonware/xwnode/queries/executors/capability_checker.py +204 -0
- exonware/xwnode/queries/executors/contracts.py +166 -0
- exonware/xwnode/queries/executors/core/__init__.py +17 -0
- exonware/xwnode/queries/executors/core/create_executor.py +96 -0
- exonware/xwnode/queries/executors/core/delete_executor.py +99 -0
- exonware/xwnode/queries/executors/core/drop_executor.py +100 -0
- exonware/xwnode/queries/executors/core/insert_executor.py +39 -0
- exonware/xwnode/queries/executors/core/select_executor.py +152 -0
- exonware/xwnode/queries/executors/core/update_executor.py +102 -0
- exonware/xwnode/queries/executors/data/__init__.py +13 -0
- exonware/xwnode/queries/executors/data/alter_executor.py +50 -0
- exonware/xwnode/queries/executors/data/load_executor.py +50 -0
- exonware/xwnode/queries/executors/data/merge_executor.py +50 -0
- exonware/xwnode/queries/executors/data/store_executor.py +50 -0
- exonware/xwnode/queries/executors/engine.py +221 -0
- exonware/xwnode/queries/executors/errors.py +68 -0
- exonware/xwnode/queries/executors/filtering/__init__.py +25 -0
- exonware/xwnode/queries/executors/filtering/between_executor.py +80 -0
- exonware/xwnode/queries/executors/filtering/filter_executor.py +79 -0
- exonware/xwnode/queries/executors/filtering/has_executor.py +70 -0
- exonware/xwnode/queries/executors/filtering/in_executor.py +70 -0
- exonware/xwnode/queries/executors/filtering/like_executor.py +76 -0
- exonware/xwnode/queries/executors/filtering/optional_executor.py +76 -0
- exonware/xwnode/queries/executors/filtering/range_executor.py +80 -0
- exonware/xwnode/queries/executors/filtering/term_executor.py +77 -0
- exonware/xwnode/queries/executors/filtering/values_executor.py +71 -0
- exonware/xwnode/queries/executors/filtering/where_executor.py +44 -0
- exonware/xwnode/queries/executors/graph/__init__.py +15 -0
- exonware/xwnode/queries/executors/graph/in_traverse_executor.py +51 -0
- exonware/xwnode/queries/executors/graph/match_executor.py +51 -0
- exonware/xwnode/queries/executors/graph/out_executor.py +51 -0
- exonware/xwnode/queries/executors/graph/path_executor.py +51 -0
- exonware/xwnode/queries/executors/graph/return_executor.py +51 -0
- exonware/xwnode/queries/executors/ordering/__init__.py +9 -0
- exonware/xwnode/queries/executors/ordering/by_executor.py +50 -0
- exonware/xwnode/queries/executors/ordering/order_executor.py +51 -0
- exonware/xwnode/queries/executors/projection/__init__.py +9 -0
- exonware/xwnode/queries/executors/projection/extend_executor.py +50 -0
- exonware/xwnode/queries/executors/projection/project_executor.py +50 -0
- exonware/xwnode/queries/executors/registry.py +173 -0
- exonware/xwnode/queries/executors/types.py +93 -0
- exonware/xwnode/{strategies/queries → queries/strategies}/__init__.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/base.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/cql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/cypher.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/datalog.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/elastic_dsl.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/eql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/flux.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/gql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/graphql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/gremlin.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/hiveql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/hql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/jmespath.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/jq.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/json_query.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/jsoniq.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/kql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/linq.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/logql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/mql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/n1ql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/partiql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/pig.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/promql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/sparql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/sql.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/xml_query.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/xpath.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/xquery.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/xwnode_executor.py +1 -1
- exonware/xwnode/{strategies/queries → queries/strategies}/xwquery.py +1 -1
- exonware/xwnode/strategies/__init__.py +8 -8
- exonware/xwnode/version.py +3 -3
- {exonware_xwnode-0.0.1.13.dist-info → exonware_xwnode-0.0.1.14.dist-info}/METADATA +2 -2
- exonware_xwnode-0.0.1.14.dist-info/RECORD +209 -0
- exonware/xwnode/strategies/impls/__init__.py +0 -13
- exonware/xwnode/strategies/nodes/_base_node.py +0 -307
- exonware_xwnode-0.0.1.13.dist-info/RECORD +0 -132
- /exonware/xwnode/{strategies → common/management}/migration.py +0 -0
- /exonware/xwnode/{strategies → common/utils}/simple.py +0 -0
- /exonware/xwnode/{strategies → common/utils}/utils.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/_base_edge.py +0 -0
- /exonware/xwnode/{strategies/edges → edges/strategies}/adj_list.py +0 -0
- /exonware/xwnode/{strategies/edges → edges/strategies}/adj_matrix.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_adj_list.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_adj_matrix.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_bidir_wrapper.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_block_adj_matrix.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_coo.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_csc.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_csr.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_dynamic_adj_list.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_flow_network.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_hyperedge_set.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_neural_graph.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_octree.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_property_store.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_quadtree.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_rtree.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_temporal_edgeset.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_tree_graph_basic.py +0 -0
- /exonware/xwnode/{strategies/impls → edges/strategies}/edge_weighted_graph.py +0 -0
- /exonware/xwnode/{strategies/impls → nodes/strategies}/_base_node.py +0 -0
- /exonware/xwnode/{strategies/nodes → nodes/strategies}/node_cuckoo_hash.py +0 -0
- {exonware_xwnode-0.0.1.13.dist-info → exonware_xwnode-0.0.1.14.dist-info}/WHEEL +0 -0
- {exonware_xwnode-0.0.1.13.dist-info → exonware_xwnode-0.0.1.14.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
#exonware/xwnode/src/exonware/xwnode/queries/executors/core/create_executor.py
|
4
|
+
|
5
|
+
CREATE Executor
|
6
|
+
|
7
|
+
Company: eXonware.com
|
8
|
+
Author: Eng. Muhammad AlShehri
|
9
|
+
Email: connect@exonware.com
|
10
|
+
Version: 0.0.1.14
|
11
|
+
Generation Date: 08-Oct-2025
|
12
|
+
"""
|
13
|
+
|
14
|
+
from typing import Any, Dict, List
|
15
|
+
from ..base import AUniversalOperationExecutor
|
16
|
+
from ..contracts import Action, ExecutionContext, ExecutionResult
|
17
|
+
from ..types import OperationType
|
18
|
+
from ...nodes.strategies.contracts import NodeType
|
19
|
+
|
20
|
+
|
21
|
+
class CreateExecutor(AUniversalOperationExecutor):
|
22
|
+
"""
|
23
|
+
CREATE operation executor - Universal operation.
|
24
|
+
|
25
|
+
Creates new structures (collections, indices, schemas) in nodes.
|
26
|
+
Works on all node types (LINEAR, TREE, GRAPH, MATRIX, HYBRID).
|
27
|
+
|
28
|
+
Capability: Universal
|
29
|
+
Operation Type: CORE
|
30
|
+
"""
|
31
|
+
|
32
|
+
OPERATION_NAME = "CREATE"
|
33
|
+
OPERATION_TYPE = OperationType.CORE
|
34
|
+
SUPPORTED_NODE_TYPES = [] # Empty = Universal (all types)
|
35
|
+
|
36
|
+
def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
|
37
|
+
"""Execute CREATE operation."""
|
38
|
+
# 1. Extract parameters
|
39
|
+
params = action.params
|
40
|
+
structure_type = params.get('type', 'collection') # collection, index, schema
|
41
|
+
name = params.get('name', 'new_structure')
|
42
|
+
schema = params.get('schema', {})
|
43
|
+
options = params.get('options', {})
|
44
|
+
|
45
|
+
# 2. Get node strategy
|
46
|
+
node = context.node
|
47
|
+
|
48
|
+
# 3. Execute create
|
49
|
+
result_data = self._execute_create(node, structure_type, name, schema, options, context)
|
50
|
+
|
51
|
+
# 4. Return result
|
52
|
+
return ExecutionResult(
|
53
|
+
success=True,
|
54
|
+
data=result_data,
|
55
|
+
operation=self.OPERATION_NAME,
|
56
|
+
metadata={
|
57
|
+
'structure_type': structure_type,
|
58
|
+
'name': name,
|
59
|
+
'created': result_data.get('created', False)
|
60
|
+
}
|
61
|
+
)
|
62
|
+
|
63
|
+
def _execute_create(self, node: Any, structure_type: str, name: str,
|
64
|
+
schema: Dict, options: Dict, context: ExecutionContext) -> Dict:
|
65
|
+
"""Actual CREATE logic."""
|
66
|
+
try:
|
67
|
+
# Create structure based on type
|
68
|
+
if structure_type == 'collection':
|
69
|
+
# Create a new collection/path
|
70
|
+
node.set(name, {})
|
71
|
+
created = True
|
72
|
+
elif structure_type == 'index':
|
73
|
+
# Create an index (simplified)
|
74
|
+
index_path = f"_indices.{name}"
|
75
|
+
node.set(index_path, {'type': 'index', 'fields': schema})
|
76
|
+
created = True
|
77
|
+
elif structure_type == 'schema':
|
78
|
+
# Create a schema definition
|
79
|
+
schema_path = f"_schemas.{name}"
|
80
|
+
node.set(schema_path, schema)
|
81
|
+
created = True
|
82
|
+
else:
|
83
|
+
created = False
|
84
|
+
|
85
|
+
return {
|
86
|
+
'created': created,
|
87
|
+
'type': structure_type,
|
88
|
+
'name': name,
|
89
|
+
'path': name
|
90
|
+
}
|
91
|
+
except Exception as e:
|
92
|
+
return {
|
93
|
+
'created': False,
|
94
|
+
'error': str(e)
|
95
|
+
}
|
96
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
#exonware/xwnode/src/exonware/xwnode/queries/executors/core/delete_executor.py
|
4
|
+
|
5
|
+
DELETE Executor
|
6
|
+
|
7
|
+
Company: eXonware.com
|
8
|
+
Author: Eng. Muhammad AlShehri
|
9
|
+
Email: connect@exonware.com
|
10
|
+
Version: 0.0.1.14
|
11
|
+
Generation Date: 08-Oct-2025
|
12
|
+
"""
|
13
|
+
|
14
|
+
from typing import Any, Dict, List
|
15
|
+
from ..base import AUniversalOperationExecutor
|
16
|
+
from ..contracts import Action, ExecutionContext, ExecutionResult
|
17
|
+
from ..types import OperationType
|
18
|
+
from ...nodes.strategies.contracts import NodeType
|
19
|
+
|
20
|
+
|
21
|
+
class DeleteExecutor(AUniversalOperationExecutor):
|
22
|
+
"""
|
23
|
+
DELETE operation executor - Universal operation.
|
24
|
+
|
25
|
+
Deletes data from nodes based on specified conditions.
|
26
|
+
Works on all node types (LINEAR, TREE, GRAPH, MATRIX, HYBRID).
|
27
|
+
|
28
|
+
Capability: Universal
|
29
|
+
Operation Type: CORE
|
30
|
+
"""
|
31
|
+
|
32
|
+
OPERATION_NAME = "DELETE"
|
33
|
+
OPERATION_TYPE = OperationType.CORE
|
34
|
+
SUPPORTED_NODE_TYPES = [] # Empty = Universal (all types)
|
35
|
+
|
36
|
+
def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
|
37
|
+
"""Execute DELETE operation."""
|
38
|
+
# 1. Extract parameters
|
39
|
+
params = action.params
|
40
|
+
target = params.get('target', None) # What to delete (path/key)
|
41
|
+
condition = params.get('where', None) # Delete condition
|
42
|
+
|
43
|
+
# 2. Get node strategy
|
44
|
+
node = context.node
|
45
|
+
|
46
|
+
# 3. Execute delete
|
47
|
+
result_data = self._execute_delete(node, target, condition, context)
|
48
|
+
|
49
|
+
# 4. Return result
|
50
|
+
return ExecutionResult(
|
51
|
+
success=True,
|
52
|
+
data=result_data,
|
53
|
+
operation=self.OPERATION_NAME,
|
54
|
+
metadata={
|
55
|
+
'deleted_count': result_data.get('count', 0),
|
56
|
+
'target': target,
|
57
|
+
'condition': condition
|
58
|
+
}
|
59
|
+
)
|
60
|
+
|
61
|
+
def _execute_delete(self, node: Any, target: str, condition: Any,
|
62
|
+
context: ExecutionContext) -> Dict:
|
63
|
+
"""Actual DELETE logic."""
|
64
|
+
deleted_count = 0
|
65
|
+
deleted_items = []
|
66
|
+
|
67
|
+
if target:
|
68
|
+
# Delete specific target
|
69
|
+
try:
|
70
|
+
current = node.get(target, default=None)
|
71
|
+
if current is not None and self._matches_condition(current, condition):
|
72
|
+
node.delete(target)
|
73
|
+
deleted_count = 1
|
74
|
+
deleted_items.append(target)
|
75
|
+
except Exception as e:
|
76
|
+
return {
|
77
|
+
'count': 0,
|
78
|
+
'items': [],
|
79
|
+
'error': str(e)
|
80
|
+
}
|
81
|
+
else:
|
82
|
+
# Delete all matching items
|
83
|
+
# This is a simplified implementation
|
84
|
+
deleted_count = 0
|
85
|
+
deleted_items = []
|
86
|
+
|
87
|
+
return {
|
88
|
+
'count': deleted_count,
|
89
|
+
'items': deleted_items
|
90
|
+
}
|
91
|
+
|
92
|
+
def _matches_condition(self, item: Any, condition: Any) -> bool:
|
93
|
+
"""Check if item matches condition."""
|
94
|
+
if condition is None:
|
95
|
+
return True
|
96
|
+
|
97
|
+
# Simplified condition checking
|
98
|
+
return True
|
99
|
+
|
@@ -0,0 +1,100 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
#exonware/xwnode/src/exonware/xwnode/queries/executors/core/drop_executor.py
|
4
|
+
|
5
|
+
DROP Executor
|
6
|
+
|
7
|
+
Company: eXonware.com
|
8
|
+
Author: Eng. Muhammad AlShehri
|
9
|
+
Email: connect@exonware.com
|
10
|
+
Version: 0.0.1.14
|
11
|
+
Generation Date: 08-Oct-2025
|
12
|
+
"""
|
13
|
+
|
14
|
+
from typing import Any, Dict, List
|
15
|
+
from ..base import AUniversalOperationExecutor
|
16
|
+
from ..contracts import Action, ExecutionContext, ExecutionResult
|
17
|
+
from ..types import OperationType
|
18
|
+
from ...nodes.strategies.contracts import NodeType
|
19
|
+
|
20
|
+
|
21
|
+
class DropExecutor(AUniversalOperationExecutor):
|
22
|
+
"""
|
23
|
+
DROP operation executor - Universal operation.
|
24
|
+
|
25
|
+
Drops/removes structures (collections, indices, schemas) from nodes.
|
26
|
+
Works on all node types (LINEAR, TREE, GRAPH, MATRIX, HYBRID).
|
27
|
+
|
28
|
+
Capability: Universal
|
29
|
+
Operation Type: CORE
|
30
|
+
"""
|
31
|
+
|
32
|
+
OPERATION_NAME = "DROP"
|
33
|
+
OPERATION_TYPE = OperationType.CORE
|
34
|
+
SUPPORTED_NODE_TYPES = [] # Empty = Universal (all types)
|
35
|
+
|
36
|
+
def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
|
37
|
+
"""Execute DROP operation."""
|
38
|
+
# 1. Extract parameters
|
39
|
+
params = action.params
|
40
|
+
structure_type = params.get('type', 'collection')
|
41
|
+
name = params.get('name')
|
42
|
+
if_exists = params.get('if_exists', False)
|
43
|
+
|
44
|
+
# 2. Get node strategy
|
45
|
+
node = context.node
|
46
|
+
|
47
|
+
# 3. Execute drop
|
48
|
+
result_data = self._execute_drop(node, structure_type, name, if_exists, context)
|
49
|
+
|
50
|
+
# 4. Return result
|
51
|
+
return ExecutionResult(
|
52
|
+
success=True,
|
53
|
+
data=result_data,
|
54
|
+
operation=self.OPERATION_NAME,
|
55
|
+
metadata={
|
56
|
+
'structure_type': structure_type,
|
57
|
+
'name': name,
|
58
|
+
'dropped': result_data.get('dropped', False)
|
59
|
+
}
|
60
|
+
)
|
61
|
+
|
62
|
+
def _execute_drop(self, node: Any, structure_type: str, name: str,
|
63
|
+
if_exists: bool, context: ExecutionContext) -> Dict:
|
64
|
+
"""Actual DROP logic."""
|
65
|
+
try:
|
66
|
+
# Determine path based on structure type
|
67
|
+
if structure_type == 'index':
|
68
|
+
path = f"_indices.{name}"
|
69
|
+
elif structure_type == 'schema':
|
70
|
+
path = f"_schemas.{name}"
|
71
|
+
else:
|
72
|
+
path = name
|
73
|
+
|
74
|
+
# Check if exists
|
75
|
+
exists = node.get(path, default=None) is not None
|
76
|
+
|
77
|
+
if not exists and not if_exists:
|
78
|
+
return {
|
79
|
+
'dropped': False,
|
80
|
+
'error': f"Structure '{name}' does not exist"
|
81
|
+
}
|
82
|
+
|
83
|
+
if exists:
|
84
|
+
node.delete(path)
|
85
|
+
dropped = True
|
86
|
+
else:
|
87
|
+
dropped = False
|
88
|
+
|
89
|
+
return {
|
90
|
+
'dropped': dropped,
|
91
|
+
'type': structure_type,
|
92
|
+
'name': name,
|
93
|
+
'path': path
|
94
|
+
}
|
95
|
+
except Exception as e:
|
96
|
+
return {
|
97
|
+
'dropped': False,
|
98
|
+
'error': str(e)
|
99
|
+
}
|
100
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
#exonware/xwnode/src/exonware/xwnode/queries/executors/core/insert_executor.py
|
4
|
+
|
5
|
+
INSERT Operation Executor
|
6
|
+
|
7
|
+
Company: eXonware.com
|
8
|
+
Author: Eng. Muhammad AlShehri
|
9
|
+
Email: connect@exonware.com
|
10
|
+
Version: 0.0.1.14
|
11
|
+
Generation Date: 08-Oct-2025
|
12
|
+
"""
|
13
|
+
|
14
|
+
from ..base import AUniversalOperationExecutor
|
15
|
+
from ..contracts import Action, ExecutionContext, ExecutionResult
|
16
|
+
|
17
|
+
|
18
|
+
class InsertExecutor(AUniversalOperationExecutor):
|
19
|
+
"""INSERT operation executor - Universal operation."""
|
20
|
+
|
21
|
+
OPERATION_NAME = "INSERT"
|
22
|
+
|
23
|
+
def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
|
24
|
+
"""Execute INSERT operation on node."""
|
25
|
+
key = action.params.get('key')
|
26
|
+
value = action.params.get('value')
|
27
|
+
|
28
|
+
# Insert into node using strategy
|
29
|
+
if hasattr(context.node, 'insert'):
|
30
|
+
context.node.insert(key, value)
|
31
|
+
elif hasattr(context.node, 'put'):
|
32
|
+
context.node.put(key, value)
|
33
|
+
elif hasattr(context.node, '_strategy'):
|
34
|
+
context.node._strategy.insert(key, value)
|
35
|
+
|
36
|
+
return ExecutionResult(data={'inserted': key}, affected_count=1)
|
37
|
+
|
38
|
+
|
39
|
+
__all__ = ['InsertExecutor']
|
@@ -0,0 +1,152 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
#exonware/xwnode/src/exonware/xwnode/queries/executors/core/select_executor.py
|
4
|
+
|
5
|
+
SELECT Operation Executor
|
6
|
+
|
7
|
+
Implements SELECT operation execution on all node types.
|
8
|
+
|
9
|
+
Company: eXonware.com
|
10
|
+
Author: Eng. Muhammad AlShehri
|
11
|
+
Email: connect@exonware.com
|
12
|
+
Version: 0.0.1.14
|
13
|
+
Generation Date: 08-Oct-2025
|
14
|
+
"""
|
15
|
+
|
16
|
+
from typing import Any, List, Dict, Optional
|
17
|
+
from ..base import AUniversalOperationExecutor
|
18
|
+
from ..contracts import Action, ExecutionContext, ExecutionResult
|
19
|
+
from ..types import OperationCapability
|
20
|
+
from ...nodes.strategies.contracts import NodeType
|
21
|
+
|
22
|
+
|
23
|
+
class SelectExecutor(AUniversalOperationExecutor):
|
24
|
+
"""
|
25
|
+
SELECT operation executor - Universal operation.
|
26
|
+
|
27
|
+
Works on all node types (LINEAR, TREE, GRAPH, MATRIX).
|
28
|
+
Retrieves and projects data from nodes.
|
29
|
+
"""
|
30
|
+
|
31
|
+
OPERATION_NAME = "SELECT"
|
32
|
+
|
33
|
+
def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
|
34
|
+
"""
|
35
|
+
Execute SELECT operation.
|
36
|
+
|
37
|
+
Supports:
|
38
|
+
- Column projection
|
39
|
+
- Star (*) selection
|
40
|
+
- Expressions and aliases
|
41
|
+
- Adapts to different node types
|
42
|
+
"""
|
43
|
+
# Extract parameters
|
44
|
+
columns = action.params.get('columns', ['*'])
|
45
|
+
source = action.params.get('from', context.node)
|
46
|
+
|
47
|
+
# Get node type
|
48
|
+
node_type = self._get_node_type(context.node)
|
49
|
+
|
50
|
+
# Route to appropriate handler based on node type
|
51
|
+
if node_type == NodeType.LINEAR:
|
52
|
+
data = self._select_from_linear(source, columns, context)
|
53
|
+
elif node_type == NodeType.TREE:
|
54
|
+
data = self._select_from_tree(source, columns, context)
|
55
|
+
elif node_type == NodeType.GRAPH:
|
56
|
+
data = self._select_from_graph(source, columns, context)
|
57
|
+
elif node_type == NodeType.MATRIX:
|
58
|
+
data = self._select_from_matrix(source, columns, context)
|
59
|
+
else: # HYBRID
|
60
|
+
data = self._select_from_tree(source, columns, context) # Default to tree
|
61
|
+
|
62
|
+
return ExecutionResult(
|
63
|
+
data=data,
|
64
|
+
affected_count=len(data) if isinstance(data, list) else 1
|
65
|
+
)
|
66
|
+
|
67
|
+
def _get_node_type(self, node: Any) -> NodeType:
|
68
|
+
"""Get node's strategy type."""
|
69
|
+
if hasattr(node, '_strategy') and hasattr(node._strategy, 'STRATEGY_TYPE'):
|
70
|
+
return node._strategy.STRATEGY_TYPE
|
71
|
+
elif hasattr(node, 'STRATEGY_TYPE'):
|
72
|
+
return node.STRATEGY_TYPE
|
73
|
+
return NodeType.TREE # Default
|
74
|
+
|
75
|
+
def _select_from_linear(self, source: Any, columns: List[str], context: ExecutionContext) -> List[Dict]:
|
76
|
+
"""Select from linear node (list-like)."""
|
77
|
+
results = []
|
78
|
+
|
79
|
+
# Iterate through linear structure
|
80
|
+
if hasattr(source, 'items'):
|
81
|
+
for key, value in source.items():
|
82
|
+
if columns == ['*']:
|
83
|
+
results.append({'key': key, 'value': value})
|
84
|
+
else:
|
85
|
+
row = self._project_columns(value, columns)
|
86
|
+
results.append(row)
|
87
|
+
|
88
|
+
return results
|
89
|
+
|
90
|
+
def _select_from_tree(self, source: Any, columns: List[str], context: ExecutionContext) -> List[Dict]:
|
91
|
+
"""Select from tree node (key-value map)."""
|
92
|
+
results = []
|
93
|
+
|
94
|
+
# Iterate through tree structure
|
95
|
+
if hasattr(source, 'items'):
|
96
|
+
for key, value in source.items():
|
97
|
+
if columns == ['*']:
|
98
|
+
results.append({'key': key, 'value': value})
|
99
|
+
else:
|
100
|
+
row = self._project_columns(value, columns)
|
101
|
+
if row:
|
102
|
+
results.append(row)
|
103
|
+
|
104
|
+
return results
|
105
|
+
|
106
|
+
def _select_from_graph(self, source: Any, columns: List[str], context: ExecutionContext) -> List[Dict]:
|
107
|
+
"""Select from graph node."""
|
108
|
+
# For graphs, return nodes
|
109
|
+
results = []
|
110
|
+
|
111
|
+
if hasattr(source, 'items'):
|
112
|
+
for key, value in source.items():
|
113
|
+
if columns == ['*']:
|
114
|
+
results.append({'node_id': key, 'node_data': value})
|
115
|
+
else:
|
116
|
+
row = self._project_columns(value, columns)
|
117
|
+
if row:
|
118
|
+
row['node_id'] = key
|
119
|
+
results.append(row)
|
120
|
+
|
121
|
+
return results
|
122
|
+
|
123
|
+
def _select_from_matrix(self, source: Any, columns: List[str], context: ExecutionContext) -> List[Dict]:
|
124
|
+
"""Select from matrix node."""
|
125
|
+
results = []
|
126
|
+
|
127
|
+
# Iterate through matrix
|
128
|
+
if hasattr(source, 'items'):
|
129
|
+
for key, value in source.items():
|
130
|
+
if columns == ['*']:
|
131
|
+
results.append({'position': key, 'value': value})
|
132
|
+
else:
|
133
|
+
row = self._project_columns(value, columns)
|
134
|
+
if row:
|
135
|
+
results.append(row)
|
136
|
+
|
137
|
+
return results
|
138
|
+
|
139
|
+
def _project_columns(self, value: Any, columns: List[str]) -> Optional[Dict]:
|
140
|
+
"""Project specific columns from a value."""
|
141
|
+
if not isinstance(value, dict):
|
142
|
+
return {'value': value}
|
143
|
+
|
144
|
+
projected = {}
|
145
|
+
for col in columns:
|
146
|
+
if col in value:
|
147
|
+
projected[col] = value[col]
|
148
|
+
|
149
|
+
return projected if projected else None
|
150
|
+
|
151
|
+
|
152
|
+
__all__ = ['SelectExecutor']
|
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
#exonware/xwnode/src/exonware/xwnode/queries/executors/core/update_executor.py
|
4
|
+
|
5
|
+
UPDATE Executor
|
6
|
+
|
7
|
+
Company: eXonware.com
|
8
|
+
Author: Eng. Muhammad AlShehri
|
9
|
+
Email: connect@exonware.com
|
10
|
+
Version: 0.0.1.14
|
11
|
+
Generation Date: 08-Oct-2025
|
12
|
+
"""
|
13
|
+
|
14
|
+
from typing import Any, Dict, List
|
15
|
+
from ..base import AUniversalOperationExecutor
|
16
|
+
from ..contracts import Action, ExecutionContext, ExecutionResult
|
17
|
+
from ..types import OperationType
|
18
|
+
from ...nodes.strategies.contracts import NodeType
|
19
|
+
|
20
|
+
|
21
|
+
class UpdateExecutor(AUniversalOperationExecutor):
|
22
|
+
"""
|
23
|
+
UPDATE operation executor - Universal operation.
|
24
|
+
|
25
|
+
Updates existing data in nodes based on specified conditions.
|
26
|
+
Works on all node types (LINEAR, TREE, GRAPH, MATRIX, HYBRID).
|
27
|
+
|
28
|
+
Capability: Universal
|
29
|
+
Operation Type: CORE
|
30
|
+
"""
|
31
|
+
|
32
|
+
OPERATION_NAME = "UPDATE"
|
33
|
+
OPERATION_TYPE = OperationType.CORE
|
34
|
+
SUPPORTED_NODE_TYPES = [] # Empty = Universal (all types)
|
35
|
+
|
36
|
+
def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
|
37
|
+
"""Execute UPDATE operation."""
|
38
|
+
# 1. Extract parameters
|
39
|
+
params = action.params
|
40
|
+
target = params.get('target', None) # What to update (path/key)
|
41
|
+
values = params.get('values', {}) # New values
|
42
|
+
condition = params.get('where', None) # Update condition
|
43
|
+
|
44
|
+
# 2. Get node strategy
|
45
|
+
node = context.node
|
46
|
+
|
47
|
+
# 3. Execute update
|
48
|
+
result_data = self._execute_update(node, target, values, condition, context)
|
49
|
+
|
50
|
+
# 4. Return result
|
51
|
+
return ExecutionResult(
|
52
|
+
success=True,
|
53
|
+
data=result_data,
|
54
|
+
operation=self.OPERATION_NAME,
|
55
|
+
metadata={
|
56
|
+
'updated_count': result_data.get('count', 0),
|
57
|
+
'target': target,
|
58
|
+
'condition': condition
|
59
|
+
}
|
60
|
+
)
|
61
|
+
|
62
|
+
def _execute_update(self, node: Any, target: str, values: Dict,
|
63
|
+
condition: Any, context: ExecutionContext) -> Dict:
|
64
|
+
"""Actual UPDATE logic."""
|
65
|
+
updated_count = 0
|
66
|
+
updated_items = []
|
67
|
+
|
68
|
+
if target:
|
69
|
+
# Update specific target
|
70
|
+
try:
|
71
|
+
current = node.get(target, default=None)
|
72
|
+
if current is not None and self._matches_condition(current, condition):
|
73
|
+
node.set(target, values)
|
74
|
+
updated_count = 1
|
75
|
+
updated_items.append(target)
|
76
|
+
except Exception as e:
|
77
|
+
return {
|
78
|
+
'count': 0,
|
79
|
+
'items': [],
|
80
|
+
'error': str(e)
|
81
|
+
}
|
82
|
+
else:
|
83
|
+
# Update all matching items
|
84
|
+
# This is a simplified implementation - real version would traverse node
|
85
|
+
updated_count = 0
|
86
|
+
updated_items = []
|
87
|
+
|
88
|
+
return {
|
89
|
+
'count': updated_count,
|
90
|
+
'items': updated_items,
|
91
|
+
'values': values
|
92
|
+
}
|
93
|
+
|
94
|
+
def _matches_condition(self, item: Any, condition: Any) -> bool:
|
95
|
+
"""Check if item matches condition."""
|
96
|
+
if condition is None:
|
97
|
+
return True
|
98
|
+
|
99
|
+
# Simplified condition checking
|
100
|
+
# Real implementation would evaluate WHERE clause
|
101
|
+
return True
|
102
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"""Data operation executors."""
|
2
|
+
|
3
|
+
from .load_executor import LoadExecutor
|
4
|
+
from .store_executor import StoreExecutor
|
5
|
+
from .merge_executor import MergeExecutor
|
6
|
+
from .alter_executor import AlterExecutor
|
7
|
+
|
8
|
+
__all__ = [
|
9
|
+
'LoadExecutor',
|
10
|
+
'StoreExecutor',
|
11
|
+
'MergeExecutor',
|
12
|
+
'AlterExecutor',
|
13
|
+
]
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
#exonware/xwnode/src/exonware/xwnode/queries/executors/data/alter_executor.py
|
4
|
+
|
5
|
+
ALTER Executor
|
6
|
+
|
7
|
+
Company: eXonware.com
|
8
|
+
Author: Eng. Muhammad AlShehri
|
9
|
+
Email: connect@exonware.com
|
10
|
+
Version: 0.0.1.14
|
11
|
+
Generation Date: 09-Oct-2025
|
12
|
+
"""
|
13
|
+
|
14
|
+
from typing import Any, Dict, List
|
15
|
+
from ..base import AUniversalOperationExecutor
|
16
|
+
from ..contracts import Action, ExecutionContext, ExecutionResult
|
17
|
+
from ..types import OperationType
|
18
|
+
|
19
|
+
class AlterExecutor(AUniversalOperationExecutor):
|
20
|
+
"""
|
21
|
+
ALTER operation executor.
|
22
|
+
|
23
|
+
Alters structure/schema
|
24
|
+
|
25
|
+
Capability: Universal
|
26
|
+
Operation Type: DATA_OPS
|
27
|
+
"""
|
28
|
+
|
29
|
+
OPERATION_NAME = "ALTER"
|
30
|
+
OPERATION_TYPE = OperationType.DATA_OPS
|
31
|
+
SUPPORTED_NODE_TYPES = [] # Universal
|
32
|
+
|
33
|
+
def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
|
34
|
+
"""Execute ALTER operation."""
|
35
|
+
params = action.params
|
36
|
+
node = context.node
|
37
|
+
|
38
|
+
result_data = self._execute_alter(node, params, context)
|
39
|
+
|
40
|
+
return ExecutionResult(
|
41
|
+
success=True,
|
42
|
+
data=result_data,
|
43
|
+
operation=self.OPERATION_NAME,
|
44
|
+
metadata={'operation': self.OPERATION_NAME}
|
45
|
+
)
|
46
|
+
|
47
|
+
def _execute_alter(self, node: Any, params: Dict, context: ExecutionContext) -> Dict:
|
48
|
+
"""Execute alter logic."""
|
49
|
+
# Implementation here
|
50
|
+
return {'result': 'ALTER executed', 'params': params}
|