public interface JanusGraphElement extends org.apache.tinkerpop.gremlin.structure.Element, Idfiable, Removable
JanusGraphRelation and JanusGraphVertex.
Entities have a life cycle state which reflects the current state of the entity with respect
to the JanusGraphTransaction in which it occurs. An entity may be in any one of these states
and any given time:
id()
(use hasId() to determine if a given entity has a unique ID).JanusGraphVertex,
JanusGraphRelation| Modifier and Type | Method and Description |
|---|---|
JanusGraphTransaction |
graph() |
boolean |
hasId()
Checks whether this entity has a unique identifier.
|
default Object |
id()
Returns a unique identifier for this entity.
|
boolean |
isLoaded()
Checks whether this entity has been loaded into the current transaction and not yet modified.
|
boolean |
isNew()
Checks whether this entity has been newly created in the current transaction.
|
boolean |
isRemoved()
Checks whether this entity has been deleted into the current transaction.
|
long |
longId()
Unique identifier for this entity.
|
<V> org.apache.tinkerpop.gremlin.structure.Property<V> |
property(String key,
V value)
Sets the value for the given key on this element.
|
void |
remove()
Deletes this entity and any incident edges or properties from the graph.
|
<V> V |
valueOrNull(PropertyKey key)
Retrieves the value associated with the given key on this element and casts it to the specified type.
|
JanusGraphTransaction graph()
graph in interface org.apache.tinkerpop.gremlin.structure.Elementdefault Object id()
The unique identifier may only be set when the transaction in which entity is created commits. Some entities are never assigned a unique identifier if they depend on a parent entity.
JanusGraph allocates blocks of identifiers and automatically assigns identifiers to elements
automatically be default. This behavior can be partially overridden by setting
GraphDatabaseConfiguration.ALLOW_SETTING_VERTEX_ID
id in interface org.apache.tinkerpop.gremlin.structure.ElementIllegalStateException - if the entity does not (yet) have a unique identifierhasId()long longId()
id() for the permanent id.boolean hasId()
Note that some entities may never be assigned an identifier and others will only be assigned an identifier at the end of a transaction.
longId()void remove()
remove in interface org.apache.tinkerpop.gremlin.structure.Elementremove in interface RemovableIllegalStateException - if the entity cannot be deleted or if the user does not
have permission to remove the entity<V> org.apache.tinkerpop.gremlin.structure.Property<V> property(String key, V value)
Cardinality.SINGLE, otherwise this method throws an exception.property in interface org.apache.tinkerpop.gremlin.structure.Elementkey - the string identifying the keyvalue - the object value<V> V valueOrNull(PropertyKey key)
key - keyboolean isNew()
boolean isLoaded()
boolean isRemoved()
Copyright © 2012–2023. All rights reserved.