hydra-pg 0.15.0__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.
Files changed (35) hide show
  1. hydra_pg-0.15.0/.gitignore +99 -0
  2. hydra_pg-0.15.0/PKG-INFO +14 -0
  3. hydra_pg-0.15.0/pyproject.toml +38 -0
  4. hydra_pg-0.15.0/src/main/digest.json +64 -0
  5. hydra_pg-0.15.0/src/main/python/com/gdblab/path_algebra/expressions.py +386 -0
  6. hydra_pg-0.15.0/src/main/python/com/gdblab/path_algebra/syntax.py +289 -0
  7. hydra_pg-0.15.0/src/main/python/hydra/cypher/features.py +703 -0
  8. hydra_pg-0.15.0/src/main/python/hydra/cypher/open_cypher.py +852 -0
  9. hydra_pg-0.15.0/src/main/python/hydra/decode/pg/mapping.py +280 -0
  10. hydra_pg-0.15.0/src/main/python/hydra/decode/pg/model.py +301 -0
  11. hydra_pg-0.15.0/src/main/python/hydra/demos/genpg/transform.py +287 -0
  12. hydra_pg-0.15.0/src/main/python/hydra/encode/pg/mapping.py +33 -0
  13. hydra_pg-0.15.0/src/main/python/hydra/encode/pg/model.py +91 -0
  14. hydra_pg-0.15.0/src/main/python/hydra/error/pg.py +145 -0
  15. hydra_pg-0.15.0/src/main/python/hydra/graphviz/coder.py +307 -0
  16. hydra_pg-0.15.0/src/main/python/hydra/graphviz/dot.py +130 -0
  17. hydra_pg-0.15.0/src/main/python/hydra/graphviz/serde.py +152 -0
  18. hydra_pg-0.15.0/src/main/python/hydra/pg/coder.py +230 -0
  19. hydra_pg-0.15.0/src/main/python/hydra/pg/graphson/coder.py +117 -0
  20. hydra_pg-0.15.0/src/main/python/hydra/pg/graphson/construct.py +73 -0
  21. hydra_pg-0.15.0/src/main/python/hydra/pg/graphson/syntax.py +218 -0
  22. hydra_pg-0.15.0/src/main/python/hydra/pg/graphson/utils.py +96 -0
  23. hydra_pg-0.15.0/src/main/python/hydra/pg/mapping.py +132 -0
  24. hydra_pg-0.15.0/src/main/python/hydra/pg/model.py +199 -0
  25. hydra_pg-0.15.0/src/main/python/hydra/pg/printing.py +58 -0
  26. hydra_pg-0.15.0/src/main/python/hydra/pg/query.py +220 -0
  27. hydra_pg-0.15.0/src/main/python/hydra/pg/rdf/environment.py +27 -0
  28. hydra_pg-0.15.0/src/main/python/hydra/pg/rdf/mappings.py +135 -0
  29. hydra_pg-0.15.0/src/main/python/hydra/pg/terms_to_elements.py +196 -0
  30. hydra_pg-0.15.0/src/main/python/hydra/pg/utils.py +58 -0
  31. hydra_pg-0.15.0/src/main/python/hydra/tinkerpop/features.py +181 -0
  32. hydra_pg-0.15.0/src/main/python/hydra/tinkerpop/gremlin.py +2137 -0
  33. hydra_pg-0.15.0/src/main/python/hydra/tinkerpop/language.py +108 -0
  34. hydra_pg-0.15.0/src/main/python/hydra/validate/pg.py +100 -0
  35. hydra_pg-0.15.0/src/main/python/open_gql/grammar.py +4952 -0
@@ -0,0 +1,99 @@
1
+ # rattler-build output (build artifacts — deeply nested, causes Zed/git to thrash)
2
+ output/
3
+
4
+ # Release verification logs
5
+ verify-logs/
6
+
7
+ # Benchmarking runs
8
+ benchmark/
9
+
10
+ # Bootstrapping demo runs
11
+ bootstrap/
12
+
13
+ # Hydra wiki
14
+ wiki/
15
+
16
+ # Haskell / Stack / Cabal
17
+ .ghcup/
18
+ .stack-work
19
+ dist-newstyle/
20
+ stack.yaml.lock
21
+ *.cabal
22
+
23
+ # Java / Gradle
24
+ .gradle
25
+ gradle.properties
26
+ build
27
+
28
+ # IDEs
29
+ .bsp/
30
+ .idea
31
+ *.iml
32
+ .vscode
33
+
34
+ # Python
35
+ wheels/
36
+ __pycache__/
37
+ *.pyc
38
+ .venv/
39
+ .venv-*/
40
+ .pytest_cache/
41
+ .ruff_cache/
42
+
43
+ # Node
44
+ node_modules/
45
+
46
+ # sbt build artifacts
47
+ project/target/
48
+ /target/
49
+ # heads/scala has no build.sbt — these are orphan sbt scratch dirs
50
+ heads/scala/target/
51
+ heads/scala/project/
52
+
53
+ # Run logs
54
+ runs/
55
+
56
+ # Analysis notebooks and debug scripts
57
+ analysis/
58
+ debug_*.py
59
+ debug_*.hs
60
+ debug_*.clj
61
+
62
+ # Working documents (local only)
63
+ docs/reviews/
64
+ docs/work/
65
+
66
+ # Package distributions.
67
+ # dist/json/ is the source of truth (tracked). dist/haskell/ is tracked
68
+ # through the 0.15 release to support bootstrapping from a fresh clone.
69
+ # All other target-language trees are regenerated from dist/json/ and
70
+ # not checked in.
71
+ dist/clojure/
72
+ dist/common-lisp/
73
+ dist/coq/
74
+ dist/emacs-lisp/
75
+ dist/java/
76
+ dist/python/
77
+ dist/scala/
78
+ dist/scheme/
79
+ dist/wasm/
80
+
81
+ # Test-cache artifacts written by Layer 2.5 testers. Per-target
82
+ # digest.json files (dist/haskell/<pkg>/digest.json,
83
+ # dist/json/<pkg>/digest.json) are tracked — they are the build's
84
+ # source of truth for freshness checks.
85
+ dist/haskell/test-cache.json
86
+
87
+ # Per-package input-hash cache stamps written by assemble-distribution.sh
88
+ # to short-circuit redundant work. Local caches, not part of the build.
89
+ dist/haskell/*/.main-input-hash.txt
90
+ dist/haskell/*/.test-input-hash.txt
91
+
92
+ # Other
93
+ *.log
94
+ *.swp
95
+ .claude
96
+ # Hydra branch plan files (see CLAUDE.md)
97
+ *-plan.md
98
+ # Cross-worktree Claude messages (see CLAUDE.md)
99
+ claude-hydra-messages/
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: hydra-pg
3
+ Version: 0.15.0
4
+ Summary: Property graph support for Hydra: PG model, coders, GraphSON, Cypher, GQL, TinkerPop
5
+ Project-URL: Homepage, https://github.com/CategoricalData/hydra
6
+ Project-URL: Repository, https://github.com/CategoricalData/hydra
7
+ Author-email: Joshua Shinavier <josh@fortytwo.net>
8
+ License: Apache-2.0
9
+ Requires-Python: >=3.12
10
+ Requires-Dist: hydra-kernel==0.15.0
11
+ Requires-Dist: hydra-rdf==0.15.0
12
+ Description-Content-Type: text/markdown
13
+
14
+ Property graph support for Hydra: PG model, coders, GraphSON, Cypher, GQL, TinkerPop
@@ -0,0 +1,38 @@
1
+ # Generated file. Do not edit.
2
+ # Regenerated by bin/lib/generate-python-package-build.py from
3
+ # packages/hydra-pg/package.json and the worktree's VERSION file. Each
4
+ # dist/python/<pkg>/ is a standalone Python distribution: from this directory,
5
+ # `uv build` (or `python -m build`) produces a wheel + sdist, and `pip install`
6
+ # resolves transitive Hydra dependencies declared below.
7
+ #
8
+ # All Hydra wheels participate in the `hydra` namespace via PEP 420 implicit
9
+ # namespace packages: there is no top-level hydra/__init__.py, so multiple
10
+ # wheels can install side-by-side and merge their hydra.* contents at
11
+ # import time. Subpackages (hydra/core/, hydra/rdf/syntax/, etc.) DO have
12
+ # regular __init__.py files; only the namespace root is implicit.
13
+
14
+ [project]
15
+ name = "hydra-pg"
16
+ version = "0.15.0"
17
+ description = "Property graph support for Hydra: PG model, coders, GraphSON, Cypher, GQL, TinkerPop"
18
+ readme = { text = "Property graph support for Hydra: PG model, coders, GraphSON, Cypher, GQL, TinkerPop", content-type = "text/markdown" }
19
+ requires-python = ">=3.12"
20
+ license = { text = "Apache-2.0" }
21
+ authors = [
22
+ { name = "Joshua Shinavier", email = "josh@fortytwo.net" },
23
+ ]
24
+ dependencies = [
25
+ "hydra-kernel == 0.15.0",
26
+ "hydra-rdf == 0.15.0",
27
+ ]
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/CategoricalData/hydra"
31
+ Repository = "https://github.com/CategoricalData/hydra"
32
+
33
+ [build-system]
34
+ requires = ["hatchling"]
35
+ build-backend = "hatchling.build"
36
+
37
+ [tool.hatch.build.targets.wheel]
38
+ packages = ["src/main/python/hydra"]
@@ -0,0 +1,64 @@
1
+ {
2
+ "version": 2,
3
+ "generator": "v0-unstamped",
4
+ "inputs": {
5
+ "com.gdblab.pathAlgebra.expressions": { "kind": "Other", "hash": "cc19fd8b0065ea6ffdf431101ed9040a0bb72e193c110f6e6ea7d5019ced66ef" },
6
+ "com.gdblab.pathAlgebra.syntax": { "kind": "Other", "hash": "d6ff685be0717cf9b68ed596d78b174a46f3d521c44830765df529024a7bdde9" },
7
+ "hydra.cypher.features": { "kind": "Other", "hash": "a7b8b29fe598a31fd754d93f0250ff85c66cf22888e18256643ec02ac7909853" },
8
+ "hydra.cypher.openCypher": { "kind": "Other", "hash": "b496391f47349e251c44ded811ba59cc2272caff66d175161989a5532d45abc2" },
9
+ "hydra.error.pg": { "kind": "Other", "hash": "67688aec530985d296b79d254a99eeac36e129b54db94428292d2cae5f28582a" },
10
+ "hydra.graphviz.coder": { "kind": "Other", "hash": "b6bb0046c9bf5ac72cca47fad1e8205b66b9036d01b0fbab92b44f2726f3147e" },
11
+ "hydra.graphviz.dot": { "kind": "Other", "hash": "c9f1684114d6cc17f990d70ae2bccddd7ff651c29c67777cb132127762cb66d0" },
12
+ "hydra.graphviz.serde": { "kind": "Other", "hash": "a0ab37a15451c82489e2748212e61b3a1e41793e3a48248b60f13910db6e6f8c" },
13
+ "hydra.pg.coder": { "kind": "Other", "hash": "0cde6b51326610c12ccfab0277dc93541c22ebd9bb55616b147743a429300772" },
14
+ "hydra.pg.graphson.coder": { "kind": "Other", "hash": "61c6fae74af1561f56861075035fb38df08608fc1ab1460f9139946c3c219b33" },
15
+ "hydra.pg.graphson.construct": { "kind": "Other", "hash": "986aa90dcc1077393e3768f589692c5b002759c6b90eb25f3abe72e1e606e582" },
16
+ "hydra.pg.graphson.syntax": { "kind": "Other", "hash": "49848c6ea52f0965118736513db8af626428cce19aa3bf07518c1b83fdc0a23f" },
17
+ "hydra.pg.graphson.utils": { "kind": "Other", "hash": "942c5274460dd3692b98dae69f65e405ca2f76b5436dfa3a171888a2c6d336e0" },
18
+ "hydra.pg.mapping": { "kind": "Other", "hash": "0d76cd4528c761a05ec1e7a7e81b8459a2f98c52e73ff1135acdace94982623a" },
19
+ "hydra.pg.model": { "kind": "Other", "hash": "cd64d2b3693a514801028e38990f7f1f0750963ef9d1df4a45b0fbab42f8650b" },
20
+ "hydra.pg.printing": { "kind": "Other", "hash": "d032bf3ebd2ad88631c4b6b22dbbef7a6c01afd4c9ac12a4a0cd726be87e7bb6" },
21
+ "hydra.pg.query": { "kind": "Other", "hash": "d4dce2ec663c80f254bcc6bee6e33459c42b2b0299130bf7bb659becd473fdca" },
22
+ "hydra.pg.rdf.environment": { "kind": "Other", "hash": "d144365177eb66a667fdcc37d12f3e06316566123086f9415ffba836bc6c94ec" },
23
+ "hydra.pg.rdf.mappings": { "kind": "Other", "hash": "b47327d0d679f53d2d4b75f515e992750b17372372559517706c5bb56d582c19" },
24
+ "hydra.pg.termsToElements": { "kind": "Other", "hash": "ff37b4144fad84fe4c80b4c86844b13ace79ab473be116f98f78fee43b6ba351" },
25
+ "hydra.pg.utils": { "kind": "Other", "hash": "549e78a85871a70416b1e5deba02b8395f906bf33c32b59ed0f00595bd63f2bb" },
26
+ "hydra.tinkerpop.features": { "kind": "Other", "hash": "5d746e32d4768f6a21564a261c41145207e3fd53b732537c7c40af1cdddd30a3" },
27
+ "hydra.tinkerpop.gremlin": { "kind": "Other", "hash": "8c58b7f204b532d1d3334ad85aad7f1ef4ee13c9b3f18574098c03df5ca06373" },
28
+ "hydra.tinkerpop.language": { "kind": "Other", "hash": "1752ad9c0977168d01c835c25819aa7b74aa57cbdd080096142f1cad2abe1900" },
29
+ "openGql.grammar": { "kind": "Other", "hash": "35c3b344abe933126eb25e9e0675828b780c6f795587128f13dbfb65e743eb26" }
30
+ },
31
+ "outputs": {
32
+ "com/gdblab/path_algebra/expressions.py": { "kind": "TargetFile", "hash": "99aa924006dd729021e8abfc932d89fbd12979aa68bc94c531368377db44c559" },
33
+ "com/gdblab/path_algebra/syntax.py": { "kind": "TargetFile", "hash": "743209c73644a316a42ca0708cb1a780bc866ee51915432f2c2e9487a3d6f3af" },
34
+ "hydra/cypher/features.py": { "kind": "TargetFile", "hash": "d6f53ca8d49f8784ad3fb9166928876e5589685adb2d9e8e02d823b87e546d24" },
35
+ "hydra/cypher/open_cypher.py": { "kind": "TargetFile", "hash": "6ee7cd2223074483dfea768bb1b573c6a740f9d52f5417b8a01d2f6af11218f0" },
36
+ "hydra/decode/pg/mapping.py": { "kind": "TargetFile", "hash": "741b5c15baa8f0f7feb42ce946d0f1c30084df941ef3a54b08efc0c58098fee6" },
37
+ "hydra/decode/pg/model.py": { "kind": "TargetFile", "hash": "9bc1e4a819a3a77d429a52c27868ee956100599d290d8d8844c0f6f3371258fb" },
38
+ "hydra/demos/genpg/transform.py": { "kind": "TargetFile", "hash": "cdc19f58efd60a4c38ac3e2a41161ad881f52b1008aa99681e29aab3d34752e5" },
39
+ "hydra/encode/pg/mapping.py": { "kind": "TargetFile", "hash": "da59748c52233df908a6bc08403de9ee8d9da94c6e27c21d32ee3bba36762c39" },
40
+ "hydra/encode/pg/model.py": { "kind": "TargetFile", "hash": "943998797ec60e2bd62a73e8add21bcf0b0f4cfa39390810d7a6687f2d3069a1" },
41
+ "hydra/error/pg.py": { "kind": "TargetFile", "hash": "ed355f6226d2b7faed672a0c77e6517a2ca3aee479de1f572b826736dbd03081" },
42
+ "hydra/graphviz/coder.py": { "kind": "TargetFile", "hash": "50d1a68b0cfabb35a2604350f67cf57aa119beee390ca202974362d1b400c532" },
43
+ "hydra/graphviz/dot.py": { "kind": "TargetFile", "hash": "4f0ba63ead99ab6d777acf46457eaf825eacf05f4e889ac2af1b271ede857191" },
44
+ "hydra/graphviz/serde.py": { "kind": "TargetFile", "hash": "7a9c8a601c40a70c714193a738d46f12b8a61c76448d96fb14ba234ddf3196a4" },
45
+ "hydra/pg/coder.py": { "kind": "TargetFile", "hash": "e9689becbee0d84061c49315a3802b525ee6eca6e4cf6d3e932d6ae9c021736e" },
46
+ "hydra/pg/graphson/coder.py": { "kind": "TargetFile", "hash": "c3371fa6a12a87f5bf47e248a8027dea013964b6832cfa88ae6732a5ffa7ed9f" },
47
+ "hydra/pg/graphson/construct.py": { "kind": "TargetFile", "hash": "be01def4296e030d2d274d358c1b2b6dd71e2e69f5c5acb0beb6406b1dd23543" },
48
+ "hydra/pg/graphson/syntax.py": { "kind": "TargetFile", "hash": "6359833f2aecdafb44803c09565bc5f4d29e5d94159c5ce3d1d0a1d1fe90e893" },
49
+ "hydra/pg/graphson/utils.py": { "kind": "TargetFile", "hash": "6e4b7a0bc1f498ed775d171535ae761cd1c63ef1d082e04eecc8440ae71e9fb6" },
50
+ "hydra/pg/mapping.py": { "kind": "TargetFile", "hash": "9e534669eb69fa2a610ef0111c9291186416b269d2b01d47d5b64ceb8dc8020b" },
51
+ "hydra/pg/model.py": { "kind": "TargetFile", "hash": "4b271334e0040f346625a2fceaea6c2511976adfd6efcbb337d056e6de08b7c5" },
52
+ "hydra/pg/printing.py": { "kind": "TargetFile", "hash": "40e1a5582a70cdecd4abefee92955a7866b9b37f46531d7f2da4cac36db556e3" },
53
+ "hydra/pg/query.py": { "kind": "TargetFile", "hash": "627bbb1cb77974959b22893698130a79997f5edc12152462b5c932e2bdc3b3ca" },
54
+ "hydra/pg/rdf/environment.py": { "kind": "TargetFile", "hash": "f4f65c0b9f15da1b8093245ecb5b0501d6e019a13e9065828cd3d8187c3df42c" },
55
+ "hydra/pg/rdf/mappings.py": { "kind": "TargetFile", "hash": "505c44e6d396e367f1d5b3d5b8d6bc8286fa8b72d3879b04a5cc55a803a6a84a" },
56
+ "hydra/pg/terms_to_elements.py": { "kind": "TargetFile", "hash": "1655965973d82c6fee099b8eac343dcf1fa0caa6d009bb6dddd4683f768fa45b" },
57
+ "hydra/pg/utils.py": { "kind": "TargetFile", "hash": "436deb139fdf926edec6b7088145c224ef9ef56c1bfc6431e512ce17616b42b6" },
58
+ "hydra/tinkerpop/features.py": { "kind": "TargetFile", "hash": "aebb1a0d09b3c01c7bd7ea9c5be0aa7f04ad81596477f139f95a56f7ab4f6451" },
59
+ "hydra/tinkerpop/gremlin.py": { "kind": "TargetFile", "hash": "3811add12df8acee9f5e0506ecf4eb1fbd89b623f5b8fed9f7e06f4215a26628" },
60
+ "hydra/tinkerpop/language.py": { "kind": "TargetFile", "hash": "b8186a4582761933189583b9b59e18783816874eec99e1cf2f64f09244149998" },
61
+ "hydra/validate/pg.py": { "kind": "TargetFile", "hash": "9383e2edbece72706242da5ee799f48ee00517b759845b6f5f3c1207ad683744" },
62
+ "open_gql/grammar.py": { "kind": "TargetFile", "hash": "e98b7f3351c82198bf1f0d2e41327264661362dee9f04276925b3a00628ef7fc" }
63
+ }
64
+ }
@@ -0,0 +1,386 @@
1
+ # Note: this is an automatically generated file. Do not edit.
2
+ r"""Algebraic expression trees for the path algebra by Angles et al., extended for GQL support."""
3
+ from __future__ import annotations
4
+ from dataclasses import dataclass
5
+ from enum import Enum
6
+ from functools import lru_cache
7
+ from hydra.dsl.python import Maybe, Node, frozenlist
8
+ from typing import TypeAlias, cast
9
+ import hydra.core
10
+ @dataclass(frozen=True)
11
+ class QueryExpression:
12
+ r"""Complete query with path algebra and result projection."""
13
+ path_expression: PathExpression
14
+ result_projection: Maybe[ResultProjection]
15
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.QueryExpression")
16
+ PATH_EXPRESSION = hydra.core.Name("pathExpression")
17
+ RESULT_PROJECTION = hydra.core.Name("resultProjection")
18
+ class PathExpressionBase(Node["BaseExpression"]):
19
+ r"""Base case: extract paths from graph"""
20
+ class PathExpressionSelection(Node["SelectionExpression"]):
21
+ r"""Selection operator (σ): filter paths by condition"""
22
+ class PathExpressionJoin(Node["JoinExpression"]):
23
+ r"""Join operator (⊲⊳): concatenate compatible paths"""
24
+ class PathExpressionUnion(Node["UnionExpression"]):
25
+ r"""Union operator (∪): combine path sets"""
26
+ class PathExpressionRecursive(Node["RecursiveExpression"]):
27
+ r"""Recursive operator (φ): compute transitive closure with semantics"""
28
+ class PathExpressionGroupBy(Node["GroupByExpression"]):
29
+ r"""Group-by operator (γ): organize paths into solution space"""
30
+ class PathExpressionOrderBy(Node["OrderByExpression"]):
31
+ r"""Order-by operator (τ): sort solution space"""
32
+ class PathExpressionProjection(Node["ProjectionExpression"]):
33
+ r"""Projection operator (π): extract paths from solution space"""
34
+ class _PathExpressionMeta(type):
35
+ def __getitem__(cls, item):
36
+ return object
37
+ # A path algebra expression that evaluates to a set of paths.
38
+ class PathExpression(metaclass=_PathExpressionMeta):
39
+ r"""PathExpressionBase | PathExpressionSelection | PathExpressionJoin | PathExpressionUnion | PathExpressionRecursive | PathExpressionGroupBy | PathExpressionOrderBy | PathExpressionProjection"""
40
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PathExpression")
41
+ BASE = hydra.core.Name("base")
42
+ SELECTION = hydra.core.Name("selection")
43
+ JOIN = hydra.core.Name("join")
44
+ UNION = hydra.core.Name("union")
45
+ RECURSIVE = hydra.core.Name("recursive")
46
+ GROUP_BY = hydra.core.Name("groupBy")
47
+ ORDER_BY = hydra.core.Name("orderBy")
48
+ PROJECTION = hydra.core.Name("projection")
49
+ class BaseExpressionPaths0(Node["GraphReference"]):
50
+ r"""Paths0(G): all paths of length 0 (nodes)"""
51
+ class BaseExpressionPaths1(Node["GraphReference"]):
52
+ r"""Paths1(G): all paths of length 1 (edges)"""
53
+ class BaseExpressionPathsStar(Node["GraphReference"]):
54
+ r"""Paths*(G): all paths in graph (infinite without restrictions)"""
55
+ class _BaseExpressionMeta(type):
56
+ def __getitem__(cls, item):
57
+ return object
58
+ # Base path expressions that extract paths from graph.
59
+ class BaseExpression(metaclass=_BaseExpressionMeta):
60
+ r"""BaseExpressionPaths0 | BaseExpressionPaths1 | BaseExpressionPathsStar"""
61
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.BaseExpression")
62
+ PATHS0 = hydra.core.Name("paths0")
63
+ PATHS1 = hydra.core.Name("paths1")
64
+ PATHS_STAR = hydra.core.Name("pathsStar")
65
+ class GraphReference(Node[str]):
66
+ r"""Reference to a property graph."""
67
+ GraphReference.TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.GraphReference")
68
+ @dataclass(frozen=True)
69
+ class SelectionExpression:
70
+ r"""Selection operator: σ_condition(expression)."""
71
+ condition: SelectionCondition
72
+ expression: PathExpression
73
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.SelectionExpression")
74
+ CONDITION = hydra.core.Name("condition")
75
+ EXPRESSION = hydra.core.Name("expression")
76
+ class SelectionConditionSimple(Node["SimpleCondition"]):
77
+ ...
78
+ class SelectionConditionAnd(Node["AndCondition"]):
79
+ ...
80
+ class SelectionConditionOr(Node["OrCondition"]):
81
+ ...
82
+ class SelectionConditionNot(Node["NotCondition"]):
83
+ ...
84
+ class _SelectionConditionMeta(type):
85
+ def __getitem__(cls, item):
86
+ return object
87
+ # Conditions for filtering paths.
88
+ class SelectionCondition(metaclass=_SelectionConditionMeta):
89
+ r"""SelectionConditionSimple | SelectionConditionAnd | SelectionConditionOr | SelectionConditionNot"""
90
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.SelectionCondition")
91
+ SIMPLE = hydra.core.Name("simple")
92
+ AND = hydra.core.Name("and")
93
+ OR = hydra.core.Name("or")
94
+ NOT = hydra.core.Name("not")
95
+ class SimpleConditionLabelEquals(Node["LabelCondition"]):
96
+ ...
97
+ class SimpleConditionPropertyEquals(Node["PropertyCondition"]):
98
+ ...
99
+ class SimpleConditionPropertyComparison(Node["PropertyComparisonCondition"]):
100
+ ...
101
+ class SimpleConditionLengthEquals(Node["LengthCondition"]):
102
+ ...
103
+ class _SimpleConditionMeta(type):
104
+ def __getitem__(cls, item):
105
+ return object
106
+ # Atomic selection conditions.
107
+ class SimpleCondition(metaclass=_SimpleConditionMeta):
108
+ r"""SimpleConditionLabelEquals | SimpleConditionPropertyEquals | SimpleConditionPropertyComparison | SimpleConditionLengthEquals"""
109
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.SimpleCondition")
110
+ LABEL_EQUALS = hydra.core.Name("labelEquals")
111
+ PROPERTY_EQUALS = hydra.core.Name("propertyEquals")
112
+ PROPERTY_COMPARISON = hydra.core.Name("propertyComparison")
113
+ LENGTH_EQUALS = hydra.core.Name("lengthEquals")
114
+ @dataclass(frozen=True)
115
+ class LabelCondition:
116
+ r"""Conditions on node/edge labels: label(node(i)) = v."""
117
+ target: PathElement
118
+ value: str
119
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.LabelCondition")
120
+ TARGET = hydra.core.Name("target")
121
+ VALUE = hydra.core.Name("value")
122
+ @dataclass(frozen=True)
123
+ class PropertyCondition:
124
+ r"""Property equality conditions: node(i).prop = v."""
125
+ target: PathElement
126
+ property: str
127
+ value: LiteralValue
128
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PropertyCondition")
129
+ TARGET = hydra.core.Name("target")
130
+ PROPERTY = hydra.core.Name("property")
131
+ VALUE = hydra.core.Name("value")
132
+ @dataclass(frozen=True)
133
+ class PropertyComparisonCondition:
134
+ r"""Property comparison conditions: node(i).prop > v, etc."""
135
+ target: PathElement
136
+ property: str
137
+ operator: ComparisonOperator
138
+ value: LiteralValue
139
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PropertyComparisonCondition")
140
+ TARGET = hydra.core.Name("target")
141
+ PROPERTY = hydra.core.Name("property")
142
+ OPERATOR = hydra.core.Name("operator")
143
+ VALUE = hydra.core.Name("value")
144
+ class ComparisonOperator(Enum):
145
+ r"""Comparison operators for property conditions."""
146
+ EQUAL = hydra.core.Name("equal")
147
+ NOT_EQUAL = hydra.core.Name("notEqual")
148
+ LESS_THAN = hydra.core.Name("lessThan")
149
+ LESS_THAN_OR_EQUAL = hydra.core.Name("lessThanOrEqual")
150
+ GREATER_THAN = hydra.core.Name("greaterThan")
151
+ GREATER_THAN_OR_EQUAL = hydra.core.Name("greaterThanOrEqual")
152
+ ComparisonOperator.TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.ComparisonOperator")
153
+ class LiteralValueString(Node[str]):
154
+ ...
155
+ class LiteralValueInteger(Node[int]):
156
+ ...
157
+ class LiteralValueFloat(Node[float]):
158
+ ...
159
+ class LiteralValueBoolean(Node[bool]):
160
+ ...
161
+ class _LiteralValueMeta(type):
162
+ def __getitem__(cls, item):
163
+ return object
164
+ # Literal values for comparisons.
165
+ class LiteralValue(metaclass=_LiteralValueMeta):
166
+ r"""LiteralValueString | LiteralValueInteger | LiteralValueFloat | LiteralValueBoolean"""
167
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.LiteralValue")
168
+ STRING = hydra.core.Name("string")
169
+ INTEGER = hydra.core.Name("integer")
170
+ FLOAT = hydra.core.Name("float")
171
+ BOOLEAN = hydra.core.Name("boolean")
172
+ @dataclass(frozen=True)
173
+ class LengthCondition:
174
+ r"""Condition on path length: len() = i."""
175
+ length: int
176
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.LengthCondition")
177
+ LENGTH = hydra.core.Name("length")
178
+ class PathElementNode(Node[int]):
179
+ ...
180
+ class PathElementEdge(Node[int]):
181
+ ...
182
+ class PathElementFirst:
183
+ __slots__ = ()
184
+ def __eq__(self, other):
185
+ return isinstance(other, PathElementFirst)
186
+ def __hash__(self):
187
+ return hash("PathElementFirst")
188
+ class PathElementLast:
189
+ __slots__ = ()
190
+ def __eq__(self, other):
191
+ return isinstance(other, PathElementLast)
192
+ def __hash__(self):
193
+ return hash("PathElementLast")
194
+ class _PathElementMeta(type):
195
+ def __getitem__(cls, item):
196
+ return object
197
+ # References to elements within a path.
198
+ class PathElement(metaclass=_PathElementMeta):
199
+ r"""PathElementNode | PathElementEdge | PathElementFirst | PathElementLast"""
200
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PathElement")
201
+ NODE = hydra.core.Name("node")
202
+ EDGE = hydra.core.Name("edge")
203
+ FIRST = hydra.core.Name("first")
204
+ LAST = hydra.core.Name("last")
205
+ @dataclass(frozen=True)
206
+ class AndCondition:
207
+ left: SelectionCondition
208
+ right: SelectionCondition
209
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.AndCondition")
210
+ LEFT = hydra.core.Name("left")
211
+ RIGHT = hydra.core.Name("right")
212
+ @dataclass(frozen=True)
213
+ class OrCondition:
214
+ left: SelectionCondition
215
+ right: SelectionCondition
216
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.OrCondition")
217
+ LEFT = hydra.core.Name("left")
218
+ RIGHT = hydra.core.Name("right")
219
+ @dataclass(frozen=True)
220
+ class NotCondition:
221
+ condition: SelectionCondition
222
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.NotCondition")
223
+ CONDITION = hydra.core.Name("condition")
224
+ @dataclass(frozen=True)
225
+ class JoinExpression:
226
+ r"""Join operator: expr1 ⊲⊳ expr2."""
227
+ left: PathExpression
228
+ right: PathExpression
229
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.JoinExpression")
230
+ LEFT = hydra.core.Name("left")
231
+ RIGHT = hydra.core.Name("right")
232
+ @dataclass(frozen=True)
233
+ class UnionExpression:
234
+ r"""Union operator: expr1 ∪ expr2."""
235
+ left: PathExpression
236
+ right: PathExpression
237
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.UnionExpression")
238
+ LEFT = hydra.core.Name("left")
239
+ RIGHT = hydra.core.Name("right")
240
+ @dataclass(frozen=True)
241
+ class RecursiveExpression:
242
+ r"""Recursive operator with path semantics."""
243
+ semantics: PathSemantics
244
+ expression: PathExpression
245
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.RecursiveExpression")
246
+ SEMANTICS = hydra.core.Name("semantics")
247
+ EXPRESSION = hydra.core.Name("expression")
248
+ class PathSemantics(Enum):
249
+ r"""Path semantics for recursive operations."""
250
+ WALK = hydra.core.Name("walk")
251
+ TRAIL = hydra.core.Name("trail")
252
+ ACYCLIC = hydra.core.Name("acyclic")
253
+ SIMPLE = hydra.core.Name("simple")
254
+ SHORTEST = hydra.core.Name("shortest")
255
+ PathSemantics.TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PathSemantics")
256
+ class SolutionSpaceExpressionGroupBy(Node["GroupByExpression"]):
257
+ ...
258
+ class SolutionSpaceExpressionOrderBy(Node["OrderByExpression"]):
259
+ ...
260
+ class _SolutionSpaceExpressionMeta(type):
261
+ def __getitem__(cls, item):
262
+ return object
263
+ # Expressions that work with solution spaces.
264
+ class SolutionSpaceExpression(metaclass=_SolutionSpaceExpressionMeta):
265
+ r"""SolutionSpaceExpressionGroupBy | SolutionSpaceExpressionOrderBy"""
266
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.SolutionSpaceExpression")
267
+ GROUP_BY = hydra.core.Name("groupBy")
268
+ ORDER_BY = hydra.core.Name("orderBy")
269
+ @dataclass(frozen=True)
270
+ class GroupByExpression:
271
+ r"""Group-by operator: γ_criterion(expression)."""
272
+ criterion: GroupByCriterion
273
+ expression: PathExpression
274
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.GroupByExpression")
275
+ CRITERION = hydra.core.Name("criterion")
276
+ EXPRESSION = hydra.core.Name("expression")
277
+ class GroupByCriterion(Enum):
278
+ r"""Grouping criteria corresponding to paper's γ variants."""
279
+ NONE = hydra.core.Name("none")
280
+ SOURCE = hydra.core.Name("source")
281
+ TARGET = hydra.core.Name("target")
282
+ LENGTH = hydra.core.Name("length")
283
+ SOURCE_TARGET = hydra.core.Name("sourceTarget")
284
+ SOURCE_LENGTH = hydra.core.Name("sourceLength")
285
+ TARGET_LENGTH = hydra.core.Name("targetLength")
286
+ SOURCE_TARGET_LENGTH = hydra.core.Name("sourceTargetLength")
287
+ GroupByCriterion.TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.GroupByCriterion")
288
+ @dataclass(frozen=True)
289
+ class OrderByExpression:
290
+ r"""Order-by operator: τ_criterion(solutionSpace)."""
291
+ criterion: OrderByCriterion
292
+ expression: SolutionSpaceExpression
293
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.OrderByExpression")
294
+ CRITERION = hydra.core.Name("criterion")
295
+ EXPRESSION = hydra.core.Name("expression")
296
+ class OrderByCriterion(Enum):
297
+ r"""Ordering criteria corresponding to paper's τ variants."""
298
+ PARTITION = hydra.core.Name("partition")
299
+ GROUP = hydra.core.Name("group")
300
+ PATH = hydra.core.Name("path")
301
+ PARTITION_GROUP = hydra.core.Name("partitionGroup")
302
+ PARTITION_PATH = hydra.core.Name("partitionPath")
303
+ GROUP_PATH = hydra.core.Name("groupPath")
304
+ PARTITION_GROUP_PATH = hydra.core.Name("partitionGroupPath")
305
+ OrderByCriterion.TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.OrderByCriterion")
306
+ @dataclass(frozen=True)
307
+ class ProjectionExpression:
308
+ r"""Projection operator: π_(#P,#G,#A)(solutionSpace)."""
309
+ partitions: ProjectionSpec
310
+ groups: ProjectionSpec
311
+ paths: ProjectionSpec
312
+ expression: SolutionSpaceExpression
313
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.ProjectionExpression")
314
+ PARTITIONS = hydra.core.Name("partitions")
315
+ GROUPS = hydra.core.Name("groups")
316
+ PATHS = hydra.core.Name("paths")
317
+ EXPRESSION = hydra.core.Name("expression")
318
+ class ProjectionSpecAll:
319
+ __slots__ = ()
320
+ def __eq__(self, other):
321
+ return isinstance(other, ProjectionSpecAll)
322
+ def __hash__(self):
323
+ return hash("ProjectionSpecAll")
324
+ class ProjectionSpecLimited(Node[int]):
325
+ ...
326
+ class _ProjectionSpecMeta(type):
327
+ def __getitem__(cls, item):
328
+ return object
329
+ # Projection specification: * or specific number.
330
+ class ProjectionSpec(metaclass=_ProjectionSpecMeta):
331
+ r"""ProjectionSpecAll | ProjectionSpecLimited"""
332
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.ProjectionSpec")
333
+ ALL = hydra.core.Name("all")
334
+ LIMITED = hydra.core.Name("limited")
335
+ @dataclass(frozen=True)
336
+ class ResultProjection:
337
+ r"""Extract specific values from paths for RETURN clause."""
338
+ projections: frozenlist[PropertyExtraction]
339
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.ResultProjection")
340
+ PROJECTIONS = hydra.core.Name("projections")
341
+ @dataclass(frozen=True)
342
+ class PropertyExtraction:
343
+ r"""Extract properties from path elements."""
344
+ alias: Maybe[str]
345
+ source: PropertySource
346
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PropertyExtraction")
347
+ ALIAS = hydra.core.Name("alias")
348
+ SOURCE = hydra.core.Name("source")
349
+ class PropertySourceNodeProperty(Node["NodePropertyRef"]):
350
+ ...
351
+ class PropertySourceEdgeProperty(Node["EdgePropertyRef"]):
352
+ ...
353
+ class PropertySourcePathProperty(Node["PathPropertyRef"]):
354
+ ...
355
+ class _PropertySourceMeta(type):
356
+ def __getitem__(cls, item):
357
+ return object
358
+ # Source of a property value.
359
+ class PropertySource(metaclass=_PropertySourceMeta):
360
+ r"""PropertySourceNodeProperty | PropertySourceEdgeProperty | PropertySourcePathProperty"""
361
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PropertySource")
362
+ NODE_PROPERTY = hydra.core.Name("nodeProperty")
363
+ EDGE_PROPERTY = hydra.core.Name("edgeProperty")
364
+ PATH_PROPERTY = hydra.core.Name("pathProperty")
365
+ @dataclass(frozen=True)
366
+ class NodePropertyRef:
367
+ r"""Reference to a node property: node.property."""
368
+ element: PathElement
369
+ property: str
370
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.NodePropertyRef")
371
+ ELEMENT = hydra.core.Name("element")
372
+ PROPERTY = hydra.core.Name("property")
373
+ @dataclass(frozen=True)
374
+ class EdgePropertyRef:
375
+ r"""Reference to an edge property: edge.property."""
376
+ element: PathElement
377
+ property: str
378
+ TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.EdgePropertyRef")
379
+ ELEMENT = hydra.core.Name("element")
380
+ PROPERTY = hydra.core.Name("property")
381
+ class PathPropertyRef(Enum):
382
+ r"""Reference to path-level properties: length, etc."""
383
+ LENGTH = hydra.core.Name("length")
384
+ START_NODE = hydra.core.Name("startNode")
385
+ END_NODE = hydra.core.Name("endNode")
386
+ PathPropertyRef.TYPE_ = hydra.core.Name("com.gdblab.pathAlgebra.expressions.PathPropertyRef")