public class PersistentNode
extends org.gcube.data.trees.data.InnerNode
InnerNode with persistent state.
Persistent nodes load their state on demand, i.e. when access is required. This optimises partial tree traversals, such as those performed to prune the results of read operations or to update trees in place.
Persistent nodes that are created in READ mode, do
not persist state changes. Those that are created in
UPDATE mode do. This side-effect is visible to
clients to the extent that new nodes acquire identifiers. The following
example captures the implications:
PersistentNode node =.. Edge e = .... node.add(e); assertFalse(node.remove(e));
| Constructor and Description |
|---|
PersistentNode(org.neo4j.graphdb.GraphDatabaseService db,
org.gcube.data.trees.data.InnerNode node)
Creates an instance in
BindingMode.ADD that persists an
InnerNode, assigning an identifier to it and its descendants. |
PersistentNode(org.neo4j.graphdb.GraphDatabaseService db,
org.neo4j.graphdb.Node dbnode,
BindingMode mode)
Creates an instance over a database node, in a given binding mode.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(org.gcube.data.trees.data.Edge e) |
Map<QName,String> |
attributes() |
org.neo4j.graphdb.Node |
dbnode()
Returns the database node that acts as the entry point to the persistent
state of this node
|
void |
delete() |
List<org.gcube.data.trees.data.Edge> |
edges() |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
remove(org.gcube.data.trees.data.Edge e) |
String |
removeAttribute(QName name) |
String |
setAttribute(QName name,
String value) |
add, add, child, child, child, child, child, child, children, children, children, children, children, children, children, children, clearState, delta, descendant, descendant, descendants, descendants, descendants, descendants, edge, edge, edge, edges, edges, edges, find, find, hasEdge, hasEdge, hasEdge, labels, labels, markAsNew, remove, remove, remove, remove, size, toString, updatepublic PersistentNode(org.neo4j.graphdb.GraphDatabaseService db,
org.gcube.data.trees.data.InnerNode node)
throws IllegalArgumentException
BindingMode.ADD that persists an
InnerNode, assigning an identifier to it and its descendants.
This works as a copy constructor with side-effects in the database. As it clones the node in memory, it also serialises its state in the database.
the - databasenode - the nodeIllegalArgumentException - if the input has already an identifier.public PersistentNode(org.neo4j.graphdb.GraphDatabaseService db,
org.neo4j.graphdb.Node dbnode,
BindingMode mode)
db - the databasedbnode - the database nodemode - the binding modepublic org.neo4j.graphdb.Node dbnode()
public Map<QName,String> attributes()
attributes in class org.gcube.data.trees.data.Nodepublic String setAttribute(QName name, String value)
setAttribute in class org.gcube.data.trees.data.Nodepublic String removeAttribute(QName name)
removeAttribute in class org.gcube.data.trees.data.Nodepublic List<org.gcube.data.trees.data.Edge> edges()
edges in class org.gcube.data.trees.data.InnerNodepublic boolean add(org.gcube.data.trees.data.Edge e)
add in class org.gcube.data.trees.data.InnerNodepublic boolean remove(org.gcube.data.trees.data.Edge e)
remove in class org.gcube.data.trees.data.InnerNodepublic void delete()
delete in class org.gcube.data.trees.data.InnerNodepublic boolean equals(Object obj)
equals in class org.gcube.data.trees.data.InnerNodepublic int hashCode()
hashCode in class org.gcube.data.trees.data.InnerNodeCopyright © 2018. All Rights Reserved.