public class ArraySchema
extends java.lang.Object
implements java.lang.AutoCloseable
The ArraySchema is an independent description of an array. A schema can be used to create multiple array's, and stores information about its domain, cell types, and compression details. An array schema is composed of:
Context ctx = new Context();
ArraySchema schema = new ArraySchema(ctx, TILEDB_SPARSE);
// Create a Domain
Domain<Integer> domain = new Domain<Integer>(ctx);
// Create Attribute
Attribute<Integer> a1 = new Attribute<Integer>(ctx, "a1", Integer.class);
schema.setDomain(domain);
schema.addAttribute(a1);
// Specify tile memory layout
schema.setTileOrder(TILEDB_GLOBAL_ORDER);
// Specify cell memory layout within each tile
schema.setCellOrder(TILEDB_GLOBAL_ORDER);
schema.setCapacity(10); // For sparse, set capacity of each tile
// Make array with schema
Array my_dense_array = new Array(ctx, "my_array", schema);
// Load schema from array
ArraySchema s = ArraySchema(ctx, "my_array"); // Load schema from array
Modifier | Constructor and Description |
---|---|
|
ArraySchema(Context ctx,
ArrayType type)
Creates a new TileDB ArraySchema object
|
|
ArraySchema(Context ctx,
java.lang.String uri)
Loads the ArraySchema of an existing array with the given URI string.
|
|
ArraySchema(Context ctx,
java.lang.String uri,
EncryptionType encryption_type,
byte[] key)
Loads the encrypted ArraySchema of an existing array with the given URI string.
|
protected |
ArraySchema(Context ctx,
SWIGTYPE_p_p_tiledb_array_schema_t schemapp) |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Attribute attr)
Adds an Attribute to the array.
|
void |
check()
Validates the schema, throws a TileDBError if the ArraySchema is invalid.
|
void |
close()
Free's native TileDB resources associated with the ArraySchema object
|
void |
dump()
Dumps the array schema in an ASCII representation to STDOUT.
|
void |
dump(java.lang.String filename)
Dumps the array schema text representation to a file.
|
int |
getAllowDups()
Checks wether duplicate coordinates are allowed in the array schema
|
ArrayType |
getArrayType()
Returns the type of the TileDB Array
|
Attribute |
getAttribute(long index)
Get an Attribute by index
|
Attribute |
getAttribute(java.lang.String name)
Get an Attribute by name
|
long |
getAttributeNum() |
java.util.HashMap<java.lang.String,Attribute> |
getAttributes()
Get all Attributes of the array.
|
long |
getCapacity()
Returns the tile capacity for the array.
|
Layout |
getCellOrder()
Returns the cell layout for the array schema.
|
FilterList |
getCoordsFilterList()
Returns a copy of the FilterList of the coordinates.
|
Context |
getCtx() |
Domain |
getDomain() |
FilterList |
getOffsetsFilterList()
Returns a copy of the FilterList of the offsets.
|
protected SWIGTYPE_p_tiledb_array_schema_t |
getSchemap() |
Layout |
getTileOrder()
Returns the tile layout order.
|
boolean |
hasAttribute(java.lang.String name)
Checks if the ArraySchema has the given attribute with name
|
boolean |
isSparse()
Returns true if the array schema describes a sparse array
|
void |
setAllowDups(int allowsDups)
Sets whether the array can allow coordinate duplicates or not.
|
void |
setCapacity(java.math.BigInteger capacity)
Sets the tile capacity.
|
void |
setCapacity(long capacity)
Sets the tile capacity.
|
ArraySchema |
setCellOrder(Layout layout)
Sets the cell order for the array schema.
|
ArraySchema |
setCoodsFilterList(FilterList filterList)
Sets the FilterList for the coordinates, which is an ordered list of filters that will be used
to process and/or transform the coordinate data (such as compression).
|
void |
setDomain(Domain domain)
Sets the array Domain.
|
ArraySchema |
setOffsetsFilterList(FilterList filterList)
Sets the FilterList for the offsets, which is an ordered list of filters that will be used to
process and/or transform the offsets data (such as compression).
|
ArraySchema |
setTileOrder(Layout layout)
Sets the tile order.
|
java.lang.String |
toString() |
public ArraySchema(Context ctx, ArrayType type) throws TileDBError
Example:
Context ctx = new Context();
ArraySchema schema = new ArraySchema(ctx, TILEDB_SPARSE);
ctx
- TileDB contexttype
- Array type, sparse or denseTileDBError
- A TileDB exceptionprotected ArraySchema(Context ctx, SWIGTYPE_p_p_tiledb_array_schema_t schemapp)
public ArraySchema(Context ctx, java.lang.String uri) throws TileDBError
Example:
Context ctx = new Context();
ArraySchema schema = new ArraySchema(ctx, "s3://bucket-name/array-name");
ctx
- TileDB contexturi
- URI string of arrayTileDBError
- A TileDB exceptionpublic ArraySchema(Context ctx, java.lang.String uri, EncryptionType encryption_type, byte[] key) throws TileDBError
Example:
Context ctx = new Context();
String key = "0123456789abcdeF0123456789abcdeF";
ArraySchema schema = new ArraySchema(ctx, "s3://bucket-name/array-name"
TILEDB_AES_GCM_256,
key.getBytes(StandardCharsets.UTF_8));
ctx
- TileDB contexturi
- URI of TileDB Arrayencryption_type
- Encryption type of the array schemakey
- Encryption key used to decrypt the array schemaTileDBError
- A TileDB exceptionpublic void dump() throws TileDBError
TileDBError
- A TileDB exceptionpublic void dump(java.lang.String filename) throws TileDBError
filename
- The local file path to save the schema text representationTileDBError
- A TileDB exceptionpublic ArrayType getArrayType() throws TileDBError
TileDBError
- A TileDB exceptionpublic boolean isSparse() throws TileDBError
TileDBError
- A TileDB exceptionpublic long getCapacity() throws TileDBError
TileDBError
- A TileDB exceptionpublic void setCapacity(long capacity) throws TileDBError
capacity
- Capacity value to setTileDBError
- A TileDB exceptionpublic void setCapacity(java.math.BigInteger capacity) throws TileDBError
capacity
- value to setTileDBError
- A Tpublic Layout getTileOrder() throws TileDBError
TileDBError
- A TileDB exceptionpublic ArraySchema setTileOrder(Layout layout) throws TileDBError
layout
- tile Layout orderTileDBError
- A TileDB exceptionpublic Layout getCellOrder() throws TileDBError
TileDBError
- A TileDB exceptionpublic ArraySchema setCellOrder(Layout layout) throws TileDBError
layout
- cell Layout orderTileDBError
- A TileDB exceptionpublic Domain getDomain() throws TileDBError
TileDBError
- A TileDB exceptionpublic void setDomain(Domain domain) throws TileDBError
Example:
Context ctx = new Context();
ArraySchema schema = new ArraySchema(ctx, TILEDB_SPARSE);
// Create a Domain
Domain domain = new Domain(ctx);
domain.addDimension(...);
schema.setDomain(domain);
domain
- Domain to useTileDBError
- A TileDB exceptionpublic void addAttribute(Attribute attr) throws TileDBError
Example:
Context ctx = new Context();
ArraySchema schema = new ArraySchema(ctx, TILEDB_SPARSE);
Attribute attr = new Attribute(ctx, "a", Integer.class);
schema.addAttribute(attr);
attr
- The Attribute to addTileDBError
- A TileDB exceptionpublic void check() throws TileDBError
TileDBError
- A TileDB exceptionpublic java.util.HashMap<java.lang.String,Attribute> getAttributes() throws TileDBError
TileDBError
- A TileDB exceptionpublic long getAttributeNum() throws TileDBError
TileDBError
- A TileDB exceptionpublic boolean hasAttribute(java.lang.String name) throws TileDBError
name
- The name of the attributeTileDBError
public Attribute getAttribute(java.lang.String name) throws TileDBError
name
- The name of the attribute.TileDBError
- A TileDB exceptionpublic Attribute getAttribute(long index) throws TileDBError
index
- The attribute index.TileDBError
- A TileDB exceptionpublic ArraySchema setCoodsFilterList(FilterList filterList) throws TileDBError
filterList
- FilterList to useTileDBError
- A TileDB exceptionpublic FilterList getCoordsFilterList() throws TileDBError
TileDBError
- A TileDB exceptionpublic ArraySchema setOffsetsFilterList(FilterList filterList) throws TileDBError
filterList
- FilterList to useTileDBError
- A TileDB exceptionpublic FilterList getOffsetsFilterList() throws TileDBError
TileDBError
- A TileDB exceptionpublic void setAllowDups(int allowsDups) throws TileDBError
allowsDups
- The allowDups parameter, which allows duplicate coordinates to be inserted
it's set to `1`TileDBError
public int getAllowDups() throws TileDBError
TileDBError
protected SWIGTYPE_p_tiledb_array_schema_t getSchemap()
public Context getCtx()
public java.lang.String toString()
toString
in class java.lang.Object
public void close()
close
in interface java.lang.AutoCloseable