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 Deprecated Methods Modifier and Type Method Description voidaddMember(java.lang.String uri, boolean relative, java.lang.String name)Add a member to a group.voidclose()Close resourcesvoidconsolidateMetadata(Config config)Consolidates the group metadata into a single group metadata file.static voidcreate(Context ctx, java.lang.String uri)Creates a new group.voiddelete(short recursive)Deletes written data from an open group.voiddeleteMetadata(java.lang.String key)It deletes a metadata key-value item from an open group.voiddumpStr(java.lang.String string, boolean flag)Dump a string representation of a groupConfiggetConfig()Gets the group config.protected ContextgetCtx()Gets the Context.protected SWIGTYPE_p_tiledb_group_handle_tgetGroupp()Gets group pointer.booleangetIsRelativeURIByName(java.lang.String name)Get a member of a group by name and relative characteristic of that namejava.lang.StringgetMemberByIndexV2(java.math.BigInteger index)Get the URI of a member of a group by index and details of groupjava.lang.StringgetMemberByNameV2(java.lang.String name)Get the URI of a member of a group by namelonggetMemberCount()Get the count of members in a group.java.lang.StringgetMemberURIByIndex(java.math.BigInteger index)Deprecated.java.lang.StringgetMemberURIByName(java.lang.String name)Deprecated.NativeArraygetMetadata(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.BigIntegergetMetadataNum()Gets the number of metadata items in an open group.QueryTypegetQueryType()Returns the query typejava.lang.StringgetUri()Returns the URI of the groupjava.lang.BooleanhasMetadataKey(java.lang.String key)Checks if the key is present in the group metadata.booleanisOpen()Check if the group is open.voidputMetadata(java.lang.String key, NativeArray value)* It puts a metadata key-value item to an open group.voidremoveMember(java.lang.String nameOrUri)Remove a member from a group.voidreopen(Context ctx, QueryType queryType)Reopens a TileDB group (the group must be already open).voidsetConfig(Config config)Sets the group config.voidvacuumMetadata(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_handle_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
-
getQueryType
public QueryType getQueryType()
Returns the query type- Returns:
- The query type
-
deleteMetadata
public void deleteMetadata(java.lang.String key) throws TileDBErrorIt 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 TileDBErrorGets 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 TileDBErrorGet the count of members in a group.- Returns:
- the number of members in a group.
- Throws:
TileDBError
-
getMemberByIndexV2
public java.lang.String getMemberByIndexV2(java.math.BigInteger index) throws TileDBErrorGet 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
-
getMemberByNameV2
public java.lang.String getMemberByNameV2(java.lang.String name) throws TileDBErrorGet 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
-
getMemberURIByName
@Deprecated public java.lang.String getMemberURIByName(java.lang.String name) throws TileDBErrorDeprecated.- Throws:
TileDBError
-
getMemberURIByIndex
@Deprecated public java.lang.String getMemberURIByIndex(java.math.BigInteger index) throws TileDBErrorDeprecated.- Throws:
TileDBError
-
addMember
public void addMember(java.lang.String uri, boolean relative, java.lang.String name) throws TileDBErrorAdd 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 nameOrUri) throws TileDBErrorRemove a member from a group.- Parameters:
nameOrUri- The name or URI of the member to remove- Throws:
TileDBError
-
dumpStr
public void dumpStr(java.lang.String string, boolean flag) throws TileDBErrorDump 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 TileDBErrorChecks 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 TileDBErrorCheck 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
-
getIsRelativeURIByName
public boolean getIsRelativeURIByName(java.lang.String name) throws TileDBErrorGet a member of a group by name and relative characteristic of that name- Parameters:
name- name of member to fetch- Returns:
- True if relative
- 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:
closein interfacejava.lang.AutoCloseable
-
getUri
public java.lang.String getUri() throws TileDBErrorReturns 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
-
delete
public void delete(short recursive) throws TileDBErrorDeletes written data from an open group. The group must be opened in MODIFY_EXCLUSIVE mode, otherwise the function will error out.- Parameters:
recursive- 1 if all data inside the group is to be deleted- Throws:
TileDBError
-
-