Class: Factory

Factory

new Factory(options)

A factory for creating (and retrieving) Nodes and Edges.

Parameters:
Name Type Description
options Object
Properties
Name Type Description
nodeClasses Array.<function(): Node>

an array of Node constructors.

edgeClasses Array.<function(): Edge>

an array of Edge constructors.

Members

edgeClasses :Array.<function(): Edge>

Type:
  • Array.<function(): Edge>

edgeCollections :Object.<EdgeType, Collection>

Type:

nodeClasses :Array.<function(): Node>

Type:
  • Array.<function(): Node>

nodeCollections :Object.<NodeType, Collection>

Type:

Methods

createOrUpdateEdge(edgeType, raw) → {Edge}

Create and retrieve an Edge, or update it if it already exists.

Parameters:
Name Type Description
edgeType EdgeType

the type of edge to create.

raw Object

params for creating the edge.

Returns:
Type
Edge

createOrUpdateNode(nodeType, raw) → {Node}

Create and retrieve a Node, or update it if it already exists.

Parameters:
Name Type Description
nodeType NodeType

the type of node to create.

raw Object

params for creating the node.

Returns:
Type
Node

getEdge(edgeType, id) → {Edge}

Get an Edge.

Parameters:
Name Type Description
edgeType EdgeType
id EdgeId
Returns:
Type
Edge

getEdges(edgeTypeopt) → {Array.<Edge>}

Return all edges, optionally of a given type.

Parameters:
Name Type Attributes Description
edgeType EdgeType <optional>
Returns:
Type
Array.<Edge>

getNode(nodeType, id) → {Node}

Get a Node.

Parameters:
Name Type Description
nodeType NodeType
id NodeId
Returns:
Type
Node

getNodes(nodeTypeopt) → {Array.<Node>}

Return all nodes, optionally of a given type.

Parameters:
Name Type Attributes Description
nodeType NodeType <optional>
Returns:
Type
Array.<Node>