NeoGraph
.An identification scheme can be defined throught the register
and add
methods. The id_property
attribute defines where the local ID (that is the
ID managed by the collection) is stored in each node.
neo4j :: NeoNodeCollection :: compact
Optimize the collection, possibly by rewritting it.neo4j :: NeoNodeCollection :: create_node
Add a new node to the graph and return it.neo4j :: NeoNodeCollection :: enlarge
Enlarge the collection to have at least the specified capacity.neo4j :: NeoNodeCollection :: get_or_null
Retrieve the node that has the specified local id, or returnnull
.
neo4j :: NeoNodeCollection :: id_from_jsonable
Convert the specified JSON value into a local ID.neo4j :: NeoNodeCollection :: id_property
The property of the nodes that hold the local ID.neo4j :: NeoNodeCollection :: id_property=
The property of the nodes that hold the local ID.neo4j :: NeoNodeCollection :: register
Add the specified node to the graph and set its local ID.neo4j :: NeoNodeCollection :: remove_at
Remove the node with the specified local ID.neo4j $ NeoNodeCollection :: SELF
Type of this instance, automatically specialized in every classneo4j $ NeoNodeCollection :: add
Add the specified node to the graph assuming that its local ID is already set.neo4j $ NeoNodeCollection :: remove
Remove an occurrence ofitem
neo4j $ NeoNodeCollection :: remove_all
Remove all occurrences ofitem
core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectionserialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Collection :: combinations
Allr
-length combinations on self (in same order) without repeated elements.
core :: Collection :: combinations_with_replacement
Allr
-length combination on self (in same order) with repeated elements.
neo4j :: NeoNodeCollection :: compact
Optimize the collection, possibly by rewritting it.serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
neo4j :: NeoNodeCollection :: create_node
Add a new node to the graph and return it.core :: SimpleCollection :: defaultinit
core :: Collection :: defaultinit
core :: Object :: defaultinit
neo4j :: NeoNodeCollection :: enlarge
Enlarge the collection to have at least the specified capacity.serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
neo4j :: NeoNodeCollection :: get_or_null
Retrieve the node that has the specified local id, or returnnull
.
core :: Collection :: has_all
Does the collection contain at least each element ofother
?
core :: Collection :: has_any
Does the collection contain at least one element ofother
?
core :: Collection :: has_exactly
Does the collection contain exactly all the elements ofother
?
neo4j :: NeoNodeCollection :: id_from_jsonable
Convert the specified JSON value into a local ID.neo4j :: NeoNodeCollection :: id_property
The property of the nodes that hold the local ID.neo4j :: NeoNodeCollection :: id_property=
The property of the nodes that hold the local ID.core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: output_class_name
Display class name on stdout (debug only).core :: Collection :: permutations
Allr
-length permutations on self (all possible ordering) without repeated elements.
core :: Collection :: product
Cartesian product, overr
times self
.
neo4j :: NeoNodeCollection :: register
Add the specified node to the graph and set its local ID.core :: RemovableCollection :: remove
Remove an occurrence ofitem
core :: RemovableCollection :: remove_all
Remove all occurrences ofitem
neo4j :: NeoNodeCollection :: remove_at
Remove the node with the specified local ID.serialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
core :: Collection :: to_concurrent
Wrapsself
in a thread-safe collection
core :: Collection :: to_counter
Create and fill up a counter with the elements of `self.core :: Collection :: to_curlslist
Convert Collection[String] to CURLSListserialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
core :: Collection :: to_shuffle
Return a new array made of elements in a random order.Serializer::serialize
neo4j :: SequentialNodeCollection
A Neo4j node collection using a sequential identification scheme.
# All the nodes in a `NeoGraph`.
#
# An identification scheme can be defined throught the `register` and `add`
# methods. The `id_property` attribute defines where the local ID (that is the
# ID managed by the collection) is stored in each node.
abstract class NeoNodeCollection
super SimpleCollection[NeoNode]
# The type of the local IDs.
type ID_TYPE: Serializable
# The property of the nodes that hold the local ID.
var id_property: String
# Retrieve the node that has the specified local id.
#
# Note: The default implementation uses `get_or_null`.
fun [](id: ID_TYPE): NeoNode do
var n = get_or_null(id)
assert n isa NeoNode
return n
end
# Retrieve the node that has the specified local id, or return `null`.
#
# Note: The default implementation uses `iterator`.
fun get_or_null(id: ID_TYPE): nullable NeoNode do
for n in self do
if id_of(n) == id then return n
end
return null
end
# There is a node that has the specified local id?
#
# Note: The default implementation uses `get_or_null`.
fun has_id(id: ID_TYPE): Bool do return get_or_null(id) isa NeoNode
# Return the local ID of the node.
fun id_of(node: NeoNode): ID_TYPE do return node[id_property].as(ID_TYPE)
# Set the local ID of the specified node.
#
# Just update the property at `property_id`. Do not check anything.
protected fun id_of=(node: NeoNode, id: ID_TYPE) do
node[id_property] = id
end
# Enlarge the collection to have at least the specified capacity.
#
# The capacity is specified in number of nodes. Used to minimize the
# number of times the collection need to be resized when adding nodes
# in batches.
#
# Do nothing by default.
fun enlarge(cap: Int) do end
# Add the specified node to the graph and set its local ID.
#
# SEE: `add`
# SEE: `create_node`
fun register(node: NeoNode) is abstract
# Add the specified node to the graph assuming that its local ID is already set.
#
# SEE: `create_node`
# SEE: `register`
redef fun add(node) is abstract
# Add a new node to the graph and return it.
#
# Set the local ID of the node before returning it.
#
# SEE: `add`
# SEE: `register`
fun create_node: NeoNode do
var node = new NeoNode
register(node)
return node
end
# Remove the node with the specified local ID.
fun remove_at(id: ID_TYPE) is abstract
# Remove the specified node.
#
# The local ID is used instead of `==` to seek the node.
fun remove_node(node: NeoNode) do
remove_at(id_of(node))
end
redef fun clear do
for node in self do remove_node(node)
end
redef fun remove(node) do
for n in self do
if node == n then
remove_node(n)
return
end
end
end
redef fun remove_all(node) do
for n in self do
if node == n then remove_node(n)
end
end
# Optimize the collection, possibly by rewritting it.
#
# The local ID of the elements may be changed by this method.
fun compact do end
end
lib/neo4j/graph/graph.nit:41,1--155,3
redef class NeoNodeCollection
# Convert the specified JSON value into a local ID.
fun id_from_jsonable(id: nullable Serializable): ID_TYPE do return id.as(ID_TYPE)
end
lib/neo4j/graph/json_graph_store.nit:218,1--221,3