Skip to main content

graphforge_core/
cypher_feature.rs

1//! Recognized Cypher constructs whose execution is not implemented.
2
3use serde::{Deserialize, Serialize};
4
5/// A specific unsupported Cypher construct, shared by compiler diagnostics.
6#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
7pub enum UnsupportedCypherFeature {
8    /// A CALL body, including correlated and UNION subqueries.
9    CallSubquery,
10    /// A COUNT block expression.
11    CountSubquery,
12    /// An accumulator-style reduce expression.
13    Reduce,
14    /// A shortestPath/allShortestPaths pattern.
15    ShortestPath,
16    /// A duration map whose values are not literal constants.
17    DynamicDuration,
18    /// Relationship identity through id().
19    IdentityFunction,
20    /// Endpoint lookup on a relationship without a bound fixed-hop endpoint.
21    UnboundRelationshipEndpoint,
22    /// An ALL predicate reading indexed variable-hop relationship properties.
23    IndexedPathRelationshipPredicate,
24    /// A variable-hop relationship with alternative relationship types.
25    VariableLengthRelationshipAlternation,
26    /// Parameter rows driving property matches across different node labels.
27    ParameterRowsAcrossLabels,
28}
29
30impl UnsupportedCypherFeature {
31    /// Stable explanation used by the public typed not-supported error.
32    #[must_use]
33    pub const fn description(self) -> &'static str {
34        match self {
35            Self::CallSubquery => "Cypher CALL subqueries",
36            Self::CountSubquery => "Cypher COUNT subqueries",
37            Self::Reduce => "Cypher reduce accumulator expressions",
38            Self::ShortestPath => "Cypher shortest-path patterns",
39            Self::DynamicDuration => "Cypher duration maps with nonliteral values",
40            Self::IdentityFunction => "Cypher id identity function",
41            Self::UnboundRelationshipEndpoint => {
42                "Cypher endpoint functions on unbound relationship values"
43            }
44            Self::IndexedPathRelationshipPredicate => {
45                "Cypher ALL predicates over indexed variable-length relationship properties"
46            }
47            Self::VariableLengthRelationshipAlternation => {
48                "Cypher variable-length relationship type alternation"
49            }
50            Self::ParameterRowsAcrossLabels => {
51                "Cypher parameter rows matching properties across different node labels"
52            }
53        }
54    }
55}