API Reference AshNeo4j v#0.9.0

Copy Markdown View Source

Modules

Top-level helpers for the AshNeo4j data layer.

AshNeo4j BoltyHelper

AshNeo4j Cypher Functions for converting Elixir data structures to Cypher query components and running Cypher queries against a Neo4j database. Ideally has no specific knowledge of Ash

CALL { … } block joining pre-rendered branch cyphers with UNION or UNION ALL. Used for native combination-query pushdown (:union, :union_all).

CREATE clause. pattern is a Cypher pattern string, e.g. "(n:Actor {name: $n_name})".

DELETE clause. items is a list of variables to delete, e.g. ["r"].

DETACH DELETE clause.

LIMIT clause.

MATCH clause. pattern is a Cypher pattern string, e.g. "(s:Actor)".

MERGE clause. pattern is a Cypher pattern string.

OPTIONAL MATCH clause.

ORDER BY clause. Each term is a {property_expression, :asc | :desc} pair.

Typed representation of a Cypher query, and builders for constructing common patterns.

REMOVE clause. items is a list of property references, e.g. ["n.born"].

RETURN clause.

SET clause. expression is the full SET expression, e.g. "n += {born: $n_born}".

SKIP clause.

WHERE clause. Each entry in conditions is ANDed together.

WITH clause.

Ash DataLayer for Neo4j

Casting for AshNeo4j.DataLayer

Domain-level DSL extension for AshNeo4j.

Introspection helpers for AshNeo4j.DataLayer.Domain

Dumping for AshNeo4j.DataLayer

Introspection helpers for AshNeo4j.DataLayer

Type Classifier for AshNeo4j.DataLayer

Describes a single graph edge from a resource's perspective.

Raised when a spatial operation combines geometries of different coordinate dimensions (2D vs 3D) — e.g. a 3D %Geo.PointZ{} against a 2D attribute, or vice versa. Neo4j silently returns null for mixed-CRS operations (which then drops rows in a WHERE), so AshNeo4j refuses up front (#270).

Raised when a Cypher 25 operation is attempted against a Neo4j server older than 2025.06. Upgrade to Neo4j 2025.06 or later to use this feature.

Raised when a 3D areal or linear geometry (%Geo.PolygonZ{}, %Geo.LineStringZ{}, …) is written. #270 Phase 1 supports 3D points (%Geo.PointZ{}) only; 3D areal/linear geometries are deferred to Phase 2, because exact 3D containment/distance needs a model the 2D topo refinement cannot provide. Storing 2D bbox companions would silently drop the z.

st_closest_point(collection, point) — returns the closest vertex from a multi-vertex geometry to a target point. Mirrors ash_geo / PostGIS ST_ClosestPoint. v1 supports

Spatial containment — true if the first geometry contains the second.

Geodesic distance between two geometries, in meters. Mirrors ash_geo / PostGIS ST_Distance. Post #274 every geometry arrives as a %Geo.*{} struct.

Alias for st_distance. PostGIS distinguishes the two because PostGIS ST_Distance returns degrees for geographic types unless cast; Neo4j's point.distance is always meters for WGS-84, so the distinction is cosmetic for us. This module exists for API parity with ash_geo so consumer code reads identically across data layers.

True if two geometries are within a given distance of each other. Mirrors ash_geo / PostGIS ST_DWithin. v1 supports point-point only, with the threshold in meters (geodesic, WGS-84).

st_intersects(a, b) — true if two geometries share any space. Mirrors ash_geo / PostGIS ST_Intersects. Exact, via topo on the %Geo.*{} geometries (#267) — handles any combination of Point / LineString / Polygon / Multi* directly, including segment-edge crossings.

st_within(a, b) — true if a is contained by b. Argument-flipped st_contains. Mirrors ash_geo / PostGIS ST_Within.

Cosine distance between a stored vector attribute and a query embedding — the ash_ai-compatible counterpart to AshNeo4j.Functions.VectorSimilarity.

Shared in-memory cosine maths for the vector query functions.

Normalised cosine similarity between a stored vector attribute and a query embedding, matching Neo4j's vector.similarity.cosine/2.

Geodesic geometry primitives for the in-memory side of AshNeo4j's spatial predicates.

RFC 7946 GeoJSON encoder/decoder over the :geo library.

AshNeo4j DataLayer Neo4j Helper

AshNeo4j DataLayer QueryHelper

Resource information for AshNeo4j.DataLayer

A compile-time description of how an Ash resource maps to the Neo4j graph.

Test sandbox for AshNeo4j, analogous to Ecto.Adapters.SQL.Sandbox.

Convenience helpers for creating the Neo4j POINT indexes that back AshNeo4j's spatial pushdown (#275).

Ash attribute type for vector embeddings, stored as a Neo4j LIST<FLOAT>.

AshNeo4j Util

Convenience helpers for creating the Neo4j VECTOR indexes that back AshNeo4j.Types.Vector attributes.

Verifies that attribute types are supported by AshNeo4j.DataLayer

Verifies that relate is unique so relationships are enrichable

Verifies that each guard is a node relationship meeting Neo4j conventions

Verifies that Neo4j labels are PascalCase

Verifies that Neo4j properties are camelCase

Verifies that each relate relates to a relationship, and that the edge labels meets Neo4j conventions

Mix Tasks

Installs AshNeo4j