Interface: CypherDataAdapter<GraphType, NodeType, EdgeType>
Defined in: lang-cypher/src/language/data-adapter.ts:10
Data adapter for the Cypher language.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
GraphType | any | the type of the adapted graph data structure |
NodeType extends Record<string, unknown> | any | the type of the nodes in the graph |
EdgeType extends Record<string, unknown> | any | the 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
predicate? | (src, tgt, edge) => boolean | A 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
node | NodeType | The node to get edges for. |
direction | EdgeDirection | The direction to filter by. |
predicate? | (src, tgt, edge) => boolean | A 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
predicate? | (node) => boolean | A 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
edge | EdgeType | The 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
type | string | The 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
node | NodeType | The 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
node | NodeType | The node to get edges for. |
type | string | The type to filter by. |
direction | EdgeDirection | The 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
...labels | string[] | 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
edge | EdgeType | The 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
edge | EdgeType | The edge to check. |
types | string[] | 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
node | NodeType | The node to check. |
labels | string[] | 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
| Parameter | Type | Description |
|---|---|---|
graph | GraphType | The graph to query. |
node | NodeType | The node to check. |
edge | EdgeType | The edge to check. |
direction | EdgeDirection | The direction to check. |
Returns
boolean