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.
Files changed (208) hide show
  1. exonware/__init__.py +1 -1
  2. exonware/xwnode/__init__.py +1 -1
  3. exonware/xwnode/base.py +1 -1
  4. exonware/xwnode/common/__init__.py +20 -0
  5. exonware/xwnode/common/management/__init__.py +26 -0
  6. exonware/xwnode/{strategies → common/management}/manager.py +2 -2
  7. exonware/xwnode/common/monitoring/__init__.py +26 -0
  8. exonware/xwnode/{strategies → common/monitoring}/metrics.py +2 -2
  9. exonware/xwnode/{strategies → common/monitoring}/pattern_detector.py +2 -2
  10. exonware/xwnode/{strategies → common/monitoring}/performance_monitor.py +2 -2
  11. exonware/xwnode/common/patterns/__init__.py +26 -0
  12. exonware/xwnode/{strategies → common/patterns}/advisor.py +1 -1
  13. exonware/xwnode/{strategies → common/patterns}/flyweight.py +4 -4
  14. exonware/xwnode/{strategies → common/patterns}/registry.py +109 -112
  15. exonware/xwnode/common/utils/__init__.py +26 -0
  16. exonware/xwnode/{strategies/edges → edges/strategies}/__init__.py +1 -1
  17. exonware/xwnode/{strategies/edges → edges/strategies}/base.py +3 -3
  18. exonware/xwnode/facade.py +4 -3
  19. exonware/xwnode/{strategies/nodes → nodes/strategies}/__init__.py +1 -1
  20. exonware/xwnode/{strategies/nodes → nodes/strategies}/adjacency_list.py +7 -2
  21. exonware/xwnode/{strategies/nodes → nodes/strategies}/aho_corasick.py +6 -1
  22. exonware/xwnode/{strategies/nodes → nodes/strategies}/array_list.py +6 -1
  23. exonware/xwnode/{strategies/nodes → nodes/strategies}/base.py +24 -4
  24. exonware/xwnode/nodes/strategies/contracts.py +116 -0
  25. exonware/xwnode/{strategies/nodes → nodes/strategies}/deque.py +7 -2
  26. exonware/xwnode/{strategies/nodes → nodes/strategies}/hash_map.py +4 -0
  27. exonware/xwnode/{strategies/nodes → nodes/strategies}/heap.py +6 -1
  28. exonware/xwnode/{strategies/nodes → nodes/strategies}/linked_list.py +6 -1
  29. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_aho_corasick.py +6 -1
  30. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_array_list.py +4 -0
  31. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_avl_tree.py +6 -1
  32. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_b_plus_tree.py +6 -1
  33. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_bitmap.py +6 -1
  34. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_bitset_dynamic.py +6 -1
  35. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_bloom_filter.py +4 -0
  36. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_btree.py +6 -1
  37. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_count_min_sketch.py +4 -0
  38. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_cow_tree.py +6 -1
  39. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_fenwick_tree.py +6 -1
  40. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_hash_map.py +4 -0
  41. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_heap.py +6 -1
  42. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_hyperloglog.py +4 -0
  43. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_linked_list.py +4 -0
  44. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_lsm_tree.py +6 -1
  45. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_ordered_map.py +6 -1
  46. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_ordered_map_balanced.py +6 -1
  47. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_patricia.py +6 -1
  48. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_persistent_tree.py +6 -1
  49. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_radix_trie.py +6 -1
  50. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_red_black_tree.py +6 -1
  51. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_roaring_bitmap.py +6 -1
  52. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_segment_tree.py +6 -1
  53. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_set_hash.py +4 -0
  54. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_set_tree.py +6 -1
  55. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_skip_list.py +6 -1
  56. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_splay_tree.py +6 -1
  57. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_suffix_array.py +6 -1
  58. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_treap.py +6 -1
  59. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_tree_graph_hybrid.py +4 -0
  60. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_trie.py +6 -1
  61. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_union_find.py +6 -1
  62. exonware/xwnode/{strategies/nodes → nodes/strategies}/node_xdata_optimized.py +4 -0
  63. exonware/xwnode/{strategies/nodes → nodes/strategies}/priority_queue.py +7 -2
  64. exonware/xwnode/{strategies/nodes → nodes/strategies}/queue.py +7 -2
  65. exonware/xwnode/{strategies/nodes → nodes/strategies}/sparse_matrix.py +7 -2
  66. exonware/xwnode/{strategies/nodes → nodes/strategies}/stack.py +7 -2
  67. exonware/xwnode/{strategies/nodes → nodes/strategies}/trie.py +6 -1
  68. exonware/xwnode/{strategies/nodes → nodes/strategies}/union_find.py +6 -1
  69. exonware/xwnode/queries/executors/__init__.py +47 -0
  70. exonware/xwnode/queries/executors/advanced/__init__.py +37 -0
  71. exonware/xwnode/queries/executors/advanced/aggregate_executor.py +50 -0
  72. exonware/xwnode/queries/executors/advanced/ask_executor.py +50 -0
  73. exonware/xwnode/queries/executors/advanced/construct_executor.py +50 -0
  74. exonware/xwnode/queries/executors/advanced/describe_executor.py +50 -0
  75. exonware/xwnode/queries/executors/advanced/for_loop_executor.py +50 -0
  76. exonware/xwnode/queries/executors/advanced/foreach_executor.py +50 -0
  77. exonware/xwnode/queries/executors/advanced/join_executor.py +50 -0
  78. exonware/xwnode/queries/executors/advanced/let_executor.py +50 -0
  79. exonware/xwnode/queries/executors/advanced/mutation_executor.py +50 -0
  80. exonware/xwnode/queries/executors/advanced/options_executor.py +50 -0
  81. exonware/xwnode/queries/executors/advanced/pipe_executor.py +50 -0
  82. exonware/xwnode/queries/executors/advanced/subscribe_executor.py +50 -0
  83. exonware/xwnode/queries/executors/advanced/subscription_executor.py +50 -0
  84. exonware/xwnode/queries/executors/advanced/union_executor.py +50 -0
  85. exonware/xwnode/queries/executors/advanced/window_executor.py +51 -0
  86. exonware/xwnode/queries/executors/advanced/with_cte_executor.py +50 -0
  87. exonware/xwnode/queries/executors/aggregation/__init__.py +21 -0
  88. exonware/xwnode/queries/executors/aggregation/avg_executor.py +50 -0
  89. exonware/xwnode/queries/executors/aggregation/count_executor.py +38 -0
  90. exonware/xwnode/queries/executors/aggregation/distinct_executor.py +50 -0
  91. exonware/xwnode/queries/executors/aggregation/group_executor.py +50 -0
  92. exonware/xwnode/queries/executors/aggregation/having_executor.py +50 -0
  93. exonware/xwnode/queries/executors/aggregation/max_executor.py +50 -0
  94. exonware/xwnode/queries/executors/aggregation/min_executor.py +50 -0
  95. exonware/xwnode/queries/executors/aggregation/sum_executor.py +50 -0
  96. exonware/xwnode/queries/executors/aggregation/summarize_executor.py +50 -0
  97. exonware/xwnode/queries/executors/array/__init__.py +9 -0
  98. exonware/xwnode/queries/executors/array/indexing_executor.py +51 -0
  99. exonware/xwnode/queries/executors/array/slicing_executor.py +51 -0
  100. exonware/xwnode/queries/executors/base.py +257 -0
  101. exonware/xwnode/queries/executors/capability_checker.py +204 -0
  102. exonware/xwnode/queries/executors/contracts.py +166 -0
  103. exonware/xwnode/queries/executors/core/__init__.py +17 -0
  104. exonware/xwnode/queries/executors/core/create_executor.py +96 -0
  105. exonware/xwnode/queries/executors/core/delete_executor.py +99 -0
  106. exonware/xwnode/queries/executors/core/drop_executor.py +100 -0
  107. exonware/xwnode/queries/executors/core/insert_executor.py +39 -0
  108. exonware/xwnode/queries/executors/core/select_executor.py +152 -0
  109. exonware/xwnode/queries/executors/core/update_executor.py +102 -0
  110. exonware/xwnode/queries/executors/data/__init__.py +13 -0
  111. exonware/xwnode/queries/executors/data/alter_executor.py +50 -0
  112. exonware/xwnode/queries/executors/data/load_executor.py +50 -0
  113. exonware/xwnode/queries/executors/data/merge_executor.py +50 -0
  114. exonware/xwnode/queries/executors/data/store_executor.py +50 -0
  115. exonware/xwnode/queries/executors/engine.py +221 -0
  116. exonware/xwnode/queries/executors/errors.py +68 -0
  117. exonware/xwnode/queries/executors/filtering/__init__.py +25 -0
  118. exonware/xwnode/queries/executors/filtering/between_executor.py +80 -0
  119. exonware/xwnode/queries/executors/filtering/filter_executor.py +79 -0
  120. exonware/xwnode/queries/executors/filtering/has_executor.py +70 -0
  121. exonware/xwnode/queries/executors/filtering/in_executor.py +70 -0
  122. exonware/xwnode/queries/executors/filtering/like_executor.py +76 -0
  123. exonware/xwnode/queries/executors/filtering/optional_executor.py +76 -0
  124. exonware/xwnode/queries/executors/filtering/range_executor.py +80 -0
  125. exonware/xwnode/queries/executors/filtering/term_executor.py +77 -0
  126. exonware/xwnode/queries/executors/filtering/values_executor.py +71 -0
  127. exonware/xwnode/queries/executors/filtering/where_executor.py +44 -0
  128. exonware/xwnode/queries/executors/graph/__init__.py +15 -0
  129. exonware/xwnode/queries/executors/graph/in_traverse_executor.py +51 -0
  130. exonware/xwnode/queries/executors/graph/match_executor.py +51 -0
  131. exonware/xwnode/queries/executors/graph/out_executor.py +51 -0
  132. exonware/xwnode/queries/executors/graph/path_executor.py +51 -0
  133. exonware/xwnode/queries/executors/graph/return_executor.py +51 -0
  134. exonware/xwnode/queries/executors/ordering/__init__.py +9 -0
  135. exonware/xwnode/queries/executors/ordering/by_executor.py +50 -0
  136. exonware/xwnode/queries/executors/ordering/order_executor.py +51 -0
  137. exonware/xwnode/queries/executors/projection/__init__.py +9 -0
  138. exonware/xwnode/queries/executors/projection/extend_executor.py +50 -0
  139. exonware/xwnode/queries/executors/projection/project_executor.py +50 -0
  140. exonware/xwnode/queries/executors/registry.py +173 -0
  141. exonware/xwnode/queries/executors/types.py +93 -0
  142. exonware/xwnode/{strategies/queries → queries/strategies}/__init__.py +1 -1
  143. exonware/xwnode/{strategies/queries → queries/strategies}/base.py +1 -1
  144. exonware/xwnode/{strategies/queries → queries/strategies}/cql.py +1 -1
  145. exonware/xwnode/{strategies/queries → queries/strategies}/cypher.py +1 -1
  146. exonware/xwnode/{strategies/queries → queries/strategies}/datalog.py +1 -1
  147. exonware/xwnode/{strategies/queries → queries/strategies}/elastic_dsl.py +1 -1
  148. exonware/xwnode/{strategies/queries → queries/strategies}/eql.py +1 -1
  149. exonware/xwnode/{strategies/queries → queries/strategies}/flux.py +1 -1
  150. exonware/xwnode/{strategies/queries → queries/strategies}/gql.py +1 -1
  151. exonware/xwnode/{strategies/queries → queries/strategies}/graphql.py +1 -1
  152. exonware/xwnode/{strategies/queries → queries/strategies}/gremlin.py +1 -1
  153. exonware/xwnode/{strategies/queries → queries/strategies}/hiveql.py +1 -1
  154. exonware/xwnode/{strategies/queries → queries/strategies}/hql.py +1 -1
  155. exonware/xwnode/{strategies/queries → queries/strategies}/jmespath.py +1 -1
  156. exonware/xwnode/{strategies/queries → queries/strategies}/jq.py +1 -1
  157. exonware/xwnode/{strategies/queries → queries/strategies}/json_query.py +1 -1
  158. exonware/xwnode/{strategies/queries → queries/strategies}/jsoniq.py +1 -1
  159. exonware/xwnode/{strategies/queries → queries/strategies}/kql.py +1 -1
  160. exonware/xwnode/{strategies/queries → queries/strategies}/linq.py +1 -1
  161. exonware/xwnode/{strategies/queries → queries/strategies}/logql.py +1 -1
  162. exonware/xwnode/{strategies/queries → queries/strategies}/mql.py +1 -1
  163. exonware/xwnode/{strategies/queries → queries/strategies}/n1ql.py +1 -1
  164. exonware/xwnode/{strategies/queries → queries/strategies}/partiql.py +1 -1
  165. exonware/xwnode/{strategies/queries → queries/strategies}/pig.py +1 -1
  166. exonware/xwnode/{strategies/queries → queries/strategies}/promql.py +1 -1
  167. exonware/xwnode/{strategies/queries → queries/strategies}/sparql.py +1 -1
  168. exonware/xwnode/{strategies/queries → queries/strategies}/sql.py +1 -1
  169. exonware/xwnode/{strategies/queries → queries/strategies}/xml_query.py +1 -1
  170. exonware/xwnode/{strategies/queries → queries/strategies}/xpath.py +1 -1
  171. exonware/xwnode/{strategies/queries → queries/strategies}/xquery.py +1 -1
  172. exonware/xwnode/{strategies/queries → queries/strategies}/xwnode_executor.py +1 -1
  173. exonware/xwnode/{strategies/queries → queries/strategies}/xwquery.py +1 -1
  174. exonware/xwnode/strategies/__init__.py +8 -8
  175. exonware/xwnode/version.py +3 -3
  176. {exonware_xwnode-0.0.1.13.dist-info → exonware_xwnode-0.0.1.14.dist-info}/METADATA +2 -2
  177. exonware_xwnode-0.0.1.14.dist-info/RECORD +209 -0
  178. exonware/xwnode/strategies/impls/__init__.py +0 -13
  179. exonware/xwnode/strategies/nodes/_base_node.py +0 -307
  180. exonware_xwnode-0.0.1.13.dist-info/RECORD +0 -132
  181. /exonware/xwnode/{strategies → common/management}/migration.py +0 -0
  182. /exonware/xwnode/{strategies → common/utils}/simple.py +0 -0
  183. /exonware/xwnode/{strategies → common/utils}/utils.py +0 -0
  184. /exonware/xwnode/{strategies/impls → edges/strategies}/_base_edge.py +0 -0
  185. /exonware/xwnode/{strategies/edges → edges/strategies}/adj_list.py +0 -0
  186. /exonware/xwnode/{strategies/edges → edges/strategies}/adj_matrix.py +0 -0
  187. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_adj_list.py +0 -0
  188. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_adj_matrix.py +0 -0
  189. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_bidir_wrapper.py +0 -0
  190. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_block_adj_matrix.py +0 -0
  191. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_coo.py +0 -0
  192. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_csc.py +0 -0
  193. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_csr.py +0 -0
  194. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_dynamic_adj_list.py +0 -0
  195. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_flow_network.py +0 -0
  196. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_hyperedge_set.py +0 -0
  197. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_neural_graph.py +0 -0
  198. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_octree.py +0 -0
  199. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_property_store.py +0 -0
  200. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_quadtree.py +0 -0
  201. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_rtree.py +0 -0
  202. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_temporal_edgeset.py +0 -0
  203. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_tree_graph_basic.py +0 -0
  204. /exonware/xwnode/{strategies/impls → edges/strategies}/edge_weighted_graph.py +0 -0
  205. /exonware/xwnode/{strategies/impls → nodes/strategies}/_base_node.py +0 -0
  206. /exonware/xwnode/{strategies/nodes → nodes/strategies}/node_cuckoo_hash.py +0 -0
  207. {exonware_xwnode-0.0.1.13.dist-info → exonware_xwnode-0.0.1.14.dist-info}/WHEEL +0 -0
  208. {exonware_xwnode-0.0.1.13.dist-info → exonware_xwnode-0.0.1.14.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/filtering/in_executor.py
4
+
5
+ IN 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
+
19
+
20
+ class InExecutor(AUniversalOperationExecutor):
21
+ """
22
+ IN operation executor - Universal operation.
23
+
24
+ Checks if a value is in a specified set.
25
+
26
+ Capability: Universal
27
+ Operation Type: FILTERING
28
+ """
29
+
30
+ OPERATION_NAME = "IN"
31
+ OPERATION_TYPE = OperationType.FILTERING
32
+ SUPPORTED_NODE_TYPES = [] # Universal
33
+
34
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
35
+ """Execute IN operation."""
36
+ params = action.params
37
+ field = params.get('field')
38
+ values = params.get('values', [])
39
+ path = params.get('path', None)
40
+
41
+ node = context.node
42
+ result_data = self._execute_in(node, field, values, path, context)
43
+
44
+ return ExecutionResult(
45
+ success=True,
46
+ data=result_data,
47
+ operation=self.OPERATION_NAME,
48
+ metadata={'matched_count': len(result_data.get('items', []))}
49
+ )
50
+
51
+ def _execute_in(self, node: Any, field: str, values: List, path: str, context: ExecutionContext) -> Dict:
52
+ """Execute IN membership check."""
53
+ matched_items = []
54
+ values_set = set(values) if values else set()
55
+
56
+ # Get data
57
+ if path:
58
+ data = node.get(path, default=[])
59
+ else:
60
+ data = node.to_native()
61
+
62
+ # Check membership
63
+ if isinstance(data, list):
64
+ for item in data:
65
+ value = item.get(field) if isinstance(item, dict) else item
66
+ if value in values_set:
67
+ matched_items.append(item)
68
+
69
+ return {'items': matched_items, 'count': len(matched_items), 'values': values}
70
+
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/filtering/like_executor.py
4
+
5
+ LIKE 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
+ import re
15
+ from typing import Any, Dict, List
16
+ from ..base import AUniversalOperationExecutor
17
+ from ..contracts import Action, ExecutionContext, ExecutionResult
18
+ from ..types import OperationType
19
+
20
+
21
+ class LikeExecutor(AUniversalOperationExecutor):
22
+ """
23
+ LIKE operation executor - Universal operation.
24
+
25
+ Pattern matching using SQL LIKE syntax (% and _ wildcards).
26
+
27
+ Capability: Universal
28
+ Operation Type: FILTERING
29
+ """
30
+
31
+ OPERATION_NAME = "LIKE"
32
+ OPERATION_TYPE = OperationType.FILTERING
33
+ SUPPORTED_NODE_TYPES = [] # Universal
34
+
35
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
36
+ """Execute LIKE operation."""
37
+ params = action.params
38
+ field = params.get('field')
39
+ pattern = params.get('pattern', '')
40
+ path = params.get('path', None)
41
+
42
+ node = context.node
43
+ result_data = self._execute_like(node, field, pattern, path, context)
44
+
45
+ return ExecutionResult(
46
+ success=True,
47
+ data=result_data,
48
+ operation=self.OPERATION_NAME,
49
+ metadata={'matched_count': len(result_data.get('items', []))}
50
+ )
51
+
52
+ def _execute_like(self, node: Any, field: str, pattern: str, path: str, context: ExecutionContext) -> Dict:
53
+ """Execute LIKE pattern matching."""
54
+ matched_items = []
55
+
56
+ # Convert SQL LIKE pattern to regex
57
+ # % = .* (any characters)
58
+ # _ = . (single character)
59
+ regex_pattern = pattern.replace('%', '.*').replace('_', '.')
60
+ regex = re.compile(regex_pattern, re.IGNORECASE)
61
+
62
+ # Get data
63
+ if path:
64
+ data = node.get(path, default=[])
65
+ else:
66
+ data = node.to_native()
67
+
68
+ # Match pattern
69
+ if isinstance(data, list):
70
+ for item in data:
71
+ value = item.get(field) if isinstance(item, dict) else str(item)
72
+ if value and regex.match(str(value)):
73
+ matched_items.append(item)
74
+
75
+ return {'items': matched_items, 'count': len(matched_items), 'pattern': pattern}
76
+
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/filtering/optional_executor.py
4
+
5
+ OPTIONAL 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
+
19
+
20
+ class OptionalExecutor(AUniversalOperationExecutor):
21
+ """
22
+ OPTIONAL operation executor - Universal operation.
23
+
24
+ Performs optional matching (like LEFT JOIN or OPTIONAL MATCH in SPARQL).
25
+ Returns items whether or not the optional condition matches.
26
+
27
+ Capability: Universal
28
+ Operation Type: FILTERING
29
+ """
30
+
31
+ OPERATION_NAME = "OPTIONAL"
32
+ OPERATION_TYPE = OperationType.FILTERING
33
+ SUPPORTED_NODE_TYPES = [] # Universal
34
+
35
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
36
+ """Execute OPTIONAL operation."""
37
+ params = action.params
38
+ condition = params.get('condition', None)
39
+ path = params.get('path', None)
40
+
41
+ node = context.node
42
+ result_data = self._execute_optional(node, condition, path, context)
43
+
44
+ return ExecutionResult(
45
+ success=True,
46
+ data=result_data,
47
+ operation=self.OPERATION_NAME,
48
+ metadata={'total_count': len(result_data.get('items', []))}
49
+ )
50
+
51
+ def _execute_optional(self, node: Any, condition: Any, path: str, context: ExecutionContext) -> Dict:
52
+ """Execute OPTIONAL matching."""
53
+ all_items = []
54
+
55
+ # Get data
56
+ if path:
57
+ data = node.get(path, default=[])
58
+ else:
59
+ data = node.to_native()
60
+
61
+ # Include all items, mark which match optional condition
62
+ if isinstance(data, list):
63
+ for item in data:
64
+ result_item = item.copy() if isinstance(item, dict) else {'value': item}
65
+ result_item['_optional_matched'] = self._matches_condition(item, condition)
66
+ all_items.append(result_item)
67
+
68
+ return {'items': all_items, 'count': len(all_items)}
69
+
70
+ def _matches_condition(self, item: Any, condition: Any) -> bool:
71
+ """Check if item matches optional condition."""
72
+ if condition is None:
73
+ return False
74
+ # Simplified condition matching
75
+ return False
76
+
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/filtering/range_executor.py
4
+
5
+ RANGE 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 AOperationExecutor
16
+ from ..contracts import Action, ExecutionContext, ExecutionResult
17
+ from ..types import OperationType
18
+ from ...nodes.strategies.contracts import NodeType
19
+
20
+
21
+ class RangeExecutor(AOperationExecutor):
22
+ """
23
+ RANGE operation executor - Tree/Matrix operation.
24
+
25
+ Performs range queries on ordered data structures.
26
+ Optimized for TREE and MATRIX node types with efficient range scanning.
27
+
28
+ Capability: Tree/Matrix only
29
+ Operation Type: FILTERING
30
+ """
31
+
32
+ OPERATION_NAME = "RANGE"
33
+ OPERATION_TYPE = OperationType.FILTERING
34
+ SUPPORTED_NODE_TYPES = [NodeType.TREE, NodeType.MATRIX, NodeType.HYBRID]
35
+
36
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
37
+ """Execute RANGE operation."""
38
+ params = action.params
39
+ start = params.get('start')
40
+ end = params.get('end')
41
+ inclusive = params.get('inclusive', True)
42
+ path = params.get('path', None)
43
+
44
+ node = context.node
45
+ result_data = self._execute_range(node, start, end, inclusive, path, context)
46
+
47
+ return ExecutionResult(
48
+ success=True,
49
+ data=result_data,
50
+ operation=self.OPERATION_NAME,
51
+ metadata={'item_count': len(result_data.get('items', []))}
52
+ )
53
+
54
+ def _execute_range(self, node: Any, start: Any, end: Any, inclusive: bool,
55
+ path: str, context: ExecutionContext) -> Dict:
56
+ """Execute RANGE query."""
57
+ range_items = []
58
+
59
+ # Get data
60
+ if path:
61
+ data = node.get(path, default={})
62
+ else:
63
+ data = node.to_native()
64
+
65
+ # Range query (simplified - would use tree traversal in real impl)
66
+ if isinstance(data, dict):
67
+ for key, value in sorted(data.items()):
68
+ if inclusive:
69
+ if start <= key <= end:
70
+ range_items.append({key: value})
71
+ else:
72
+ if start < key < end:
73
+ range_items.append({key: value})
74
+
75
+ return {
76
+ 'items': range_items,
77
+ 'count': len(range_items),
78
+ 'range': {'start': start, 'end': end, 'inclusive': inclusive}
79
+ }
80
+
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/filtering/term_executor.py
4
+
5
+ TERM 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
+
19
+
20
+ class TermExecutor(AUniversalOperationExecutor):
21
+ """
22
+ TERM operation executor - Universal operation.
23
+
24
+ Performs term-based search/matching (exact term match).
25
+ Used in search engines and text indexing.
26
+
27
+ Capability: Universal
28
+ Operation Type: SEARCH
29
+ """
30
+
31
+ OPERATION_NAME = "TERM"
32
+ OPERATION_TYPE = OperationType.SEARCH
33
+ SUPPORTED_NODE_TYPES = [] # Universal
34
+
35
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
36
+ """Execute TERM operation."""
37
+ params = action.params
38
+ field = params.get('field')
39
+ term = params.get('term', '')
40
+ path = params.get('path', None)
41
+ case_sensitive = params.get('case_sensitive', False)
42
+
43
+ node = context.node
44
+ result_data = self._execute_term(node, field, term, path, case_sensitive, context)
45
+
46
+ return ExecutionResult(
47
+ success=True,
48
+ data=result_data,
49
+ operation=self.OPERATION_NAME,
50
+ metadata={'matched_count': len(result_data.get('items', []))}
51
+ )
52
+
53
+ def _execute_term(self, node: Any, field: str, term: str, path: str,
54
+ case_sensitive: bool, context: ExecutionContext) -> Dict:
55
+ """Execute TERM search."""
56
+ matched_items = []
57
+
58
+ # Get data
59
+ if path:
60
+ data = node.get(path, default=[])
61
+ else:
62
+ data = node.to_native()
63
+
64
+ # Normalize term if case-insensitive
65
+ search_term = term if case_sensitive else term.lower()
66
+
67
+ # Search for term
68
+ if isinstance(data, list):
69
+ for item in data:
70
+ value = item.get(field) if isinstance(item, dict) else str(item)
71
+ if value:
72
+ compare_value = str(value) if case_sensitive else str(value).lower()
73
+ if search_term in compare_value:
74
+ matched_items.append(item)
75
+
76
+ return {'items': matched_items, 'count': len(matched_items), 'term': term}
77
+
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/filtering/values_executor.py
4
+
5
+ VALUES 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
+
19
+
20
+ class ValuesExecutor(AUniversalOperationExecutor):
21
+ """
22
+ VALUES operation executor - Universal operation.
23
+
24
+ Handles VALUES clause (inline data/constants).
25
+ Used in SQL and SPARQL for providing inline value lists.
26
+
27
+ Capability: Universal
28
+ Operation Type: DATA_OPS
29
+ """
30
+
31
+ OPERATION_NAME = "VALUES"
32
+ OPERATION_TYPE = OperationType.DATA_OPS
33
+ SUPPORTED_NODE_TYPES = [] # Universal
34
+
35
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
36
+ """Execute VALUES operation."""
37
+ params = action.params
38
+ values = params.get('values', [])
39
+ columns = params.get('columns', [])
40
+
41
+ result_data = self._execute_values(values, columns, context)
42
+
43
+ return ExecutionResult(
44
+ success=True,
45
+ data=result_data,
46
+ operation=self.OPERATION_NAME,
47
+ metadata={'row_count': len(result_data.get('rows', []))}
48
+ )
49
+
50
+ def _execute_values(self, values: List, columns: List, context: ExecutionContext) -> Dict:
51
+ """Execute VALUES inline data."""
52
+ rows = []
53
+
54
+ # Convert values to rows with column names
55
+ if columns:
56
+ for value_row in values:
57
+ if isinstance(value_row, list):
58
+ row = dict(zip(columns, value_row))
59
+ rows.append(row)
60
+ elif isinstance(value_row, dict):
61
+ rows.append(value_row)
62
+ else:
63
+ # No columns specified, use values as-is
64
+ rows = values if isinstance(values, list) else [values]
65
+
66
+ return {
67
+ 'rows': rows,
68
+ 'count': len(rows),
69
+ 'columns': columns
70
+ }
71
+
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/filtering/where_executor.py
4
+
5
+ WHERE 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 typing import Any, List, Dict
15
+ from ..base import AUniversalOperationExecutor
16
+ from ..contracts import Action, ExecutionContext, ExecutionResult
17
+
18
+
19
+ class WhereExecutor(AUniversalOperationExecutor):
20
+ """WHERE operation executor - Universal filtering operation."""
21
+
22
+ OPERATION_NAME = "WHERE"
23
+
24
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
25
+ """Execute WHERE operation - filter data based on condition."""
26
+ condition = action.params.get('condition', '')
27
+ data = action.params.get('data', [])
28
+
29
+ # Simple condition evaluation (can be enhanced with expression parser)
30
+ filtered = []
31
+ for item in data:
32
+ if self._evaluate_condition(item, condition):
33
+ filtered.append(item)
34
+
35
+ return ExecutionResult(data=filtered, affected_count=len(filtered))
36
+
37
+ def _evaluate_condition(self, item: Any, condition: str) -> bool:
38
+ """Evaluate condition on item (simplified)."""
39
+ # TODO: Implement full expression evaluation
40
+ # For now, return True (pass-through)
41
+ return True
42
+
43
+
44
+ __all__ = ['WhereExecutor']
@@ -0,0 +1,15 @@
1
+ """Graph operation executors."""
2
+
3
+ from .match_executor import MatchExecutor
4
+ from .path_executor import PathExecutor
5
+ from .out_executor import OutExecutor
6
+ from .in_traverse_executor import InTraverseExecutor
7
+ from .return_executor import ReturnExecutor
8
+
9
+ __all__ = [
10
+ 'MatchExecutor',
11
+ 'PathExecutor',
12
+ 'OutExecutor',
13
+ 'InTraverseExecutor',
14
+ 'ReturnExecutor',
15
+ ]
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/graph/in_traverse_executor.py
4
+
5
+ IN_TRAVERSE 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 AOperationExecutor
16
+ from ..contracts import Action, ExecutionContext, ExecutionResult
17
+ from ..types import OperationType
18
+ from ...nodes.strategies.contracts import NodeType
19
+
20
+ class InTraverseExecutor(AOperationExecutor):
21
+ """
22
+ IN_TRAVERSE operation executor.
23
+
24
+ Inbound graph traversal
25
+
26
+ Capability: GRAPH, TREE, HYBRID only
27
+ Operation Type: GRAPH
28
+ """
29
+
30
+ OPERATION_NAME = "IN_TRAVERSE"
31
+ OPERATION_TYPE = OperationType.GRAPH
32
+ SUPPORTED_NODE_TYPES = [NodeType.GRAPH, NodeType.TREE, NodeType.HYBRID]
33
+
34
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
35
+ """Execute IN_TRAVERSE operation."""
36
+ params = action.params
37
+ node = context.node
38
+
39
+ result_data = self._execute_in_traverse(node, params, context)
40
+
41
+ return ExecutionResult(
42
+ success=True,
43
+ data=result_data,
44
+ operation=self.OPERATION_NAME,
45
+ metadata={'operation': self.OPERATION_NAME}
46
+ )
47
+
48
+ def _execute_in_traverse(self, node: Any, params: Dict, context: ExecutionContext) -> Dict:
49
+ """Execute in_traverse logic."""
50
+ # Implementation here
51
+ return {'result': 'IN_TRAVERSE executed', 'params': params}
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/graph/match_executor.py
4
+
5
+ MATCH 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 AOperationExecutor
16
+ from ..contracts import Action, ExecutionContext, ExecutionResult
17
+ from ..types import OperationType
18
+ from ...nodes.strategies.contracts import NodeType
19
+
20
+ class MatchExecutor(AOperationExecutor):
21
+ """
22
+ MATCH operation executor.
23
+
24
+ Graph pattern matching
25
+
26
+ Capability: GRAPH, TREE, HYBRID only
27
+ Operation Type: GRAPH
28
+ """
29
+
30
+ OPERATION_NAME = "MATCH"
31
+ OPERATION_TYPE = OperationType.GRAPH
32
+ SUPPORTED_NODE_TYPES = [NodeType.GRAPH, NodeType.TREE, NodeType.HYBRID]
33
+
34
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
35
+ """Execute MATCH operation."""
36
+ params = action.params
37
+ node = context.node
38
+
39
+ result_data = self._execute_match(node, params, context)
40
+
41
+ return ExecutionResult(
42
+ success=True,
43
+ data=result_data,
44
+ operation=self.OPERATION_NAME,
45
+ metadata={'operation': self.OPERATION_NAME}
46
+ )
47
+
48
+ def _execute_match(self, node: Any, params: Dict, context: ExecutionContext) -> Dict:
49
+ """Execute match logic."""
50
+ # Implementation here
51
+ return {'result': 'MATCH executed', 'params': params}
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ #exonware/xwnode/src/exonware/xwnode/queries/executors/graph/out_executor.py
4
+
5
+ OUT 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 AOperationExecutor
16
+ from ..contracts import Action, ExecutionContext, ExecutionResult
17
+ from ..types import OperationType
18
+ from ...nodes.strategies.contracts import NodeType
19
+
20
+ class OutExecutor(AOperationExecutor):
21
+ """
22
+ OUT operation executor.
23
+
24
+ Outbound graph traversal
25
+
26
+ Capability: GRAPH, TREE, HYBRID only
27
+ Operation Type: GRAPH
28
+ """
29
+
30
+ OPERATION_NAME = "OUT"
31
+ OPERATION_TYPE = OperationType.GRAPH
32
+ SUPPORTED_NODE_TYPES = [NodeType.GRAPH, NodeType.TREE, NodeType.HYBRID]
33
+
34
+ def _do_execute(self, action: Action, context: ExecutionContext) -> ExecutionResult:
35
+ """Execute OUT operation."""
36
+ params = action.params
37
+ node = context.node
38
+
39
+ result_data = self._execute_out(node, params, context)
40
+
41
+ return ExecutionResult(
42
+ success=True,
43
+ data=result_data,
44
+ operation=self.OPERATION_NAME,
45
+ metadata={'operation': self.OPERATION_NAME}
46
+ )
47
+
48
+ def _execute_out(self, node: Any, params: Dict, context: ExecutionContext) -> Dict:
49
+ """Execute out logic."""
50
+ # Implementation here
51
+ return {'result': 'OUT executed', 'params': params}