exonware-xwquery 0.0.1.4__tar.gz
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_xwquery-0.0.1.4/.gitignore +153 -0
- exonware_xwquery-0.0.1.4/LICENSE +22 -0
- exonware_xwquery-0.0.1.4/PKG-INFO +423 -0
- exonware_xwquery-0.0.1.4/README.md +384 -0
- exonware_xwquery-0.0.1.4/docs/GITHUB_SETUP.md +278 -0
- exonware_xwquery-0.0.1.4/docs/PROJECT_PHASES.md +219 -0
- exonware_xwquery-0.0.1.4/examples/basic_usage.py +115 -0
- exonware_xwquery-0.0.1.4/pyproject.toml +117 -0
- exonware_xwquery-0.0.1.4/requirements.txt +61 -0
- exonware_xwquery-0.0.1.4/src/exonware/__init__.py +8 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/__init__.py +260 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/__init__.py +163 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/__init__.py +37 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/aggregate_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/ask_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/construct_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/describe_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/for_loop_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/foreach_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/join_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/let_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/mutation_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/options_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/pipe_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/subscribe_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/subscription_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/union_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/window_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/advanced/with_cte_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/__init__.py +23 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/avg_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/count_executor.py +38 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/distinct_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/group_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/having_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/max_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/min_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/sum_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/aggregation/summarize_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/array/__init__.py +9 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/array/indexing_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/array/slicing_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/base.py +258 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/capability_checker.py +208 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/contracts.py +166 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/core/__init__.py +17 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/core/create_executor.py +96 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/core/delete_executor.py +99 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/core/drop_executor.py +100 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/core/insert_executor.py +39 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/core/select_executor.py +247 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/core/update_executor.py +102 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/data/__init__.py +13 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/data/alter_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/data/load_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/data/merge_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/data/store_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/defs.py +93 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/engine.py +221 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/errors.py +68 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/__init__.py +25 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/between_executor.py +80 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/filter_executor.py +79 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/has_executor.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/in_executor.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/like_executor.py +76 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/optional_executor.py +76 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/range_executor.py +80 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/term_executor.py +77 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/values_executor.py +71 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/filtering/where_executor.py +44 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/graph/__init__.py +15 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/graph/in_traverse_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/graph/match_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/graph/out_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/graph/path_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/graph/return_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/ordering/__init__.py +9 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/ordering/by_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/ordering/order_executor.py +51 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/projection/__init__.py +9 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/projection/extend_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/projection/project_executor.py +50 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/executors/registry.py +173 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/parsers/__init__.py +26 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/parsers/base.py +86 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/parsers/contracts.py +46 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/parsers/errors.py +53 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/parsers/sql_param_extractor.py +318 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/__init__.py +24 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/base.py +236 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/cql.py +201 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/cypher.py +181 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/datalog.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/elastic_dsl.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/eql.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/flux.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/gql.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/graphql.py +240 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/gremlin.py +181 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/hiveql.py +214 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/hql.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/jmespath.py +219 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/jq.py +66 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/json_query.py +66 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/jsoniq.py +248 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/kql.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/linq.py +238 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/logql.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/mql.py +68 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/n1ql.py +210 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/partiql.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/pig.py +215 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/promql.py +70 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/sparql.py +220 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/sql.py +275 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/xml_query.py +66 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/xpath.py +223 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/xquery.py +258 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/xwnode_executor.py +332 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/strategies/xwquery.py +456 -0
- exonware_xwquery-0.0.1.4/src/exonware/xwquery/version.py +78 -0
- exonware_xwquery-0.0.1.4/src/xwquery.py +21 -0
- exonware_xwquery-0.0.1.4/src/xwquery_wrapper.py +15 -0
- exonware_xwquery-0.0.1.4/tests/__init__.py +10 -0
- exonware_xwquery-0.0.1.4/tests/core/__init__.py +2 -0
- exonware_xwquery-0.0.1.4/tests/core/test_xwquery_basic.py +82 -0
- exonware_xwquery-0.0.1.4/tests/integration/__init__.py +2 -0
- exonware_xwquery-0.0.1.4/tests/runner.py +52 -0
- exonware_xwquery-0.0.1.4/tests/unit/__init__.py +2 -0
- exonware_xwquery-0.0.1.4/tests/verify_installation.py +76 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.nox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
*.py,cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
cover/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
.pybuilder/
|
|
74
|
+
target/
|
|
75
|
+
|
|
76
|
+
# Jupyter Notebook
|
|
77
|
+
.ipynb_checkpoints
|
|
78
|
+
|
|
79
|
+
# IPython
|
|
80
|
+
profile_default/
|
|
81
|
+
ipython_config.py
|
|
82
|
+
|
|
83
|
+
# pyenv
|
|
84
|
+
.python-version
|
|
85
|
+
|
|
86
|
+
# pipenv
|
|
87
|
+
Pipfile.lock
|
|
88
|
+
|
|
89
|
+
# poetry
|
|
90
|
+
poetry.lock
|
|
91
|
+
|
|
92
|
+
# pdm
|
|
93
|
+
.pdm.toml
|
|
94
|
+
|
|
95
|
+
# PEP 582
|
|
96
|
+
__pypackages__/
|
|
97
|
+
|
|
98
|
+
# Celery stuff
|
|
99
|
+
celerybeat-schedule
|
|
100
|
+
celerybeat.pid
|
|
101
|
+
|
|
102
|
+
# SageMath parsed files
|
|
103
|
+
*.sage.py
|
|
104
|
+
|
|
105
|
+
# Environments
|
|
106
|
+
.env
|
|
107
|
+
.venv
|
|
108
|
+
env/
|
|
109
|
+
venv/
|
|
110
|
+
ENV/
|
|
111
|
+
env.bak/
|
|
112
|
+
venv.bak/
|
|
113
|
+
|
|
114
|
+
# Spyder project settings
|
|
115
|
+
.spyderproject
|
|
116
|
+
.spyproject
|
|
117
|
+
|
|
118
|
+
# Rope project settings
|
|
119
|
+
.ropeproject
|
|
120
|
+
|
|
121
|
+
# mkdocs documentation
|
|
122
|
+
/site
|
|
123
|
+
|
|
124
|
+
# mypy
|
|
125
|
+
.mypy_cache/
|
|
126
|
+
.dmypy.json
|
|
127
|
+
dmypy.json
|
|
128
|
+
|
|
129
|
+
# Pyre type checker
|
|
130
|
+
.pyre/
|
|
131
|
+
|
|
132
|
+
# pytype static type analyzer
|
|
133
|
+
.pytype/
|
|
134
|
+
|
|
135
|
+
# Cython debug symbols
|
|
136
|
+
cython_debug/
|
|
137
|
+
|
|
138
|
+
# IDE
|
|
139
|
+
.vscode/
|
|
140
|
+
.idea/
|
|
141
|
+
*.swp
|
|
142
|
+
*.swo
|
|
143
|
+
*~
|
|
144
|
+
|
|
145
|
+
# OS
|
|
146
|
+
.DS_Store
|
|
147
|
+
Thumbs.db
|
|
148
|
+
|
|
149
|
+
# Project specific
|
|
150
|
+
*.pyc
|
|
151
|
+
fix_imports.py
|
|
152
|
+
fix_imports_simple.py
|
|
153
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 eXonware.com - Eng. Muhammad AlShehri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: exonware-xwquery
|
|
3
|
+
Version: 0.0.1.4
|
|
4
|
+
Summary: Universal query language for data structures - 50+ operations, 35+ format converters
|
|
5
|
+
Project-URL: Homepage, https://exonware.com
|
|
6
|
+
Project-URL: Repository, https://github.com/exonware/xwquery
|
|
7
|
+
Project-URL: Documentation, https://github.com/exonware/xwquery#readme
|
|
8
|
+
Author-email: "Eng. Muhammad AlShehri" <connect@exonware.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: conversion,cypher,data,exonware,graphql,query,sparql,sql
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Requires-Dist: exonware-xwnode
|
|
26
|
+
Requires-Dist: exonware-xwsystem
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
34
|
+
Provides-Extra: full
|
|
35
|
+
Requires-Dist: exonware-xwnode[full]; extra == 'full'
|
|
36
|
+
Provides-Extra: lazy
|
|
37
|
+
Requires-Dist: exonware-xwnode[lazy]; extra == 'lazy'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# ๐ **xwquery: Universal Query Language for Python**
|
|
41
|
+
|
|
42
|
+
**Company:** eXonware.com
|
|
43
|
+
**Author:** Eng. Muhammad AlShehri
|
|
44
|
+
**Email:** connect@exonware.com
|
|
45
|
+
**Version:** 0.0.1.4
|
|
46
|
+
|
|
47
|
+
## ๐ฏ **What is xwquery?**
|
|
48
|
+
|
|
49
|
+
xwquery is the universal query language for Python that works across all data structures. Write once, query anywhere - from simple lists to complex graphs, from JSON to XML, from nodes to entities.
|
|
50
|
+
|
|
51
|
+
**Think of it as SQL for everything.**
|
|
52
|
+
|
|
53
|
+
## โก **Quick Start**
|
|
54
|
+
|
|
55
|
+
### **Installation**
|
|
56
|
+
```bash
|
|
57
|
+
pip install exonware-xwquery
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### **Basic Usage**
|
|
61
|
+
```python
|
|
62
|
+
from exonware.xwquery import XWQuery
|
|
63
|
+
|
|
64
|
+
# Query any data structure
|
|
65
|
+
data = {'users': [
|
|
66
|
+
{'name': 'Alice', 'age': 30, 'city': 'NYC'},
|
|
67
|
+
{'name': 'Bob', 'age': 25, 'city': 'LA'},
|
|
68
|
+
{'name': 'Charlie', 'age': 35, 'city': 'NYC'}
|
|
69
|
+
]}
|
|
70
|
+
|
|
71
|
+
# Use familiar SQL-like syntax
|
|
72
|
+
result = XWQuery.execute("""
|
|
73
|
+
SELECT name, age
|
|
74
|
+
FROM users
|
|
75
|
+
WHERE age > 25 AND city = 'NYC'
|
|
76
|
+
""", data)
|
|
77
|
+
|
|
78
|
+
print(result)
|
|
79
|
+
# [{'name': 'Alice', 'age': 30}, {'name': 'Charlie', 'age': 35}]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## ๐ฏ **Perfect For:**
|
|
83
|
+
|
|
84
|
+
- **๐ Data Querying** - Query any Python data structure with SQL-like syntax
|
|
85
|
+
- **๐ Format Conversion** - Convert between 35+ query formats (SQL, GraphQL, Cypher, etc.)
|
|
86
|
+
- **๐ Data Transformation** - Transform and filter data with powerful operations
|
|
87
|
+
- **๐ Universal Interface** - One query language for nodes, data, schemas, and entities
|
|
88
|
+
- **๐ Performance** - Optimized execution for different data structure types
|
|
89
|
+
|
|
90
|
+
## ๐ **Key Features**
|
|
91
|
+
|
|
92
|
+
### **50 Query Operations**
|
|
93
|
+
โ
**Core CRUD**: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP
|
|
94
|
+
โ
**Filtering**: WHERE, FILTER, BETWEEN, LIKE, IN, HAS, TERM, RANGE
|
|
95
|
+
โ
**Aggregation**: SUM, COUNT, AVG, MIN, MAX, GROUP BY, HAVING
|
|
96
|
+
โ
**Graph Operations**: MATCH, PATH, OUT, IN_TRAVERSE, RETURN
|
|
97
|
+
โ
**Advanced**: JOIN, UNION, WITH, MERGE, WINDOW, PIPE
|
|
98
|
+
|
|
99
|
+
### **35+ Format Converters**
|
|
100
|
+
โ
**SQL Dialects**: Standard SQL, PostgreSQL, MySQL, SQLite
|
|
101
|
+
โ
**Graph Queries**: Cypher, Gremlin, SPARQL, GraphQL
|
|
102
|
+
โ
**Document Queries**: MongoDB (MQL), CouchDB, Elasticsearch (DSL)
|
|
103
|
+
โ
**Time Series**: PromQL, Flux, LogQL
|
|
104
|
+
โ
**Data Queries**: JQ, JMESPath, JSONiq, XPath, XQuery
|
|
105
|
+
โ
**And many more...**
|
|
106
|
+
|
|
107
|
+
### **Type-Aware Execution**
|
|
108
|
+
```python
|
|
109
|
+
# Automatically optimizes based on data structure
|
|
110
|
+
linear_data = [1, 2, 3, 4, 5]
|
|
111
|
+
tree_data = {'a': 1, 'b': 2, 'c': 3}
|
|
112
|
+
graph_data = {'nodes': [...], 'edges': [...]}
|
|
113
|
+
|
|
114
|
+
# Same query, optimized execution for each type!
|
|
115
|
+
XWQuery.execute("SELECT * WHERE value > 2", linear_data) # Sequential scan
|
|
116
|
+
XWQuery.execute("SELECT * WHERE key BETWEEN 'a' AND 'c'", tree_data) # Tree traversal
|
|
117
|
+
XWQuery.execute("MATCH (n)-[r]->(m)", graph_data) # Graph algorithm
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## ๐ **XWQuery Script Language**
|
|
121
|
+
|
|
122
|
+
### **Comprehensive Syntax**
|
|
123
|
+
|
|
124
|
+
```xquery
|
|
125
|
+
-- Data retrieval
|
|
126
|
+
SELECT name, email, age FROM users WHERE age >= 18;
|
|
127
|
+
|
|
128
|
+
-- Aggregation
|
|
129
|
+
SELECT
|
|
130
|
+
department,
|
|
131
|
+
COUNT(*) as employee_count,
|
|
132
|
+
AVG(salary) as avg_salary
|
|
133
|
+
FROM employees
|
|
134
|
+
GROUP BY department
|
|
135
|
+
HAVING avg_salary > 50000;
|
|
136
|
+
|
|
137
|
+
-- Graph pattern matching
|
|
138
|
+
MATCH (u:User)-[:FRIENDS_WITH]->(f:User)
|
|
139
|
+
WHERE u.age > 25
|
|
140
|
+
RETURN u.name, f.name;
|
|
141
|
+
|
|
142
|
+
-- Data transformation
|
|
143
|
+
PIPE users
|
|
144
|
+
|> FILTER age > 18
|
|
145
|
+
|> EXTEND full_name = CONCAT(first_name, ' ', last_name)
|
|
146
|
+
|> PROJECT user_id, full_name, email
|
|
147
|
+
|> ORDER BY full_name;
|
|
148
|
+
|
|
149
|
+
-- Complex joins
|
|
150
|
+
SELECT u.name, o.total_amount
|
|
151
|
+
FROM users u
|
|
152
|
+
INNER JOIN orders o ON u.id = o.user_id
|
|
153
|
+
WHERE o.order_date >= '2024-01-01';
|
|
154
|
+
|
|
155
|
+
-- Window functions
|
|
156
|
+
SELECT
|
|
157
|
+
product_id,
|
|
158
|
+
price,
|
|
159
|
+
AVG(price) OVER (PARTITION BY category) as avg_category_price
|
|
160
|
+
FROM products;
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### **Format Conversion**
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
# Parse SQL, convert to GraphQL
|
|
167
|
+
sql_query = "SELECT id, name FROM users WHERE age > 25"
|
|
168
|
+
graphql = XWQuery.convert(sql_query, from_format='sql', to_format='graphql')
|
|
169
|
+
# Result: "query { users(filter: {age: {gt: 25}}) { id name } }"
|
|
170
|
+
|
|
171
|
+
# Parse Cypher, convert to SQL
|
|
172
|
+
cypher_query = "MATCH (u:User)-[:WORKS_AT]->(c:Company) RETURN u.name, c.name"
|
|
173
|
+
sql = XWQuery.convert(cypher_query, from_format='cypher', to_format='sql')
|
|
174
|
+
# Result: "SELECT u.name, c.name FROM users u JOIN companies c ON ..."
|
|
175
|
+
|
|
176
|
+
# Universal intermediate representation
|
|
177
|
+
any_query = XWQuery.parse(query_string) # Parses to actions tree
|
|
178
|
+
target_format = any_query.to_format('mongodb') # Convert to any format
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## ๐ **Integration with exonware Stack**
|
|
182
|
+
|
|
183
|
+
### **Query Nodes (xwnode)**
|
|
184
|
+
```python
|
|
185
|
+
from exonware.xwnode import XWNode
|
|
186
|
+
from exonware.xwquery import XWQuery
|
|
187
|
+
|
|
188
|
+
node = XWNode.from_native({'users': [...]})
|
|
189
|
+
result = XWQuery.execute("SELECT * FROM users WHERE active = true", node)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### **Query Data (xwdata)**
|
|
193
|
+
```python
|
|
194
|
+
from exonware.xwdata import XWData
|
|
195
|
+
from exonware.xwquery import XWQuery
|
|
196
|
+
|
|
197
|
+
# Load, query, convert format
|
|
198
|
+
data = XWData.load('users.json')
|
|
199
|
+
filtered = XWQuery.execute("SELECT * WHERE age > 18", data)
|
|
200
|
+
filtered.save('adults.xml') # Save in different format!
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### **Query Entities (xwentity)**
|
|
204
|
+
```python
|
|
205
|
+
from exonware.xwentity import XWEntity
|
|
206
|
+
from exonware.xwquery import XWQuery
|
|
207
|
+
|
|
208
|
+
class User(XWEntity):
|
|
209
|
+
name: str
|
|
210
|
+
age: int
|
|
211
|
+
email: str
|
|
212
|
+
|
|
213
|
+
# Schema-validated queries
|
|
214
|
+
users = XWQuery.execute("SELECT * FROM User WHERE age > 18")
|
|
215
|
+
# โ
Validates 'age' exists in schema
|
|
216
|
+
# โ
Ensures age is int type
|
|
217
|
+
# โ
Returns typed User entities
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## ๐ **Examples**
|
|
221
|
+
|
|
222
|
+
### **Example 1: Simple Filtering**
|
|
223
|
+
```python
|
|
224
|
+
products = [
|
|
225
|
+
{'id': 1, 'name': 'Laptop', 'price': 999, 'category': 'Electronics'},
|
|
226
|
+
{'id': 2, 'name': 'Mouse', 'price': 29, 'category': 'Electronics'},
|
|
227
|
+
{'id': 3, 'name': 'Desk', 'price': 299, 'category': 'Furniture'},
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
result = XWQuery.execute("""
|
|
231
|
+
SELECT name, price
|
|
232
|
+
FROM products
|
|
233
|
+
WHERE category = 'Electronics' AND price < 500
|
|
234
|
+
""", products)
|
|
235
|
+
# [{'name': 'Mouse', 'price': 29}]
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### **Example 2: Aggregation**
|
|
239
|
+
```python
|
|
240
|
+
orders = [
|
|
241
|
+
{'user_id': 1, 'amount': 100},
|
|
242
|
+
{'user_id': 1, 'amount': 200},
|
|
243
|
+
{'user_id': 2, 'amount': 150},
|
|
244
|
+
{'user_id': 2, 'amount': 300},
|
|
245
|
+
]
|
|
246
|
+
|
|
247
|
+
result = XWQuery.execute("""
|
|
248
|
+
SELECT
|
|
249
|
+
user_id,
|
|
250
|
+
COUNT(*) as order_count,
|
|
251
|
+
SUM(amount) as total_spent,
|
|
252
|
+
AVG(amount) as avg_order
|
|
253
|
+
FROM orders
|
|
254
|
+
GROUP BY user_id
|
|
255
|
+
HAVING total_spent > 200
|
|
256
|
+
""", orders)
|
|
257
|
+
# [
|
|
258
|
+
# {'user_id': 1, 'order_count': 2, 'total_spent': 300, 'avg_order': 150},
|
|
259
|
+
# {'user_id': 2, 'order_count': 2, 'total_spent': 450, 'avg_order': 225}
|
|
260
|
+
# ]
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### **Example 3: Graph Traversal**
|
|
264
|
+
```python
|
|
265
|
+
graph = {
|
|
266
|
+
'nodes': [
|
|
267
|
+
{'id': 1, 'type': 'User', 'name': 'Alice'},
|
|
268
|
+
{'id': 2, 'type': 'User', 'name': 'Bob'},
|
|
269
|
+
{'id': 3, 'type': 'Post', 'title': 'Hello World'}
|
|
270
|
+
],
|
|
271
|
+
'edges': [
|
|
272
|
+
{'from': 1, 'to': 2, 'type': 'FRIENDS_WITH'},
|
|
273
|
+
{'from': 1, 'to': 3, 'type': 'AUTHORED'}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
result = XWQuery.execute("""
|
|
278
|
+
MATCH (u:User)-[:FRIENDS_WITH]->(friend:User)
|
|
279
|
+
WHERE u.name = 'Alice'
|
|
280
|
+
RETURN u.name, friend.name
|
|
281
|
+
""", graph)
|
|
282
|
+
# [{'u.name': 'Alice', 'friend.name': 'Bob'}]
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### **Example 4: Format Conversion**
|
|
286
|
+
```python
|
|
287
|
+
# SQL to MongoDB
|
|
288
|
+
sql = "SELECT name, email FROM users WHERE age > 25"
|
|
289
|
+
mongo = XWQuery.convert(sql, to_format='mongodb')
|
|
290
|
+
# db.users.find({age: {$gt: 25}}, {name: 1, email: 1})
|
|
291
|
+
|
|
292
|
+
# GraphQL to SQL
|
|
293
|
+
graphql = "query { users(filter: {active: true}) { id name email } }"
|
|
294
|
+
sql = XWQuery.convert(graphql, to_format='sql')
|
|
295
|
+
# SELECT id, name, email FROM users WHERE active = true
|
|
296
|
+
|
|
297
|
+
# Cypher to SPARQL
|
|
298
|
+
cypher = "MATCH (a:Person)-[:KNOWS]->(b:Person) RETURN a.name, b.name"
|
|
299
|
+
sparql = XWQuery.convert(cypher, to_format='sparql')
|
|
300
|
+
# SELECT ?aName ?bName WHERE { ?a rdf:type :Person . ?a :KNOWS ?b . ... }
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## ๐๏ธ **Architecture**
|
|
304
|
+
|
|
305
|
+
### **Query Execution Flow**
|
|
306
|
+
```
|
|
307
|
+
User Query String
|
|
308
|
+
โ
|
|
309
|
+
[Parser] - Parse to Actions Tree
|
|
310
|
+
โ
|
|
311
|
+
[Capability Checker] - Validate operation compatibility
|
|
312
|
+
โ
|
|
313
|
+
[Executor Registry] - Get appropriate executor
|
|
314
|
+
โ
|
|
315
|
+
[Type-Aware Execution] - Optimized for data structure type
|
|
316
|
+
โ
|
|
317
|
+
Result
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### **Supported Node Types**
|
|
321
|
+
- **LINEAR**: Arrays, lists, queues, stacks
|
|
322
|
+
- **TREE**: Hash maps, B-trees, AVL trees, tries
|
|
323
|
+
- **GRAPH**: Adjacency lists, graph structures
|
|
324
|
+
- **MATRIX**: Bitmaps, sparse matrices
|
|
325
|
+
- **HYBRID**: Combined structures
|
|
326
|
+
|
|
327
|
+
Each query operation automatically adapts to the node type for optimal performance.
|
|
328
|
+
|
|
329
|
+
## ๐ **Documentation**
|
|
330
|
+
|
|
331
|
+
- **[Complete Query Syntax](docs/XWQUERY_SCRIPT.md)** - All 50 operations detailed
|
|
332
|
+
- **[Format Converters](docs/CONVERTERS.md)** - 35+ format conversion guide
|
|
333
|
+
- **[API Reference](docs/API.md)** - Complete API documentation
|
|
334
|
+
- **[Examples](examples/)** - Practical usage examples
|
|
335
|
+
- **[Integration Guide](docs/INTEGRATION.md)** - Using with xwnode, xwdata, xwentity
|
|
336
|
+
|
|
337
|
+
## ๐ **Project Phases**
|
|
338
|
+
|
|
339
|
+
xwquery follows a structured 5-phase development approach designed to deliver enterprise-grade functionality.
|
|
340
|
+
|
|
341
|
+
### **Current Phase: ๐งช Version 0 - Experimental Stage**
|
|
342
|
+
- **Focus:** Core query engine, format converters, execution optimization
|
|
343
|
+
- **Status:** ๐ข **ACTIVE** - Foundation complete with 50 operations
|
|
344
|
+
|
|
345
|
+
### **Development Roadmap:**
|
|
346
|
+
- **Version 1 (Q1 2026):** Production Ready - Performance optimization
|
|
347
|
+
- **Version 2 (Q2 2026):** Query Optimization - Smart query planning
|
|
348
|
+
- **Version 3 (Q3 2026):** Distributed Queries - Parallel execution
|
|
349
|
+
- **Version 4 (Q4 2026):** Mars Standard Implementation - Universal interoperability
|
|
350
|
+
|
|
351
|
+
## ๐ง **Development**
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
# Install in development mode
|
|
355
|
+
pip install -e .
|
|
356
|
+
|
|
357
|
+
# Run tests
|
|
358
|
+
python tests/runner.py
|
|
359
|
+
|
|
360
|
+
# Run specific test types
|
|
361
|
+
python tests/runner.py --core
|
|
362
|
+
python tests/runner.py --unit
|
|
363
|
+
python tests/runner.py --integration
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## ๐ **Why xwquery?**
|
|
367
|
+
|
|
368
|
+
### **Before xwquery:**
|
|
369
|
+
```python
|
|
370
|
+
# Different syntax for different data structures
|
|
371
|
+
list_result = [x for x in data if x['age'] > 25] # List comprehension
|
|
372
|
+
dict_result = {k: v for k, v in data.items() if v > 25} # Dict comprehension
|
|
373
|
+
df_result = df[df['age'] > 25] # Pandas
|
|
374
|
+
collection.find({'age': {'$gt': 25}}) # MongoDB
|
|
375
|
+
# ... and so on
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### **With xwquery:**
|
|
379
|
+
```python
|
|
380
|
+
# One syntax for everything
|
|
381
|
+
result = XWQuery.execute("SELECT * WHERE age > 25", data)
|
|
382
|
+
# Works with: lists, dicts, nodes, dataframes, graphs, entities, etc.
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### **Key Benefits:**
|
|
386
|
+
1. **Universal Interface** - One query language for all data structures
|
|
387
|
+
2. **Format Agnostic** - Query JSON, save as XML, load CSV, export as YAML
|
|
388
|
+
3. **Type-Aware** - Automatically optimizes for data structure type
|
|
389
|
+
4. **Production-Grade** - Built on proven patterns and best practices
|
|
390
|
+
5. **Extensible** - Easy to add custom operations and formats
|
|
391
|
+
6. **Performance** - Optimized execution for each node type
|
|
392
|
+
|
|
393
|
+
## ๐ค **Contributing**
|
|
394
|
+
|
|
395
|
+
1. Fork the repository
|
|
396
|
+
2. Create a feature branch
|
|
397
|
+
3. Make your changes
|
|
398
|
+
4. Add tests
|
|
399
|
+
5. Run the test suite
|
|
400
|
+
6. Submit a pull request
|
|
401
|
+
|
|
402
|
+
## ๐ **License**
|
|
403
|
+
|
|
404
|
+
MIT License - see LICENSE file for details.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
*Built with โค๏ธ by eXonware.com - Making universal data querying effortless*
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## ๐ **Part of the exonware Ecosystem**
|
|
413
|
+
|
|
414
|
+
- **[xwsystem](https://github.com/exonware/xwsystem)** - Core system utilities
|
|
415
|
+
- **[xwnode](https://github.com/exonware/xwnode)** - Node-based data structures
|
|
416
|
+
- **[xwquery](https://github.com/exonware/xwquery)** - Universal query language โญ You are here
|
|
417
|
+
- **[xwdata](https://github.com/exonware/xwdata)** - Format-agnostic data manipulation
|
|
418
|
+
- **[xwschema](https://github.com/exonware/xwschema)** - Schema validation
|
|
419
|
+
- **[xwaction](https://github.com/exonware/xwaction)** - Action definitions
|
|
420
|
+
- **[xwentity](https://github.com/exonware/xwentity)** - Entity management
|
|
421
|
+
- **[xwstorage](https://github.com/exonware/xwstorage)** - Storage abstraction
|
|
422
|
+
- **[xwbase](https://github.com/exonware/xwbase)** - Firebase-like backend
|
|
423
|
+
|