drivine 0.1.0__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.
- drivine/__init__.py +244 -0
- drivine/annotation/__init__.py +0 -0
- drivine/annotation/aggregate.py +25 -0
- drivine/annotation/aggregate_function.py +9 -0
- drivine/annotation/direction.py +7 -0
- drivine/annotation/empty_when_absent.py +8 -0
- drivine/annotation/full_text_index.py +11 -0
- drivine/annotation/graph_path.py +21 -0
- drivine/annotation/graph_property.py +11 -0
- drivine/annotation/hop.py +29 -0
- drivine/annotation/json_packed.py +9 -0
- drivine/annotation/node_id.py +9 -0
- drivine/annotation/node_labels.py +25 -0
- drivine/annotation/node_stamp.py +10 -0
- drivine/annotation/null_as_default.py +9 -0
- drivine/annotation/property_bag.py +16 -0
- drivine/annotation/range_index.py +14 -0
- drivine/annotation/read_only.py +9 -0
- drivine/annotation/relationship.py +21 -0
- drivine/annotation/root.py +8 -0
- drivine/annotation/sorted_by.py +12 -0
- drivine/annotation/target_node.py +9 -0
- drivine/annotation/transient.py +8 -0
- drivine/annotation/unique.py +11 -0
- drivine/annotation/vector_index.py +17 -0
- drivine/backend/__init__.py +0 -0
- drivine/backend/backends.py +16 -0
- drivine/backend/cascade_targets.py +64 -0
- drivine/backend/cypher.py +31 -0
- drivine/backend/cypher_backend.py +414 -0
- drivine/backend/cypher_grammar.py +211 -0
- drivine/backend/cypher_stamps.py +49 -0
- drivine/backend/edge_statements.py +130 -0
- drivine/backend/fragment_batch_statement.py +71 -0
- drivine/backend/fragment_group.py +14 -0
- drivine/backend/graph_backend.py +149 -0
- drivine/backend/graph_statement.py +20 -0
- drivine/backend/group_statement.py +171 -0
- drivine/backend/matched_node.py +16 -0
- drivine/backend/matching_search.py +21 -0
- drivine/backend/nearest_search.py +26 -0
- drivine/backend/oracle/__init__.py +0 -0
- drivine/backend/oracle/oracle_backend.py +389 -0
- drivine/backend/oracle/oracle_graph.py +187 -0
- drivine/backend/oracle/oracle_groups.py +137 -0
- drivine/backend/oracle/oracle_json.py +38 -0
- drivine/backend/oracle/oracle_nodes_of.py +11 -0
- drivine/backend/oracle/oracle_query_renderer.py +401 -0
- drivine/backend/oracle/oracle_save_builder.py +600 -0
- drivine/backend/oracle/oracle_schema_grammar.py +265 -0
- drivine/backend/oracle/oracle_search.py +132 -0
- drivine/backend/oracle/oracle_side_table.py +94 -0
- drivine/backend/oracle/oracle_step.py +16 -0
- drivine/backend/oracle/oracle_views.py +308 -0
- drivine/backend/oracle/oracle_writes.py +299 -0
- drivine/backend/oracle/text_query.py +252 -0
- drivine/backend/page.py +12 -0
- drivine/backend/patch_statements.py +78 -0
- drivine/backend/save_statement.py +37 -0
- drivine/backend/save_statement_builder.py +686 -0
- drivine/backend/vector_writes.py +45 -0
- drivine/backend/view_projection.py +13 -0
- drivine/backend/view_projector.py +312 -0
- drivine/concurrency.py +29 -0
- drivine/connection/__init__.py +0 -0
- drivine/connection/auto_commit_transactions.py +37 -0
- drivine/connection/connection.py +38 -0
- drivine/connection/connection_properties.py +95 -0
- drivine/connection/connection_provider.py +28 -0
- drivine/connection/connection_provider_builder.py +198 -0
- drivine/connection/database_registry.py +64 -0
- drivine/connection/database_type.py +10 -0
- drivine/connection/falkordb/__init__.py +0 -0
- drivine/connection/falkordb/falkordb_connection.py +61 -0
- drivine/connection/falkordb/falkordb_connection_provider.py +73 -0
- drivine/connection/falkordb/falkordb_cursor.py +38 -0
- drivine/connection/falkordb/falkordb_parameter_coercer.py +67 -0
- drivine/connection/falkordb/falkordb_result_mapper.py +31 -0
- drivine/connection/falkordb/falkordb_spec_compiler.py +37 -0
- drivine/connection/neo4j/__init__.py +0 -0
- drivine/connection/neo4j/neo4j_connection.py +74 -0
- drivine/connection/neo4j/neo4j_connection_provider.py +92 -0
- drivine/connection/neo4j/neo4j_cursor.py +32 -0
- drivine/connection/neo4j/neo4j_result_mapper.py +36 -0
- drivine/connection/neo4j/neo4j_spec_compiler.py +28 -0
- drivine/connection/oracle/__init__.py +0 -0
- drivine/connection/oracle/oracle_connection.py +114 -0
- drivine/connection/oracle/oracle_connection_provider.py +88 -0
- drivine/connection/oracle/oracle_cursor.py +30 -0
- drivine/connection/oracle/oracle_result_mapper.py +49 -0
- drivine/connection/oracle/oracle_spec_compiler.py +67 -0
- drivine/connection/transaction_mode.py +20 -0
- drivine/cursor/__init__.py +0 -0
- drivine/cursor/buffered_cursor.py +38 -0
- drivine/cursor/cursor.py +38 -0
- drivine/cursor/cursor_specification.py +24 -0
- drivine/drivine_assembly.py +118 -0
- drivine/drivine_error.py +27 -0
- drivine/dsl/__init__.py +0 -0
- drivine/dsl/any_label_test.py +10 -0
- drivine/dsl/bag_refs.py +9 -0
- drivine/dsl/case_branch.py +14 -0
- drivine/dsl/case_condition.py +32 -0
- drivine/dsl/collection_sort.py +17 -0
- drivine/dsl/collection_sorts.py +72 -0
- drivine/dsl/comparable_ref.py +20 -0
- drivine/dsl/compare_test.py +14 -0
- drivine/dsl/composite_condition.py +13 -0
- drivine/dsl/condition.py +53 -0
- drivine/dsl/condition_node.py +23 -0
- drivine/dsl/condition_writer.py +14 -0
- drivine/dsl/expression.py +19 -0
- drivine/dsl/expression_node.py +26 -0
- drivine/dsl/index_advice_policy.py +18 -0
- drivine/dsl/instance_of_test.py +10 -0
- drivine/dsl/list_ref.py +17 -0
- drivine/dsl/model_scope.py +81 -0
- drivine/dsl/node_tests.py +37 -0
- drivine/dsl/operator.py +22 -0
- drivine/dsl/order_expressions.py +132 -0
- drivine/dsl/order_term.py +29 -0
- drivine/dsl/path_condition.py +15 -0
- drivine/dsl/quantify_test.py +15 -0
- drivine/dsl/query.py +26 -0
- drivine/dsl/query_index_advisor.py +114 -0
- drivine/dsl/query_renderer.py +428 -0
- drivine/dsl/ref.py +189 -0
- drivine/dsl/rendered_query.py +33 -0
- drivine/dsl/root_key.py +13 -0
- drivine/dsl/scope.py +18 -0
- drivine/dsl/seek_value.py +12 -0
- drivine/dsl/step.py +23 -0
- drivine/dsl/string_ref.py +24 -0
- drivine/dsl/value_ref.py +37 -0
- drivine/logger.py +42 -0
- drivine/manager/__init__.py +0 -0
- drivine/manager/cascade_type.py +16 -0
- drivine/manager/contention.py +50 -0
- drivine/manager/delegating_persistence_manager.py +37 -0
- drivine/manager/edge_operations.py +77 -0
- drivine/manager/graph_object_manager_factory.py +33 -0
- drivine/manager/group_aggregate.py +13 -0
- drivine/manager/group_operations.py +102 -0
- drivine/manager/group_query.py +30 -0
- drivine/manager/groups.py +50 -0
- drivine/manager/node_ref.py +18 -0
- drivine/manager/non_atomic_batch_error.py +17 -0
- drivine/manager/non_transactional_persistence_manager.py +77 -0
- drivine/manager/null_policy.py +17 -0
- drivine/manager/patch_result.py +13 -0
- drivine/manager/path_key.py +14 -0
- drivine/manager/persistence_manager.py +51 -0
- drivine/manager/persistence_manager_factory.py +38 -0
- drivine/manager/persistence_manager_type.py +5 -0
- drivine/manager/property_key.py +11 -0
- drivine/manager/relate_mode.py +8 -0
- drivine/manager/removed_targets.py +17 -0
- drivine/manager/save_options.py +33 -0
- drivine/manager/scored.py +14 -0
- drivine/manager/stale_object_error.py +33 -0
- drivine/manager/stateless_graph_object_manager.py +923 -0
- drivine/manager/transactional_persistence_manager.py +40 -0
- drivine/mapper/__init__.py +0 -0
- drivine/mapper/filter_post_processor.py +12 -0
- drivine/mapper/graph_object_mapper.py +154 -0
- drivine/mapper/graph_result_mapper.py +39 -0
- drivine/mapper/map_post_processor.py +12 -0
- drivine/mapper/result_post_processor.py +7 -0
- drivine/mapper/transform_post_processor.py +24 -0
- drivine/model/__init__.py +0 -0
- drivine/model/aggregate_model.py +20 -0
- drivine/model/field_mapping.py +27 -0
- drivine/model/field_shape.py +53 -0
- drivine/model/fragment_model.py +36 -0
- drivine/model/graph_view.py +26 -0
- drivine/model/graph_view_model.py +26 -0
- drivine/model/model_registry.py +590 -0
- drivine/model/node_fragment.py +47 -0
- drivine/model/node_labels_model.py +14 -0
- drivine/model/path_model.py +33 -0
- drivine/model/property_bag_model.py +11 -0
- drivine/model/property_names.py +19 -0
- drivine/model/relationship_fragment.py +26 -0
- drivine/model/relationship_fragment_model.py +23 -0
- drivine/model/relationship_model.py +48 -0
- drivine/model/schema_declaration.py +18 -0
- drivine/model/stamps.py +82 -0
- drivine/model/target_model.py +13 -0
- drivine/model/vector_field.py +12 -0
- drivine/py.typed +0 -0
- drivine/query/__init__.py +0 -0
- drivine/query/compiled_query.py +14 -0
- drivine/query/query_specification.py +106 -0
- drivine/query/query_specification_compiler.py +35 -0
- drivine/query/statement.py +51 -0
- drivine/schema/__init__.py +0 -0
- drivine/schema/constraint_manager.py +74 -0
- drivine/schema/engine_vector_options.py +18 -0
- drivine/schema/ensure_result.py +27 -0
- drivine/schema/full_text_index_spec.py +13 -0
- drivine/schema/index_manager.py +180 -0
- drivine/schema/native_operation.py +13 -0
- drivine/schema/range_index_spec.py +13 -0
- drivine/schema/schema_catalog.py +103 -0
- drivine/schema/schema_executor.py +65 -0
- drivine/schema/schema_grammar.py +364 -0
- drivine/schema/schema_item.py +20 -0
- drivine/schema/schema_listing.py +15 -0
- drivine/schema/schema_manager.py +233 -0
- drivine/schema/schema_options.py +21 -0
- drivine/schema/schema_specs.py +68 -0
- drivine/schema/uniqueness_constraint_spec.py +13 -0
- drivine/schema/vector_index_spec.py +43 -0
- drivine/schema/vector_tuning.py +13 -0
- drivine/store/__init__.py +0 -0
- drivine/store/store_identity.py +22 -0
- drivine/store/store_identity_resolver.py +105 -0
- drivine/stubs/__init__.py +0 -0
- drivine/stubs/__main__.py +55 -0
- drivine/stubs/stub_writer.py +249 -0
- drivine/sync/__init__.py +246 -0
- drivine/sync/concurrency.py +30 -0
- drivine/sync/connection/__init__.py +0 -0
- drivine/sync/connection/connection.py +40 -0
- drivine/sync/connection/connection_provider.py +30 -0
- drivine/sync/connection/connection_provider_builder.py +200 -0
- drivine/sync/connection/database_registry.py +66 -0
- drivine/sync/connection/falkordb/__init__.py +0 -0
- drivine/sync/connection/falkordb/falkordb_connection.py +63 -0
- drivine/sync/connection/falkordb/falkordb_connection_provider.py +75 -0
- drivine/sync/connection/falkordb/falkordb_cursor.py +40 -0
- drivine/sync/connection/neo4j/__init__.py +0 -0
- drivine/sync/connection/neo4j/neo4j_connection.py +76 -0
- drivine/sync/connection/neo4j/neo4j_connection_provider.py +94 -0
- drivine/sync/connection/neo4j/neo4j_cursor.py +34 -0
- drivine/sync/connection/oracle/__init__.py +0 -0
- drivine/sync/connection/oracle/oracle_connection.py +116 -0
- drivine/sync/connection/oracle/oracle_connection_provider.py +90 -0
- drivine/sync/connection/oracle/oracle_cursor.py +32 -0
- drivine/sync/cursor/__init__.py +0 -0
- drivine/sync/cursor/buffered_cursor.py +40 -0
- drivine/sync/cursor/cursor.py +40 -0
- drivine/sync/drivine_assembly.py +120 -0
- drivine/sync/dsl/__init__.py +0 -0
- drivine/sync/dsl/query_index_advisor.py +116 -0
- drivine/sync/manager/__init__.py +0 -0
- drivine/sync/manager/contention.py +52 -0
- drivine/sync/manager/delegating_persistence_manager.py +39 -0
- drivine/sync/manager/edge_operations.py +79 -0
- drivine/sync/manager/graph_object_manager_factory.py +35 -0
- drivine/sync/manager/group_operations.py +104 -0
- drivine/sync/manager/non_transactional_persistence_manager.py +79 -0
- drivine/sync/manager/persistence_manager.py +53 -0
- drivine/sync/manager/persistence_manager_factory.py +40 -0
- drivine/sync/manager/stateless_graph_object_manager.py +915 -0
- drivine/sync/manager/transactional_persistence_manager.py +42 -0
- drivine/sync/schema/__init__.py +0 -0
- drivine/sync/schema/constraint_manager.py +74 -0
- drivine/sync/schema/index_manager.py +182 -0
- drivine/sync/schema/schema_executor.py +67 -0
- drivine/sync/schema/schema_manager.py +235 -0
- drivine/sync/schema/schema_options.py +23 -0
- drivine/sync/store/__init__.py +0 -0
- drivine/sync/store/store_identity_resolver.py +107 -0
- drivine/sync/transaction/__init__.py +0 -0
- drivine/sync/transaction/transaction.py +218 -0
- drivine/sync/transaction/transactional.py +123 -0
- drivine/testing/__init__.py +0 -0
- drivine/testing/container_connection.py +14 -0
- drivine/testing/drivine_test_containers.py +199 -0
- drivine/testing/plugin.py +32 -0
- drivine/testing/test_container_spec.py +22 -0
- drivine/transaction/__init__.py +0 -0
- drivine/transaction/transaction.py +216 -0
- drivine/transaction/transaction_rolled_back_error.py +11 -0
- drivine/transaction/transactional.py +121 -0
- drivine/utils/__init__.py +0 -0
- drivine/utils/short_id.py +8 -0
- drivine-0.1.0.dist-info/METADATA +644 -0
- drivine-0.1.0.dist-info/RECORD +283 -0
- drivine-0.1.0.dist-info/WHEEL +4 -0
- drivine-0.1.0.dist-info/entry_points.txt +2 -0
- drivine-0.1.0.dist-info/licenses/LICENSE +201 -0
drivine/__init__.py
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Drivine: a graph database client for Python. https://drivine.org
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from drivine.annotation.aggregate import Aggregate, Count
|
|
6
|
+
from drivine.annotation.aggregate_function import AggregateFunction
|
|
7
|
+
from drivine.annotation.direction import Direction
|
|
8
|
+
from drivine.annotation.empty_when_absent import EmptyWhenAbsent
|
|
9
|
+
from drivine.annotation.full_text_index import FullTextIndex
|
|
10
|
+
from drivine.annotation.graph_path import GraphPath
|
|
11
|
+
from drivine.annotation.graph_property import GraphProperty
|
|
12
|
+
from drivine.annotation.hop import Hop, hop
|
|
13
|
+
from drivine.annotation.json_packed import JsonPacked
|
|
14
|
+
from drivine.annotation.node_id import NodeId
|
|
15
|
+
from drivine.annotation.node_labels import NodeLabels
|
|
16
|
+
from drivine.annotation.node_stamp import NodeStamp
|
|
17
|
+
from drivine.annotation.null_as_default import NullAsDefault
|
|
18
|
+
from drivine.annotation.property_bag import PropertyBag
|
|
19
|
+
from drivine.annotation.range_index import RangeIndex
|
|
20
|
+
from drivine.annotation.read_only import ReadOnly
|
|
21
|
+
from drivine.annotation.relationship import Relationship
|
|
22
|
+
from drivine.annotation.root import Root
|
|
23
|
+
from drivine.annotation.sorted_by import SortedBy
|
|
24
|
+
from drivine.annotation.target_node import TargetNode
|
|
25
|
+
from drivine.annotation.transient import Transient
|
|
26
|
+
from drivine.annotation.unique import Unique
|
|
27
|
+
from drivine.annotation.vector_index import VectorIndex
|
|
28
|
+
from drivine.connection.connection import Connection
|
|
29
|
+
from drivine.connection.connection_properties import ConnectionProperties
|
|
30
|
+
from drivine.connection.connection_provider import ConnectionProvider
|
|
31
|
+
from drivine.connection.connection_provider_builder import ConnectionProviderBuilder
|
|
32
|
+
from drivine.connection.database_registry import DatabaseRegistry
|
|
33
|
+
from drivine.connection.database_type import DatabaseType
|
|
34
|
+
from drivine.connection.transaction_mode import TransactionMode
|
|
35
|
+
from drivine.cursor.cursor import Cursor
|
|
36
|
+
from drivine.cursor.cursor_specification import CursorSpecification
|
|
37
|
+
from drivine.drivine_error import DrivineError
|
|
38
|
+
from drivine.dsl.bag_refs import BagRefs
|
|
39
|
+
from drivine.dsl.comparable_ref import ComparableRef
|
|
40
|
+
from drivine.dsl.condition import Condition, Where, all_of, any_of, not_
|
|
41
|
+
from drivine.dsl.index_advice_policy import IndexAdvicePolicy
|
|
42
|
+
from drivine.dsl.list_ref import ListRef
|
|
43
|
+
from drivine.dsl.node_tests import NodeTests
|
|
44
|
+
from drivine.dsl.order_expressions import (
|
|
45
|
+
above,
|
|
46
|
+
at_least,
|
|
47
|
+
at_most,
|
|
48
|
+
below,
|
|
49
|
+
case_of,
|
|
50
|
+
coalesce,
|
|
51
|
+
div,
|
|
52
|
+
epoch_seconds,
|
|
53
|
+
equal_to,
|
|
54
|
+
exp,
|
|
55
|
+
floor,
|
|
56
|
+
has_no_value,
|
|
57
|
+
has_value,
|
|
58
|
+
minus,
|
|
59
|
+
negate,
|
|
60
|
+
not_equal_to,
|
|
61
|
+
param,
|
|
62
|
+
plus,
|
|
63
|
+
times,
|
|
64
|
+
)
|
|
65
|
+
from drivine.dsl.order_term import OrderTerm
|
|
66
|
+
from drivine.dsl.query_index_advisor import QueryIndexAdvisor
|
|
67
|
+
from drivine.dsl.ref import Ref, refs
|
|
68
|
+
from drivine.dsl.seek_value import SeekValue
|
|
69
|
+
from drivine.dsl.string_ref import StringRef
|
|
70
|
+
from drivine.dsl.value_ref import ValueRef
|
|
71
|
+
from drivine.manager.cascade_type import CascadeType
|
|
72
|
+
from drivine.manager.delegating_persistence_manager import DelegatingPersistenceManager
|
|
73
|
+
from drivine.manager.edge_operations import EdgeOperations
|
|
74
|
+
from drivine.manager.graph_object_manager_factory import GraphObjectManagerFactory
|
|
75
|
+
from drivine.manager.group_aggregate import GroupAggregate
|
|
76
|
+
from drivine.manager.group_operations import GroupOperations
|
|
77
|
+
from drivine.manager.groups import avg, count, key, max_, min_, path_key, sum_
|
|
78
|
+
from drivine.manager.node_ref import NodeRef, node_ref
|
|
79
|
+
from drivine.manager.non_transactional_persistence_manager import NonTransactionalPersistenceManager
|
|
80
|
+
from drivine.manager.null_policy import NullPolicy
|
|
81
|
+
from drivine.manager.patch_result import PatchResult
|
|
82
|
+
from drivine.manager.path_key import PathKey
|
|
83
|
+
from drivine.manager.persistence_manager import PersistenceManager
|
|
84
|
+
from drivine.manager.persistence_manager_factory import PersistenceManagerFactory
|
|
85
|
+
from drivine.manager.property_key import PropertyKey
|
|
86
|
+
from drivine.manager.relate_mode import RelateMode
|
|
87
|
+
from drivine.manager.removed_targets import RemovedTargets
|
|
88
|
+
from drivine.manager.save_options import SaveOptions
|
|
89
|
+
from drivine.manager.scored import Scored
|
|
90
|
+
from drivine.manager.stale_object_error import StaleObjectError
|
|
91
|
+
from drivine.manager.stateless_graph_object_manager import StatelessGraphObjectManager
|
|
92
|
+
from drivine.manager.transactional_persistence_manager import TransactionalPersistenceManager
|
|
93
|
+
from drivine.model import stamps
|
|
94
|
+
from drivine.model.graph_view import GraphView
|
|
95
|
+
from drivine.model.model_registry import ModelRegistry
|
|
96
|
+
from drivine.model.node_fragment import NodeFragment
|
|
97
|
+
from drivine.model.property_names import PropertyNames
|
|
98
|
+
from drivine.model.relationship_fragment import RelationshipFragment
|
|
99
|
+
from drivine.query.query_specification import QuerySpecification
|
|
100
|
+
from drivine.query.statement import Statement, cypher_file, cypher_statement, sql_file, sql_statement
|
|
101
|
+
from drivine.schema.constraint_manager import ConstraintManager
|
|
102
|
+
from drivine.schema.engine_vector_options import EngineVectorOptions
|
|
103
|
+
from drivine.schema.ensure_result import EnsureResult
|
|
104
|
+
from drivine.schema.index_manager import IndexManager
|
|
105
|
+
from drivine.schema.schema_catalog import SchemaCatalog
|
|
106
|
+
from drivine.schema.schema_manager import SchemaManager
|
|
107
|
+
from drivine.schema.schema_options import SchemaOptions
|
|
108
|
+
from drivine.schema.schema_specs import full_text_index, range_index, uniqueness_constraint, vector_index
|
|
109
|
+
from drivine.store.store_identity import StoreIdentity
|
|
110
|
+
from drivine.transaction.transaction import Transaction, current_transaction
|
|
111
|
+
from drivine.transaction.transaction_rolled_back_error import TransactionRolledBackError
|
|
112
|
+
from drivine.transaction.transactional import transaction, transactional
|
|
113
|
+
|
|
114
|
+
__all__ = [
|
|
115
|
+
"above",
|
|
116
|
+
"Aggregate",
|
|
117
|
+
"AggregateFunction",
|
|
118
|
+
"all_of",
|
|
119
|
+
"any_of",
|
|
120
|
+
"at_least",
|
|
121
|
+
"at_most",
|
|
122
|
+
"avg",
|
|
123
|
+
"BagRefs",
|
|
124
|
+
"below",
|
|
125
|
+
"CascadeType",
|
|
126
|
+
"case_of",
|
|
127
|
+
"coalesce",
|
|
128
|
+
"ComparableRef",
|
|
129
|
+
"Condition",
|
|
130
|
+
"Connection",
|
|
131
|
+
"ConnectionProperties",
|
|
132
|
+
"ConnectionProvider",
|
|
133
|
+
"ConnectionProviderBuilder",
|
|
134
|
+
"ConstraintManager",
|
|
135
|
+
"Count",
|
|
136
|
+
"count",
|
|
137
|
+
"current_transaction",
|
|
138
|
+
"Cursor",
|
|
139
|
+
"CursorSpecification",
|
|
140
|
+
"cypher_file",
|
|
141
|
+
"cypher_statement",
|
|
142
|
+
"DatabaseRegistry",
|
|
143
|
+
"DatabaseType",
|
|
144
|
+
"DelegatingPersistenceManager",
|
|
145
|
+
"Direction",
|
|
146
|
+
"div",
|
|
147
|
+
"DrivineError",
|
|
148
|
+
"EdgeOperations",
|
|
149
|
+
"EmptyWhenAbsent",
|
|
150
|
+
"EngineVectorOptions",
|
|
151
|
+
"EnsureResult",
|
|
152
|
+
"epoch_seconds",
|
|
153
|
+
"equal_to",
|
|
154
|
+
"exp",
|
|
155
|
+
"floor",
|
|
156
|
+
"full_text_index",
|
|
157
|
+
"FullTextIndex",
|
|
158
|
+
"GraphObjectManagerFactory",
|
|
159
|
+
"GraphPath",
|
|
160
|
+
"GraphProperty",
|
|
161
|
+
"GraphView",
|
|
162
|
+
"GroupAggregate",
|
|
163
|
+
"GroupOperations",
|
|
164
|
+
"has_no_value",
|
|
165
|
+
"has_value",
|
|
166
|
+
"Hop",
|
|
167
|
+
"hop",
|
|
168
|
+
"IndexAdvicePolicy",
|
|
169
|
+
"IndexManager",
|
|
170
|
+
"JsonPacked",
|
|
171
|
+
"key",
|
|
172
|
+
"ListRef",
|
|
173
|
+
"max_",
|
|
174
|
+
"min_",
|
|
175
|
+
"minus",
|
|
176
|
+
"ModelRegistry",
|
|
177
|
+
"negate",
|
|
178
|
+
"node_ref",
|
|
179
|
+
"NodeFragment",
|
|
180
|
+
"NodeId",
|
|
181
|
+
"NodeLabels",
|
|
182
|
+
"NodeRef",
|
|
183
|
+
"NodeStamp",
|
|
184
|
+
"NodeTests",
|
|
185
|
+
"NonTransactionalPersistenceManager",
|
|
186
|
+
"not_",
|
|
187
|
+
"not_equal_to",
|
|
188
|
+
"NullAsDefault",
|
|
189
|
+
"NullPolicy",
|
|
190
|
+
"OrderTerm",
|
|
191
|
+
"param",
|
|
192
|
+
"PatchResult",
|
|
193
|
+
"path_key",
|
|
194
|
+
"PathKey",
|
|
195
|
+
"PersistenceManager",
|
|
196
|
+
"PersistenceManagerFactory",
|
|
197
|
+
"plus",
|
|
198
|
+
"PropertyBag",
|
|
199
|
+
"PropertyKey",
|
|
200
|
+
"PropertyNames",
|
|
201
|
+
"QueryIndexAdvisor",
|
|
202
|
+
"QuerySpecification",
|
|
203
|
+
"range_index",
|
|
204
|
+
"RangeIndex",
|
|
205
|
+
"ReadOnly",
|
|
206
|
+
"Ref",
|
|
207
|
+
"refs",
|
|
208
|
+
"RelateMode",
|
|
209
|
+
"Relationship",
|
|
210
|
+
"RelationshipFragment",
|
|
211
|
+
"RemovedTargets",
|
|
212
|
+
"Root",
|
|
213
|
+
"SaveOptions",
|
|
214
|
+
"SchemaCatalog",
|
|
215
|
+
"SchemaManager",
|
|
216
|
+
"SchemaOptions",
|
|
217
|
+
"Scored",
|
|
218
|
+
"SeekValue",
|
|
219
|
+
"SortedBy",
|
|
220
|
+
"sql_file",
|
|
221
|
+
"sql_statement",
|
|
222
|
+
"StaleObjectError",
|
|
223
|
+
"stamps",
|
|
224
|
+
"StatelessGraphObjectManager",
|
|
225
|
+
"Statement",
|
|
226
|
+
"StoreIdentity",
|
|
227
|
+
"StringRef",
|
|
228
|
+
"sum_",
|
|
229
|
+
"TargetNode",
|
|
230
|
+
"times",
|
|
231
|
+
"Transaction",
|
|
232
|
+
"transaction",
|
|
233
|
+
"transactional",
|
|
234
|
+
"TransactionalPersistenceManager",
|
|
235
|
+
"TransactionMode",
|
|
236
|
+
"TransactionRolledBackError",
|
|
237
|
+
"Transient",
|
|
238
|
+
"Unique",
|
|
239
|
+
"uniqueness_constraint",
|
|
240
|
+
"ValueRef",
|
|
241
|
+
"vector_index",
|
|
242
|
+
"VectorIndex",
|
|
243
|
+
"Where",
|
|
244
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from drivine.annotation.aggregate_function import AggregateFunction
|
|
6
|
+
from drivine.annotation.direction import Direction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(frozen=True)
|
|
10
|
+
class Aggregate:
|
|
11
|
+
"""
|
|
12
|
+
A field of a view computed in the query from the nodes one relationship type leads to from the root: their
|
|
13
|
+
number, or the SUM, AVG, MIN or MAX of one of their properties, named as stored. SUM and COUNT of none are 0; AVG,
|
|
14
|
+
MIN and MAX of none are None. Read-only.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
function: AggregateFunction
|
|
18
|
+
type: str
|
|
19
|
+
property: str | None = None
|
|
20
|
+
direction: Direction = Direction.OUTGOING
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def Count(type: str, direction: Direction = Direction.OUTGOING) -> Aggregate: # noqa: N802 - reads as a marker
|
|
24
|
+
"""The number of nodes a relationship type leads to from the view's root. Read-only."""
|
|
25
|
+
return Aggregate(AggregateFunction.COUNT, type, None, direction)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class FullTextIndex:
|
|
9
|
+
"""A full-text index over the field, or, as a class argument, over the fields named. Drives `load_matching`."""
|
|
10
|
+
|
|
11
|
+
properties: Sequence[str] = ()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
from drivine.annotation.hop import Hop
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass(frozen=True)
|
|
10
|
+
class GraphPath:
|
|
11
|
+
"""
|
|
12
|
+
A field of a view holding the nodes at the far end of a fixed list of hops from the root, each once, skipping the
|
|
13
|
+
nodes between: `directors: Annotated[list[Director], GraphPath([hop("ACTED_IN"), hop("DIRECTED_BY")])] = []`.
|
|
14
|
+
Read-only. A single path typed without `None` is required, and a list is with `required=True`.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
hops: Sequence[Hop]
|
|
18
|
+
required: bool = False
|
|
19
|
+
|
|
20
|
+
def __hash__(self) -> int:
|
|
21
|
+
return hash((tuple(self.hops), self.required))
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True)
|
|
5
|
+
class GraphProperty:
|
|
6
|
+
"""
|
|
7
|
+
Stores a field under the given property name, rather than the one the fragment's naming gives it:
|
|
8
|
+
`url_v2: Annotated[str, GraphProperty("urlV2")]`.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
name: str
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
from drivine.annotation.direction import Direction
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class Hop:
|
|
10
|
+
"""
|
|
11
|
+
One hop of a path: a relationship type, its direction, and optionally a label the node it reaches must carry,
|
|
12
|
+
and a property of that node to read the path in the order of. See TypeScript's `Hop` for how an order is read.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
type: str
|
|
16
|
+
direction: Direction = Direction.OUTGOING
|
|
17
|
+
label: str | None = None
|
|
18
|
+
order_by: str | None = None
|
|
19
|
+
ascending: bool = True
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def hop(
|
|
23
|
+
type: str,
|
|
24
|
+
direction: Direction = Direction.OUTGOING,
|
|
25
|
+
label: str | None = None,
|
|
26
|
+
order_by: str | None = None,
|
|
27
|
+
ascending: bool = True,
|
|
28
|
+
) -> Hop:
|
|
29
|
+
return Hop(type, direction, label, order_by, ascending)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class NodeLabels:
|
|
10
|
+
"""
|
|
11
|
+
Maps a field holding strings, a list or a set, to the node's labels beyond its fragment's own. With `members` (a
|
|
12
|
+
list of names, or a string Enum) the set is closed: the field reads only those labels. Without, it is open: it
|
|
13
|
+
reads every label besides the fragment's own. One to a fragment.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
members: tuple[str, ...] | None = None
|
|
17
|
+
|
|
18
|
+
def __init__(self, members: Iterable[str] | type[Enum] | None = None) -> None:
|
|
19
|
+
if members is None:
|
|
20
|
+
names = None
|
|
21
|
+
elif isinstance(members, type):
|
|
22
|
+
names = tuple(str(it.value) for it in members)
|
|
23
|
+
else:
|
|
24
|
+
names = tuple(members)
|
|
25
|
+
object.__setattr__(self, "members", names)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True)
|
|
5
|
+
class NodeStamp:
|
|
6
|
+
"""
|
|
7
|
+
Marks the field that holds the node's stamp, which a save checks to refuse overwriting a newer write:
|
|
8
|
+
`stamp: Annotated[str | None, NodeStamp()] = None`. Stored as `__drivine.stamp`, as TypeScript and drivine4j
|
|
9
|
+
store it.
|
|
10
|
+
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True)
|
|
5
|
+
class NullAsDefault:
|
|
6
|
+
"""
|
|
7
|
+
Loads a stored null as the field's default: `status: Annotated[str, NullAsDefault()] = "active"`. A property the
|
|
8
|
+
node doesn't have gets the default anyway. TypeScript's `@Default`.
|
|
9
|
+
"""
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True)
|
|
5
|
+
class PropertyBag:
|
|
6
|
+
"""
|
|
7
|
+
Maps a dict field of a node fragment to node properties, one for each entry, stored as `<prefix><delimiter><key>`:
|
|
8
|
+
real properties, visible and indexable. `prefix` defaults to the field's stored name and `delimiter` to `.`.
|
|
9
|
+
|
|
10
|
+
A flat bag has no prefix: each entry is stored under its bare key, and the bag reads back every property no field
|
|
11
|
+
or other bag accounts for. One to a fragment.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
prefix: str | None = None
|
|
15
|
+
delimiter: str = "."
|
|
16
|
+
flat: bool = False
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class RangeIndex:
|
|
9
|
+
"""
|
|
10
|
+
A range index over the field, `Annotated[str, RangeIndex()]`, or, as a class argument, over the fields named:
|
|
11
|
+
`class Session(NodeFragment, labels=[...], schema=[RangeIndex(["last_activity_at", "session_id"])])`.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
properties: Sequence[str] = ()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True)
|
|
5
|
+
class ReadOnly:
|
|
6
|
+
"""
|
|
7
|
+
Marks a relationship field of a view that is loaded and never written. A list of fragments read over several hops
|
|
8
|
+
(`max_depth` above 1) is read-only whether or not it is marked so.
|
|
9
|
+
"""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from drivine.annotation.direction import Direction
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass(frozen=True)
|
|
7
|
+
class Relationship:
|
|
8
|
+
"""
|
|
9
|
+
Marks a view's field as a relationship from its root: `employment_history: Annotated[list[WorkHistory],
|
|
10
|
+
Relationship("WORKS_FOR")] = []`. What it holds, a node fragment, a relationship fragment or a view, is read from
|
|
11
|
+
the annotation, so is whether it is a list.
|
|
12
|
+
|
|
13
|
+
A single relationship typed without `None` is required: only roots that have it are loaded. A list is required
|
|
14
|
+
when `required=True`. `max_depth` is how deep a relationship to the view's own class, or one that leads back to
|
|
15
|
+
it, is expanded.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
type: str
|
|
19
|
+
direction: Direction = Direction.OUTGOING
|
|
20
|
+
max_depth: int = 1
|
|
21
|
+
required: bool = False
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass(frozen=True)
|
|
5
|
+
class SortedBy:
|
|
6
|
+
"""
|
|
7
|
+
Sorts a list relationship of a view after it is loaded, by a field path: `"name"`, or `"person.name"` into a
|
|
8
|
+
related view or relationship fragment. Nulls go last.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
path: str
|
|
12
|
+
ascending: bool = True
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class Unique:
|
|
9
|
+
"""A uniqueness constraint over the field, or, as a class argument, over the fields named."""
|
|
10
|
+
|
|
11
|
+
properties: Sequence[str] = ()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass(frozen=True)
|
|
8
|
+
class VectorIndex:
|
|
9
|
+
"""
|
|
10
|
+
A vector index over the field. Its dimensions come from the catalog's dimension provider when the catalog is built
|
|
11
|
+
(they belong to the embedding model, known at run time), unless given here. Drives `load_nearest`.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
similarity: Literal["COSINE", "EUCLIDEAN"] = "COSINE"
|
|
15
|
+
dimensions: int | None = None
|
|
16
|
+
hnsw_m: int | None = None
|
|
17
|
+
hnsw_ef_construction: int | None = None
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from drivine.backend.cypher_backend import CypherBackend
|
|
4
|
+
from drivine.backend.cypher_grammar import cypher_grammar_for
|
|
5
|
+
from drivine.backend.graph_backend import GraphBackend
|
|
6
|
+
from drivine.connection.database_type import DatabaseType
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def backend_for(type: DatabaseType, graph_name: str | None = None) -> GraphBackend:
|
|
10
|
+
"""The backend that writes an engine's statements: on Oracle, over the tables of the graph named."""
|
|
11
|
+
if type is DatabaseType.ORACLE:
|
|
12
|
+
from drivine.backend.oracle.oracle_backend import OracleBackend
|
|
13
|
+
from drivine.backend.oracle.oracle_graph import DEFAULT_GRAPH, OracleGraph
|
|
14
|
+
|
|
15
|
+
return OracleBackend(OracleGraph(graph_name or DEFAULT_GRAPH))
|
|
16
|
+
return CypherBackend(cypher_grammar_for(type))
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from drivine.annotation.direction import Direction
|
|
4
|
+
from drivine.backend.cypher import label_expression, quote_name
|
|
5
|
+
from drivine.backend.cypher_grammar import CypherGrammar
|
|
6
|
+
from drivine.backend.view_projector import ViewProjector, label_test, target
|
|
7
|
+
from drivine.model.fragment_model import FragmentModel
|
|
8
|
+
from drivine.model.graph_view_model import GraphViewModel
|
|
9
|
+
from drivine.model.relationship_model import RelationshipModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CascadeTargets:
|
|
13
|
+
"""
|
|
14
|
+
The nodes a view reaches from its root, as one list expression: a pattern comprehension for each position in the
|
|
15
|
+
view, each a flat path from the root, joined with `+`. Paths are flat, with no comprehension nested in another,
|
|
16
|
+
because FalkorDB evaluates nested ones wrongly when they are combined (FalkorDB/FalkorDB#2006, #3386).
|
|
17
|
+
|
|
18
|
+
The view's max_depth and the requirements of its nested views apply, so the list holds what loading the view would
|
|
19
|
+
load. A node reached by two paths is listed twice.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(self, grammar: CypherGrammar) -> None:
|
|
23
|
+
self.grammar = grammar
|
|
24
|
+
self._alias_count = 0
|
|
25
|
+
|
|
26
|
+
def of(self, model: GraphViewModel, root: str) -> str:
|
|
27
|
+
lists = self._view(model, f"({root})", [], [])
|
|
28
|
+
return " + ".join(lists) if lists else "[]"
|
|
29
|
+
|
|
30
|
+
def _view(
|
|
31
|
+
self, model: GraphViewModel, chain: str, conditions: list[str], path: list[RelationshipModel]
|
|
32
|
+
) -> list[str]:
|
|
33
|
+
lists: list[str] = []
|
|
34
|
+
for rel in model.relationships:
|
|
35
|
+
if sum(1 for it in path if it is rel) >= rel.max_depth:
|
|
36
|
+
continue
|
|
37
|
+
self._alias_count += 1
|
|
38
|
+
alias = f"c{self._alias_count}"
|
|
39
|
+
into = target(rel)
|
|
40
|
+
hops = f"*1..{rel.max_depth}" if isinstance(into, FragmentModel) and rel.max_depth > 1 else ""
|
|
41
|
+
labels = into.root.labels if isinstance(into, GraphViewModel) else into.labels
|
|
42
|
+
step = f"{chain}{_hop(rel, hops)}({alias}"
|
|
43
|
+
extended = f"{step}{label_expression(labels)})"
|
|
44
|
+
own = ViewProjector(self.grammar).requirements(into, alias) if isinstance(into, GraphViewModel) else []
|
|
45
|
+
every = [*conditions, *own]
|
|
46
|
+
where = f" WHERE {' AND '.join(every)}" if every else ""
|
|
47
|
+
# Where the grammar says so, the far node's labels are tested after the match, the next level's chain
|
|
48
|
+
# keeping them.
|
|
49
|
+
if self.grammar.far_labels_after_match:
|
|
50
|
+
lists.append(f"[{alias} IN [{step}){where} | {alias}] WHERE {label_test(alias, labels)}]")
|
|
51
|
+
else:
|
|
52
|
+
lists.append(f"[{extended}{where} | {alias}]")
|
|
53
|
+
if isinstance(into, GraphViewModel):
|
|
54
|
+
lists.extend(self._view(into, extended, every, [*path, rel]))
|
|
55
|
+
return lists
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _hop(rel: RelationshipModel, hops: str) -> str:
|
|
59
|
+
edge = f"[:{quote_name(rel.type)}{hops}]"
|
|
60
|
+
if rel.direction is Direction.INCOMING:
|
|
61
|
+
return f"<-{edge}-"
|
|
62
|
+
if rel.direction is Direction.UNDIRECTED:
|
|
63
|
+
return f"-{edge}-"
|
|
64
|
+
return f"-{edge}->"
|