Package oracle.pgx.api
Class Property<ID,K extends PgxEntity<ID>,V>
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.Destroyable
-
- oracle.pgx.api.PgxManagedObject
-
- oracle.pgx.api.Property<ID,K,V>
-
- Type Parameters:
ID
- the identifier type of this property's entity (node or edgeIdType
)K
- the type of this property's entity (node or edge,PgxEntity
)V
- the type of this property (seePropertyType
)
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.lang.Cloneable
- Direct Known Subclasses:
EdgeProperty
,VertexProperty
public abstract class Property<ID,K extends PgxEntity<ID>,V> extends PgxManagedObject implements java.lang.Cloneable
A property of aPgxGraph
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PgxFuture<java.lang.Void>
destroyAsync()
Requests destruction of this object.boolean
equals(java.lang.Object obj)
void
fill(V value)
Blocking version offillAsync(Object)
.PgxFuture<java.lang.Void>
fillAsync(V value)
Fill this property with a given value.V
get(ID id)
Blocking version ofgetAsync(Object)
.V
get(K key)
Blocking version ofgetAsync(PgxEntity)
.PgxFuture<V>
getAsync(ID id)
Gets the property value.PgxFuture<V>
getAsync(K key)
Gets the property value.EntryIterable<ID,K,V>
getBottomKValues(int k)
Blocking version ofgetBottomKValuesAsync(int)
.PgxFuture<EntryIterable<ID,K,V>>
getBottomKValuesAsync(int k)
Gets the bottom k vertex/edge value pairs according to their value.int
getDimension()
Gets the dimension.EntityType
getEntityType()
Gets the entity type.PgxGraph
getGraph()
Gets the graph.java.lang.String
getName()
Gets the name.oracle.pgx.common.PgxId
getPropertyId()
Returns an internal identifier for this property Only meant for internal usage.EntryIterable<ID,K,V>
getTopKValues(int k)
Blocking version ofgetTopKValuesAsync(int)
.PgxFuture<EntryIterable<ID,K,V>>
getTopKValuesAsync(int k)
Gets the top k vertex/edge value pairs according to their value.PropertyType
getType()
Gets the PropertyType.EntryIterable<ID,K,V>
getValues()
Blocking version ofgetValuesAsync()
.PgxFuture<EntryIterable<ID,K,V>>
getValuesAsync()
Gets the values.int
hashCode()
boolean
isPublished()
Blocking version ofisPublished()
.PgxFuture<java.lang.Boolean>
isPublishedAsync()
Checks if this property is published.boolean
isTransient()
Checks the transient flag of this property.boolean
isVectorProperty()
Checks if this property holds vectors or scalars.void
publish()
Blocking version ofpublish()
.PgxFuture<java.lang.Void>
publishAsync()
Publishes the property into a shared graph so It can be shared between sessions.void
rename(java.lang.String newPropertyName)
Blocking version ofrenameAsync(String)
.PgxFuture<java.lang.Void>
renameAsync(java.lang.String newPropertyName)
Renames this property.void
set(K key, V value)
Blocking version ofsetAsync(PgxEntity, Object)
.PgxFuture<java.lang.Void>
setAsync(K key, V value)
Sets a property value.void
setValues(java.util.Map<K,V> values)
Blocking version ofsetValuesAsync(Map)
.void
setValues(java.util.Map<K,V> values, V defaultValue)
Blocking version ofsetValuesAsync(Map, Object)
.PgxFuture<java.lang.Void>
setValuesAsync(java.util.Map<K,V> values)
Sets multiple property values.PgxFuture<java.lang.Void>
setValuesAsync(java.util.Map<K,V> values, V defaultValue)
Sets multiple property values.long
size()
Blocking version ofsizeAsync()
.PgxFuture<java.lang.Long>
sizeAsync()
Gets the size/length of this property.java.lang.String
toString()
static <V> V
wrap(V value, PropertyType type, PgxGraph graph)
-
Methods inherited from class oracle.pgx.api.Destroyable
close, destroy
-
-
-
-
Method Detail
-
getPropertyId
public final oracle.pgx.common.PgxId getPropertyId()
Returns an internal identifier for this property Only meant for internal usage.- Returns:
- the internal identifier of this property
- Since:
- 21.1
-
getGraph
public PgxGraph getGraph()
Gets the graph.- Returns:
- the graph this property belongs to
-
getEntityType
public EntityType getEntityType()
Gets the entity type.- Returns:
- the entity type of this property
-
getName
public java.lang.String getName()
Gets the name.- Specified by:
getName
in classPgxManagedObject
- Returns:
- the name of this property
-
getDimension
public int getDimension()
Gets the dimension.- Returns:
- the dimension. If
isVectorProperty()
isfalse
, the dimension will be 0.
-
isVectorProperty
public boolean isVectorProperty()
Checks if this property holds vectors or scalars.- Returns:
true
if this is a vector property,false
otherwise.
-
isTransient
public boolean isTransient()
Checks the transient flag of this property.- Returns:
true
if this property is transient (session-bound, private),false
otherwise.
-
destroyAsync
public PgxFuture<java.lang.Void> destroyAsync()
Description copied from class:Destroyable
Requests destruction of this object. After this method returns, the behavior of any method of this class becomes undefined.- Specified by:
destroyAsync
in classDestroyable
- Returns:
- a future which will be completed once the destruction request finishes.
-
getType
public PropertyType getType()
Gets the PropertyType.- Returns:
- the propertytype
-
setAsync
public PgxFuture<java.lang.Void> setAsync(K key, V value)
Sets a property value.- Parameters:
key
- the key (vertex/edge) whose property to set.value
- the property value.
-
setValuesAsync
public PgxFuture<java.lang.Void> setValuesAsync(java.util.Map<K,V> values)
Sets multiple property values.- Parameters:
values
- the key/value mapping to set.
-
setValuesAsync
public PgxFuture<java.lang.Void> setValuesAsync(java.util.Map<K,V> values, V defaultValue)
Sets multiple property values.- Parameters:
values
- the values to setdefaultValue
- default value if one of the values fails to be put
-
fillAsync
public PgxFuture<java.lang.Void> fillAsync(V value)
Fill this property with a given value.- Parameters:
value
- the value
-
renameAsync
public PgxFuture<java.lang.Void> renameAsync(java.lang.String newPropertyName)
Renames this property.- Parameters:
newPropertyName
- the new name.
-
publishAsync
public PgxFuture<java.lang.Void> publishAsync()
Publishes the property into a shared graph so It can be shared between sessions.
-
isPublishedAsync
public PgxFuture<java.lang.Boolean> isPublishedAsync()
Checks if this property is published.- Returns:
true
if this property is published,false
otherwise.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classPgxManagedObject
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classPgxManagedObject
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
sizeAsync
public PgxFuture<java.lang.Long> sizeAsync()
Gets the size/length of this property.- Returns:
- the size of the property.
-
getAsync
public PgxFuture<V> getAsync(ID id)
Gets the property value.- Parameters:
id
- the id of the property- Returns:
- property value
-
getAsync
public PgxFuture<V> getAsync(K key)
Gets the property value.- Parameters:
key
- the key of the property- Returns:
- property value
-
getValuesAsync
public PgxFuture<EntryIterable<ID,K,V>> getValuesAsync()
Gets the values.- Returns:
- an iterable of the values
-
getTopKValuesAsync
public PgxFuture<EntryIterable<ID,K,V>> getTopKValuesAsync(int k)
Gets the top k vertex/edge value pairs according to their value.- Parameters:
k
- how many top values to retrieve, must be in the range between 0 and number of nodes/edges (inclusive)- Returns:
- iterable over the values
-
getBottomKValuesAsync
public PgxFuture<EntryIterable<ID,K,V>> getBottomKValuesAsync(int k)
Gets the bottom k vertex/edge value pairs according to their value.- Parameters:
k
- how many bottom values to retrieve, must be in the range between 0 and number of nodes/edges (inclusive)- Returns:
- iterable over the values
-
wrap
public static <V> V wrap(V value, PropertyType type, PgxGraph graph)
-
set
public void set(K key, V value)
Blocking version ofsetAsync(PgxEntity, Object)
. CallssetAsync(PgxEntity, Object)
and waits for the returnedPgxFuture
to complete.
-
setValues
public void setValues(java.util.Map<K,V> values)
Blocking version ofsetValuesAsync(Map)
. CallssetValuesAsync(Map)
and waits for the returnedPgxFuture
to complete.
-
setValues
public void setValues(java.util.Map<K,V> values, V defaultValue)
Blocking version ofsetValuesAsync(Map, Object)
. CallssetValuesAsync(Map, Object)
and waits for the returnedPgxFuture
to complete.
-
fill
public void fill(V value) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Blocking version offillAsync(Object)
. CallsfillAsync(Object)
and waits for the returnedPgxFuture
to complete.- Throws:
java.lang.InterruptedException
- if the caller thread gets interrupted while waiting for completion.java.util.concurrent.ExecutionException
- if any exception occurred during asynchronous execution. The actual exception will be nested.
-
rename
public void rename(java.lang.String newPropertyName)
Blocking version ofrenameAsync(String)
. CallsrenameAsync(String)
and waits for the returnedPgxFuture
to complete.
-
size
public long size()
Blocking version ofsizeAsync()
. CallssizeAsync()
and waits for the returnedPgxFuture
to complete.
-
get
public V get(ID id)
Blocking version ofgetAsync(Object)
. CallsgetAsync(Object)
and waits for the returnedPgxFuture
to complete.
-
get
public V get(K key)
Blocking version ofgetAsync(PgxEntity)
. CallsgetAsync(PgxEntity)
and waits for the returnedPgxFuture
to complete.
-
getValues
public EntryIterable<ID,K,V> getValues()
Blocking version ofgetValuesAsync()
. CallsgetValuesAsync()
and waits for the returnedPgxFuture
to complete.
-
getTopKValues
public EntryIterable<ID,K,V> getTopKValues(int k)
Blocking version ofgetTopKValuesAsync(int)
. CallsgetTopKValuesAsync(int)
and waits for the returnedPgxFuture
to complete.
-
getBottomKValues
public EntryIterable<ID,K,V> getBottomKValues(int k)
Blocking version ofgetBottomKValuesAsync(int)
. CallsgetBottomKValuesAsync(int)
and waits for returnedPgxFuture
to complete.
-
publish
public void publish()
-
isPublished
public boolean isPublished()
Blocking version ofisPublished()
. CallsisPublished()
and waits for returnedPgxFuture
to complete.
-
-