Package io.tiledb.java.api
Class Group
- java.lang.Object
-
- io.tiledb.java.api.Group
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class Group extends java.lang.Object implements java.lang.AutoCloseable
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMember(java.lang.String uri, boolean relative, java.lang.String name)
Add a member to a group.void
close()
Close resourcesvoid
consolidateMetadata(Config config)
Consolidates the group metadata into a single group metadata file.static void
create(Context ctx, java.lang.String uri)
Creates a new group.void
deleteMetadata(java.lang.String key)
It deletes a metadata key-value item from an open group.void
dumpStr(java.lang.String string, boolean flag)
Dump a string representation of a groupConfig
getConfig()
Gets the group config.protected Context
getCtx()
Gets the Context.protected SWIGTYPE_p_tiledb_group_t
getGroupp()
Gets group pointer.long
getMemberCount()
Get the count of members in a group.java.lang.String
getMemberNameByIndex(java.math.BigInteger index)
Get the name of a member of a group by index and details of groupjava.lang.String
getMemberURIByIndex(java.math.BigInteger index)
Get the URI of a member of a group by index and details of groupjava.lang.String
getMemberURIByName(java.lang.String name)
Get the URI of a member of a group by nameNativeArray
getMetadata(java.lang.String key, Datatype nativeType)
It gets a metadata key-value item from an open group.Pair<java.lang.String,NativeArray>
getMetadataFromIndex(java.math.BigInteger index)
Gets a metadata item from an open group using an index.java.math.BigInteger
getMetadataNum()
Gets the number of metadata items in an open group.java.lang.String
getUri()
Returns the URI of the groupjava.lang.Boolean
hasMetadataKey(java.lang.String key)
Checks if the key is present in the group metadata.boolean
isOpen()
Check if the group is open.void
putMetadata(java.lang.String key, NativeArray value)
* It puts a metadata key-value item to an open group.void
removeMember(java.lang.String uri)
Remove a member from a group.void
reopen(Context ctx, QueryType queryType)
Reopens a TileDB group (the group must be already open).void
setConfig(Config config)
Sets the group config.void
vacuumMetadata(Config config)
Cleans up the group metadata Note that this will coarsen the granularity of time traveling (see docs for more information).
-
-
-
Constructor Detail
-
Group
public Group(Context ctx, java.lang.String uri, QueryType queryType) throws TileDBError
- Throws:
TileDBError
-
-
Method Detail
-
getGroupp
protected SWIGTYPE_p_tiledb_group_t getGroupp()
Gets group pointer.- Returns:
- the group pointer
-
getCtx
protected Context getCtx()
Gets the Context.- Returns:
- the context
-
setConfig
public void setConfig(Config config) throws TileDBError
Sets the group config.- Parameters:
config
- the configuration to set.- Throws:
TileDBError
-
deleteMetadata
public void deleteMetadata(java.lang.String key) throws TileDBError
It deletes a metadata key-value item from an open group. The group must be opened in WRITE mode, otherwise the function will error out.- Parameters:
key
- the key to delete.- Throws:
TileDBError
-
getMetadata
public NativeArray getMetadata(java.lang.String key, Datatype nativeType) throws TileDBError
It gets a metadata key-value item from an open group. The group must be opened in READ mode, otherwise the function will error out.- Parameters:
key
- the keynativeType
- the datatype of the value.- Returns:
- Throws:
TileDBError
-
getConfig
public Config getConfig() throws TileDBError
Gets the group config.- Returns:
- the group config.
- Throws:
TileDBError
-
getMetadataNum
public java.math.BigInteger getMetadataNum() throws TileDBError
Gets the number of metadata items in an open group. The array must be opened in READ mode, otherwise the function will error out.- Returns:
- the number of metadata items
- Throws:
TileDBError
- A TileDB exception
-
getMemberCount
public long getMemberCount() throws TileDBError
Get the count of members in a group.- Returns:
- the number of members in a group.
- Throws:
TileDBError
-
getMemberURIByIndex
public java.lang.String getMemberURIByIndex(java.math.BigInteger index) throws TileDBError
Get the URI of a member of a group by index and details of group- Parameters:
index
- the index of the member.- Returns:
- the corresponding member in the group.
- Throws:
TileDBError
-
getMemberURIByName
public java.lang.String getMemberURIByName(java.lang.String name) throws TileDBError
Get the URI of a member of a group by name- Parameters:
name
- the name of the member- Returns:
- the URI of the member with the given name
- Throws:
TileDBError
-
getMemberNameByIndex
public java.lang.String getMemberNameByIndex(java.math.BigInteger index) throws TileDBError
Get the name of a member of a group by index and details of group- Parameters:
index
- the index of the member.- Returns:
- the corresponding member in the group.
- Throws:
TileDBError
-
addMember
public void addMember(java.lang.String uri, boolean relative, java.lang.String name) throws TileDBError
Add a member to a group.- Parameters:
uri
- The uri of the member to add.relative
- is the URI relative to the group.name
- name of member, The caller takes ownership of the c-string. NULL if name was not set- Throws:
TileDBError
-
removeMember
public void removeMember(java.lang.String uri) throws TileDBError
Remove a member from a group.- Parameters:
uri
- The URI of the member to remove.- Throws:
TileDBError
-
dumpStr
public void dumpStr(java.lang.String string, boolean flag) throws TileDBError
Dump a string representation of a group- Parameters:
string
- The string.flag
- is recursive.- Throws:
TileDBError
-
getMetadataFromIndex
public Pair<java.lang.String,NativeArray> getMetadataFromIndex(java.math.BigInteger index) throws TileDBError
Gets a metadata item from an open group using an index. The array must be opened in READ mode, otherwise the function will error out.- Parameters:
index
- index to retrieve metadata from- Returns:
- a pair, key and the metadata
- Throws:
TileDBError
- A TileDB exception
-
hasMetadataKey
public java.lang.Boolean hasMetadataKey(java.lang.String key) throws TileDBError
Checks if the key is present in the group metadata. The array must be opened in READ mode, otherwise the function will error out.- Parameters:
key
- a key to retrieve from the metadata key-value- Returns:
- true if the key is present in the metadata, false if it is not
- Throws:
TileDBError
- A TileDB exception
-
isOpen
public boolean isOpen() throws TileDBError
Check if the group is open.- Returns:
- True if the group is open.
- Throws:
TileDBError
-
putMetadata
public void putMetadata(java.lang.String key, NativeArray value) throws TileDBError
* It puts a metadata key-value item to an open group. The group must * be opened in WRITE mode, otherwise the function will error out.- Parameters:
key
- The key of the metadata item to be added.value
- The metadata value.- Throws:
TileDBError
-
vacuumMetadata
public void vacuumMetadata(Config config) throws TileDBError
Cleans up the group metadata Note that this will coarsen the granularity of time traveling (see docs for more information).- Parameters:
config
- Configuration parameters for the vacuuming. (`null` means default, which will use the config from `ctx`).- Throws:
TileDBError
-
consolidateMetadata
public void consolidateMetadata(Config config) throws TileDBError
Consolidates the group metadata into a single group metadata file.- Parameters:
config
- Configuration parameters for the vacuuming. (`null` means default, which will use the config from `ctx`).- Throws:
TileDBError
-
close
public void close()
Close resources- Specified by:
close
in interfacejava.lang.AutoCloseable
-
getUri
public java.lang.String getUri() throws TileDBError
Returns the URI of the group- Returns:
- The URI of the group.
- Throws:
TileDBError
- A TileDB exception
-
reopen
public void reopen(Context ctx, QueryType queryType) throws TileDBError
Reopens a TileDB group (the group must be already open). This is useful when the group got updated after it got opened or when the user wants to reopen with a different queryType.- Parameters:
queryType
- the queryType that will be used when the group opens.- Throws:
TileDBError
-
create
public static void create(Context ctx, java.lang.String uri) throws TileDBError
Creates a new group. A Group is a logical grouping of TileDB objects on the storage system with the sample path prefix.- Parameters:
ctx
- The TileDB context.uri
- The group URI.- Throws:
TileDBError
- A TileDB exception
-
-