Skip to main content

Interface: CypherDataAdapter<GraphType, NodeType, EdgeType>

Defined in: lang-cypher/src/language/data-adapter.ts:10

Data adapter for the Cypher language.

Type Parameters

Type ParameterDefault typeDescription
GraphTypeanythe type of the adapted graph data structure
NodeType extends Record<string, unknown>anythe type of the nodes in the graph
EdgeType extends Record<string, unknown>anythe type of the edges in the graph

Methods

filterEdges()

filterEdges(graph, predicate?): Iterable<NodeType>

Defined in: lang-cypher/src/language/data-adapter.ts:41

Filter edges in the graph.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
predicate?(src, tgt, edge) => booleanA function to test each edge.

Returns

Iterable<NodeType>


filterNodeEdges()

filterNodeEdges(graph, node, direction, predicate?): Iterable<EdgeType>

Defined in: lang-cypher/src/language/data-adapter.ts:65

Filter edges connected to a specific node.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
nodeNodeTypeThe node to get edges for.
directionEdgeDirectionThe direction to filter by.
predicate?(src, tgt, edge) => booleanA function to test each edge.

Returns

Iterable<EdgeType>


filterNodes()

filterNodes(graph, predicate?): Iterable<NodeType>

Defined in: lang-cypher/src/language/data-adapter.ts:26

Filter nodes in the graph.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
predicate?(node) => booleanA function to test each node.

Returns

Iterable<NodeType>


getEdgeNode()

getEdgeNode(graph, edge, type): NodeType

Defined in: lang-cypher/src/language/data-adapter.ts:77

Get the node connected to a specific edge.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
edgeEdgeTypeThe edge to get the node for.
type"source" | "target"The type of the node to get (source or target).

Returns

NodeType


getEdgesByType()

getEdgesByType(graph, type): Iterable<NodeType>

Defined in: lang-cypher/src/language/data-adapter.ts:35

Get edges by their type.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
typestringThe type to filter by.

Returns

Iterable<NodeType>


getLabels()

getLabels(graph, node): string[]

Defined in: lang-cypher/src/language/data-adapter.ts:108

Return the labels of a node.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
nodeNodeTypeThe node to check.

Returns

string[]


getNodeEdgesByType()

getNodeEdgesByType(graph, node, type, direction): Iterable<EdgeType>

Defined in: lang-cypher/src/language/data-adapter.ts:52

Get edges connected to a specific node by their type and direction.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
nodeNodeTypeThe node to get edges for.
typestringThe type to filter by.
directionEdgeDirectionThe direction to filter by.

Returns

Iterable<EdgeType>


getNodesByLabels()

getNodesByLabels(graph, ...labels): Iterable<NodeType>

Defined in: lang-cypher/src/language/data-adapter.ts:20

Get nodes by their labels.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
...labelsstring[]The labels to filter by.

Returns

Iterable<NodeType>


getType()

getType(graph, edge): string

Defined in: lang-cypher/src/language/data-adapter.ts:121

Return the type of an edge.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
edgeEdgeTypeThe edge to check.

Returns

string


hasAnyType()

hasAnyType(graph, edge, types): boolean

Defined in: lang-cypher/src/language/data-adapter.ts:115

Check if an edge has any of the specified types.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
edgeEdgeTypeThe edge to check.
typesstring[]The types to check for.

Returns

boolean


hasLabels()

hasLabels(graph, node, labels): boolean

Defined in: lang-cypher/src/language/data-adapter.ts:102

Check if a node has all of the specified labels.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
nodeNodeTypeThe node to check.
labelsstring[]The labels to check for.

Returns

boolean


isConnected()

isConnected(graph, node, edge, direction): boolean

Defined in: lang-cypher/src/language/data-adapter.ts:90

Check if a node is connected to a specific edge.

Parameters

ParameterTypeDescription
graphGraphTypeThe graph to query.
nodeNodeTypeThe node to check.
edgeEdgeTypeThe edge to check.
directionEdgeDirectionThe direction to check.

Returns

boolean