Class Graph
Each Database has a Graph associated, which is the persistent graph which contains all data stored into the graph database and is retrieved from a Session.
Check out the 'API' and the 'SPARKSEE graph database' sections in the SPARKSEE User Manual for more details on the use of this class.
- Author:
- Sparsity Technologies http://www.sparsity-technologies.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidDumps all the data to a backup file.longGets the number of edges.longGets the number of nodes.longdegree(long oid, int etype, EdgesDirection dir) Gets the number of edges from or to the given node OID and for the given edge type.voiddrop(long oid) Drops the given OID.voidDrops all the OIDs from the given collection.voidDumps logical data to a file.voiddumpStorage(String file) Dumps internal storage data to a file.edges(int etype, long tail, long head) Gets all the edges of the given type between two given nodes (tail and head).voidencryptedBackup(String file, String keyInHex, String ivInHex) Dumps all the data to a backup file.explode(long oid, int etype, EdgesDirection dir) Selects all edges from or to the given node OID and for the given edge type.explode(Objects objs, int etype, EdgesDirection dir) Selects all edges from or to each of the node OID in the given collection and for the given edge type.voidexport(String file, ExportType type, ExportManager em) Exports the Graph.intfindAttribute(int type, String name) Gets the Sparksee attribute identifier for the given type identifier and attribute name.findAttributes(int type) Gets all existing Sparksee attribute identifiers for the given type identifier.longfindEdge(int etype, long tail, long head) Gets any of the edges of the given type between two given nodes (tail and head).Gets all existing Sparksee edge type identifiers.Gets all existing Sparksee node type identifiers.longfindObject(int attr, Value value) Finds one object having the given Value for the given attribute.longfindOrCreateEdge(int etype, long tail, long head) Gets any of the edges of the specified type between two given nodes (tail and head).longfindOrCreateObject(int attr, Value value) Finds one object having the given Value for the attribute or it creates one does not exist any.intGets the Sparksee type identifier for the given type name.Gets all existing Sparksee node and edge type identifiers.getArrayAttribute(long oid, int attr) Gets the ValueArray for the given array attribute and OID or NULL if it does not exist.getAttribute(int attr) Gets information about the given attribute.getAttribute(long oid, int attr) Gets the Value for the given attribute and OID.voidgetAttribute(long oid, int attr, Value value) Gets the Value for the given attribute and OID.longgetAttributeIntervalCount(int attr, Value lower, boolean includeLower, Value higher, boolean includeHigher) Gets how many objects have a value into the given range for the given attribute.getAttributes(long oid) Gets all Sparksee attribute identifiers with a non-NULL value for the given Sparksee OID.getAttributes(long oid, boolean withValues, boolean withNames) Gets all Sparksee attribute identifiers with a non-NULL value for the given Sparksee OID.getAttributeStatistics(int attr, boolean basic) Gets statistics from the given attribute.getAttributeText(long oid, int attr) Gets the read-only TextStream for the given text attribute and OID.getEdgeData(long edge) Gets information about an edge.longgetEdgePeer(long edge, long node) Gets the other end for the given edge.intgetObjectType(long oid) Gets the Sparksee node or edge type identifier for the given OID.Gets the Session this Graph belongs to.getType(int type) Gets information about the given type.getValues(int attr) Gets the Value collection for the given attribute.Gets all the heads from the given edges collection.voidindexAttribute(int attr, AttributeKind kind) Updates the index of the given attribute.voidindexNeighbors(int edgeType, boolean neighbors) Creates or destroys the neighbors index of an edge type.neighbors(long oid, int etype, EdgesDirection dir) Selects all neighbor nodes from or to the given node OID and for the given edge type.neighbors(Objects objs, int etype, EdgesDirection dir) Selects all neighbor nodes from or to each of the node OID in the given collection and for the given edge type.intnewArrayAttribute(int type, String name, DataType dt, int size) Creates a new array attribute.intnewAttribute(int type, String name, DataType dt, AttributeKind kind) Creates a new attribute.intnewAttribute(int type, String name, DataType dt, AttributeKind kind, Value defaultValue) Creates a new attribute with a default value.longCreates a new edge instance.longnewEdge(int type, long tail, long head) Creates a new edge instance.intnewEdgeType(String name, boolean directed, boolean neighbors) Creates a new edge type.longnewNode(int type) Creates a new node instance.intnewNodeType(String name) Creates a new node type.intnewRestrictedEdgeType(String name, int tail, int head, boolean neighbors) Creates a new restricted edge type.intnewSessionArrayAttribute(int type, DataType dt, int size) Creates a new Session array attribute.intnewSessionAttribute(int type, DataType dt, AttributeKind kind) Creates a new Session attribute.intnewSessionAttribute(int type, DataType dt, AttributeKind kind, Value defaultValue) Creates a new Session attribute with a default value.voidremoveAttribute(int attr) Removes the given attribute.voidremoveType(int type) Removes the given type.voidrenameAttribute(int attr, String newName) Renames an attribute.voidrenameType(int type, String newName) Renames a type.voidrenameType(String oldName, String newName) Renames a type.select(int type) Selects all OIDs belonging to the given type.Selects all OIDs satisfying the given condition for the given attribute.Selects all OIDs satisfying the given condition for the given attribute.Selects all OIDs satisfying the given condition for the given attribute.Selects all OIDs satisfying the given condition for the given attribute.voidsetArrayAttribute(int attr, Value value) Sets all the values of the array of the given array attribute for all the objects of the types the attribute applies to.setArrayAttribute(long oid, int attr, Value value) Sets all the elements of the ValueArray for the given array attribute and OID and returns it.voidsetArrayAttributeVoid(long oid, int attr, Value value) Sets all the elements of the ValueArray for the given array attribute and OID.voidsetAttribute(int attr, Value value) Sets the value of the given attribute for all the objects of the types the attribute applies to.voidsetAttribute(long oid, int attr, Value value) Sets the Value for the given attribute and OID.voidsetAttributeDefaultValue(int attr, Value value) Sets a default value for an attribute.voidsetAttributeText(long oid, int attr, TextStream tstream) Sets the writable TextStream for the given text attribute and OID.Gets all the tails from the given edges collection.voidtailsAndHeads(Objects edges, Objects tails, Objects heads) Gets all the tails and heads from the given edges collection.Gets a KeyValues iterator as a result of the TopK operation.Gets a KeyValues iterator as a result of the TopK operation.Gets a KeyValues iterator as a result of the TopK operation.topK(int attribute, Condition operation, Value lower, Value higher, Order order, int k, Objects restriction) Gets a KeyValues iterator as a result of the TopK operation.Gets a KeyValues iterator as a result of the TopK operation.Gets a KeyValues iterator as a result of the TopK operation.
-
Method Details
-
findOrCreateEdge
public long findOrCreateEdge(int etype, long tail, long head) Gets any of the edges of the specified type between two given nodes (tail and head).If it can not find any edge of this type between them it tries to create a new one.
- Parameters:
etype- [in] Sparksee edge type identifier.tail- [in] Tail node identifier.head- [in] Head node identifier.- Returns:
- Any of the edges or the Objects InvalidOID.
-
findEdgeTypes
Gets all existing Sparksee edge type identifiers.- Returns:
- Sparksee edge type identifier list.
-
getAttributeIntervalCount
public long getAttributeIntervalCount(int attr, Value lower, boolean includeLower, Value higher, boolean includeHigher) Gets how many objects have a value into the given range for the given attribute.This only works for the attributes with the AttributeKind Indexed or Unique.
Given values must belong to the same DataType than the attribute.
- Parameters:
attr- [in] Sparksee attribute identifier.lower- [in] Lower bound Value of the range.includeLower- [in] If TRUE, include lower bound Value of the range.higher- [in] Higher bound Value of the range.includeHigher- [in] If TRUE, include higher bound Value of the range.- Returns:
- Number of objects having a value into the given range.
-
neighbors
Selects all neighbor nodes from or to each of the node OID in the given collection and for the given edge type.- Parameters:
objs- [in] Sparksee node OID collection.etype- [in] Sparksee edge type identifier.dir- [in] Direction.- Returns:
- Objects instance.
-
backup
Dumps all the data to a backup file.See the Sparksee class Restore methods. Errorfor other issues.
- Parameters:
file- [in] Output backup file path.- Throws:
RuntimeException- nullFileNotFoundException- If the given file cannot be created.
-
removeAttribute
public void removeAttribute(int attr) Removes the given attribute.- Parameters:
attr- [in] Sparksee attribute identifier.
-
removeType
public void removeType(int type) Removes the given type.This fails if there exist attributes defined for the type or if there exist restricted edges referencing this type.
- Parameters:
type- [in] Sparksee type identifier.
-
degree
Gets the number of edges from or to the given node OID and for the given edge type.- Parameters:
oid- [in] Sparksee node OID.etype- [in] Sparksee edge type identifier.dir- [in] Direction.- Returns:
- The number of edges.
-
findTypes
Gets all existing Sparksee node and edge type identifiers.- Returns:
- Sparksee node and edge type identifier list.
-
newArrayAttribute
Creates a new array attribute.- Parameters:
type- [in] Sparksee node or edge type identifier.name- [in] Unique name for the new attribute.dt- [in] Base Data type for the new array attribute elements.size- [in] The array size.- Returns:
- Unique Sparksee attribute identifier.
-
findType
Gets the Sparksee type identifier for the given type name.- Parameters:
name- [in] Unique type name.- Returns:
- The Sparksee type identifier for the given type name or the Type InvalidType if there is no type with the given name.
-
topK
Gets a KeyValues iterator as a result of the TopK operation.- Parameters:
attribute- The attribute to perform the TopK onoperation- The operation to perform in the top klower- The lower bound Value to be satisfiedorder- The ordering semantincs of the top-kk- The size of the TopK- Returns:
- A KeyValues instance
-
getEdgePeer
public long getEdgePeer(long edge, long node) Gets the other end for the given edge.- Parameters:
edge- [in] Sparksee edge identifier.node- [in] Sparksee node identifier. It must be one of the ends of the edge.- Returns:
- The other end of the edge.
-
setAttributeText
Sets the writable TextStream for the given text attribute and OID.- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee attribute identifier.tstream- [in] New Text value. This corresponds to a TextStream to write.
-
setAttribute
Sets the value of the given attribute for all the objects of the types the attribute applies to.Does not work for TEXT attribute types
txThe Transaction this operation belongs to attributeThe attribute to initialize
- Parameters:
attr- nullvalue- The value to initialize the attribute to
-
indexNeighbors
public void indexNeighbors(int edgeType, boolean neighbors) Creates or destroys the neighbors index of an edge type.- Parameters:
edgeType- [in] Sparksee Edge type identifier.neighbors- [in] If TRUE, it indexes the neighbor nodes, otherwise it removes the index.
-
getObjectType
public int getObjectType(long oid) Gets the Sparksee node or edge type identifier for the given OID.- Parameters:
oid- [in] Sparksee OID.- Returns:
- Sparksee node or edge type identifier.
-
indexAttribute
Updates the index of the given attribute.This just works if the current index of the attribute corresponds to the AttributeKind Basic and the new one is Indexed or Unique.
- Parameters:
attr- [in] Sparksee attribute identifier.kind- [in] Attribute kind.
-
setArrayAttribute
Sets all the values of the array of the given array attribute for all the objects of the types the attribute applies to.- Parameters:
attr- [in] Sparksee array attribute identifier.value- [in] Value for all the array elements of the arrays.
-
topK
-
getAttribute
Gets the Value for the given attribute and OID.- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee attribute identifier.value- [in|out] Value for the given attribute and for the given OID.
-
getAttributeStatistics
Gets statistics from the given attribute.The statistics can only be obtained from Indexed or Unique attributes.
- Parameters:
attr- [in] Sparksee attribute identifier.basic- [in] If FALSE all statistics are computed, if TRUE just those statistics marked as basic will be computed (see description of the AttributeStatistics class). Of course, computing just basic statistics will be faster than computing all of them.- Returns:
- An AttributeStatistics instace.
-
select
Selects all OIDs satisfying the given condition for the given attribute.This allows to perform the Between operation, thus it has two Value arguments.
- Parameters:
attr- [in] Sparksee attribute identifier.cond- [in] Condition to be satisfied. It must be the Between Condition.lower- [in] Lower-bound Value to be satisfied.higher- [in] Higher-bound Value to be satisfied.restriction- [in] Objects to limit the select in this set of objects.- Returns:
- Objects instance.
-
countNodes
public long countNodes()Gets the number of nodes.- Returns:
- The number of nodes.
-
topK
public KeyValues topK(int attribute, Condition operation, Value lower, Order order, int k, Objects restriction) Gets a KeyValues iterator as a result of the TopK operation.restrictonObjects to limit the topk to this set of objects
- Parameters:
attribute- The attribute to perform the TopK onoperation- The operation to perform in the top klower- The lower bound Value to be satisfiedorder- The ordering semantincs of the top-kk- The size of the TopKrestriction- null- Returns:
- A KeyValues instance
-
setAttributeDefaultValue
Sets a default value for an attribute.The default value will be applied to all the new nodes or edges.
The given value must have the same DataType as the attribute or be a NULL value to remove the current default value.
- Parameters:
attr- [in] The attribute.value- [in] The default value to use for this attribute.
-
findObject
Finds one object having the given Value for the given attribute.If there are more than one, then any of them will be returned. And in case there are no object having this Value, the Objects InvalidOID will be returned.
- Parameters:
attr- [in] Sparksee attribute identifier.value- [in] Value.- Returns:
- Sparksee OID or the Objects InvalidOID.
-
neighbors
Selects all neighbor nodes from or to the given node OID and for the given edge type.- Parameters:
oid- [in] Sparksee node OID.etype- [in] Sparksee edge type identifier.dir- [in] Direction.- Returns:
- Objects instance.
-
newSessionAttribute
Creates a new Session attribute.Session attributes are exclusive for the Session (just its Session can use the attribute) and are automatically removed when the Session is closed (thus, attribute data is not persistent into the database).
Since they are not persistent, they cannot be retrieved from the database, so they do not have an identifier name.
- Parameters:
type- [in] Sparksee node or edge type identifier.dt- [in] Data type for the new attribute.kind- [in] Attribute kind.- Returns:
- Unique Sparksee attribute identifier.
-
encryptedBackup
public void encryptedBackup(String file, String keyInHex, String ivInHex) throws RuntimeException, FileNotFoundException Dumps all the data to a backup file.See the Sparksee class RestoreEncryptedBackup methods. Errorfor other issues.
- Parameters:
file- [in] Output backup file path.keyInHex- [In] The AES encryption Key as an hexadecimal string (8, 16 or 32 bytes).ivInHex- [In] The AES Initialization Vector as an hexadecimal string (16 bytes).- Throws:
RuntimeException- nullFileNotFoundException- If the given file cannot be created.
-
drop
public void drop(long oid) Drops the given OID.It also removes its egdges as well as its attribute values.
- Parameters:
oid- [in] Sparksee OID to be removed.
-
setArrayAttributeVoid
Sets all the elements of the ValueArray for the given array attribute and OID.Initializing the array with one of these SetArrayAttribute methods is the only way to create the array. But once created it can be updated using the ValueArray which can be obtained using the GetArrayAttribute operation.
- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee array attribute identifier.value- [in] Value for all the array elements of the given attribute and OID.
-
edges
Gets all the edges of the given type between two given nodes (tail and head).- Parameters:
etype- [in] Sparksee edge type identifier.tail- [in] Tail node identifier.head- [in] Head node identifier.- Returns:
- Objects instance.
-
setAttribute
Sets the Value for the given attribute and OID.- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee attribute identifier.value- [in] Value for the given attribute and for the given OID.
-
findEdge
public long findEdge(int etype, long tail, long head) Gets any of the edges of the given type between two given nodes (tail and head).If there are more than one, then any of them will be returned. And in case there are no edge between the given tail and head, the Objects InvalidOID will be returned.
- Parameters:
etype- [in] Sparksee edge type identifier.tail- [in] Tail node identifier.head- [in] Head node identifier.- Returns:
- Any of the edges or the Objects InvalidOID.
-
tails
-
select
Selects all OIDs satisfying the given condition for the given attribute.This allows to perform the Between operation, thus it has two Value arguments.
- Parameters:
attr- [in] Sparksee attribute identifier.cond- [in] Condition to be satisfied. It must be the Between Condition.lower- [in] Lower-bound Value to be satisfied.higher- [in] Higher-bound Value to be satisfied.- Returns:
- Objects instance.
-
getValues
Gets the Value collection for the given attribute.- Parameters:
attr- [in] Sparksee attribute identifier.- Returns:
- Returns a Values object.
-
export
Exports the Graph.- Parameters:
file- [in] Output file.type- [in] Export type.em- [in] Defines how to do the export for each graph object.- Throws:
IOException- for errors writing to the file.
-
newRestrictedEdgeType
Creates a new restricted edge type.- Parameters:
name- [in] Unique name for the new edge type.tail- [in] Tail Sparksee node type identifier.head- [in] Head Sparksee node type identifier.neighbors- [in] If TRUE, this indexes neighbor nodes, otherwise not.- Returns:
- Unique Sparksee type identifier.
-
getAttributeText
Gets the read-only TextStream for the given text attribute and OID.- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee attribute identifier.- Returns:
- A TextStream. This returns a TextStream to read.
-
explode
Selects all edges from or to each of the node OID in the given collection and for the given edge type.- Parameters:
objs- [in] Sparksee node OID collection.etype- [in] Sparksee edge type identifier.dir- [in] Direction.- Returns:
- Objects instance.
-
newEdgeType
Creates a new edge type.- Parameters:
name- [in] Unique name for the new edge type.directed- [in] If TRUE, this creates a directed edge type, otherwise this creates a undirected edge type.neighbors- [in] If TRUE, this indexes neighbor nodes, otherwise not.- Returns:
- Unique Sparksee type identifier.
-
topK
public KeyValues topK(int attribute, Condition operation, Value lower, Value higher, Order order, int k) Gets a KeyValues iterator as a result of the TopK operation.- Parameters:
attribute- The attribute to perform the TopK onoperation- The operation to perform in the top klower- The lower bound Value to be satisfiedhigher- The upper bound Value to be satisfiedorder- The ordering semantincs of the top-kk- The size of the TopK- Returns:
- A KeyValues instance
-
topK
Gets a KeyValues iterator as a result of the TopK operation.restrictonObjects to limit the topk to this set of objects
- Parameters:
attribute- The attribute to perform the TopK onorder- The ordering semantincs of the top-kk- The size of the TopKrestriction- null- Returns:
- A KeyValues instance
-
dumpData
Dumps logical data to a file.Errorfor other issues.
- Parameters:
file- [in] Output file path.- Throws:
RuntimeException- nullFileNotFoundException- If the given file cannot be created.
-
setArrayAttribute
Sets all the elements of the ValueArray for the given array attribute and OID and returns it.Initializing the array with one of these SetArrayAttribute methods is the only way to create the array. But once created it can be updated using the ValueArray. And you can get it again with the GetArrayAttribute operation.
- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee array attribute identifier.value- [in] Value for all the array elements of the given attribute and OID.- Returns:
- A ValueArray. This returns a ValueArray, a NULL or throws an exception.
-
topK
public KeyValues topK(int attribute, Condition operation, Value lower, Value higher, Order order, int k, Objects restriction) Gets a KeyValues iterator as a result of the TopK operation.restrictonObjects to limit the topk to this set of objects
- Parameters:
attribute- The attribute to perform the TopK onoperation- The operation to perform in the top klower- The lower bound Value to be satisfiedhigher- The upper bound Value to be satisfiedorder- The ordering semantincs of the top-kk- The size of the TopKrestriction- null- Returns:
- A KeyValues instance
-
findAttribute
Gets the Sparksee attribute identifier for the given type identifier and attribute name.- Parameters:
type- [in] Sparksee type identifier.name- [in] Unique attribute name.- Returns:
- The Sparksee attribute identifier for the given type and attribute name or InvalidAttribute if there is no attribute with the given name for the given type.
-
newNode
public long newNode(int type) Creates a new node instance.- Parameters:
type- [in] Sparksee type identifier.- Returns:
- Unique OID of the new node instance.
-
findNodeTypes
Gets all existing Sparksee node type identifiers.- Returns:
- Sparksee node type identifier list.
-
newAttribute
Creates a new attribute.- Parameters:
type- [in] Sparksee node or edge type identifier.name- [in] Unique name for the new attribute.dt- [in] Data type for the new attribute.kind- [in] Attribute kind.- Returns:
- Unique Sparksee attribute identifier.
-
newSessionArrayAttribute
Creates a new Session array attribute.Session attributes are exclusive for the Session (just its Session can use the attribute) and are automatically removed when the Session is closed (thus, attribute data is not persistent into the database).
Since they are not persistent, they cannot be retrieved from the database, so they do not have an identifier name.
- Parameters:
type- [in] Sparksee node or edge type identifier.dt- [in] Base Data type for the new array attribute elements.size- [in] The array size.- Returns:
- Unique Sparksee attribute identifier.
-
getAttributes
Gets all Sparksee attribute identifiers with a non-NULL value for the given Sparksee OID.Additional options can be set to also get it's Values and the names of the attributes. The Text and Array attributes will have the Value set to Null because they can't be represented as a simple Value object.
- Parameters:
oid- [in] Sparksee OID.withValues- [in] True to also get the Values of each attribute.withNames- [in] True to also get the Names of each attribute.- Returns:
- Sparksee attribute identifier list.
-
newEdge
Creates a new edge instance.The tail of the edge will be any node having the given tailV Value for the given tailAttr attribute identifier, and the head of the edge will be any node having the given headV Value for the given headAttr attribute identifier.
- Parameters:
type- [in] Sparksee type identifier.tailAttr- [in] Sparksee attribute identifier.tailV- [in] Value.headAttr- [in] Sparksee attribute identifier.headV- [in] Value.- Returns:
- Unique OID of the new edge instance.
-
getAttribute
Gets information about the given attribute.- Parameters:
attr- [in] Sparksee attribute identifier.- Returns:
- The Attribute for the given Sparksee attribute identifier.
-
getSession
Gets the Session this Graph belongs to.- Returns:
- The owning Session instance.
-
newNodeType
Creates a new node type.- Parameters:
name- [in] Unique name for the new node type.- Returns:
- Unique Sparksee type identifier.
-
dumpStorage
Dumps internal storage data to a file.Errorfor other issues.
- Parameters:
file- [in] Output file path.- Throws:
RuntimeException- nullFileNotFoundException- If the given file cannot be created.
-
select
Selects all OIDs belonging to the given type.- Parameters:
type- [in] Sparksee type identifier.- Returns:
- Objects instance.
-
select
Selects all OIDs satisfying the given condition for the given attribute.- Parameters:
attr- [in] Sparksee attribute identifier.cond- [in] Condition to be satisfied.value- [in] Value to be satisfied.restriction- [in] Objects to limit the select in this set of objects.- Returns:
- Objects instance.
-
select
-
renameAttribute
Renames an attribute.The new name must be available.
- Parameters:
attr- [in] Sparksee attribute identifier.newName- [in] The new name for the attribute.
-
countEdges
public long countEdges()Gets the number of edges.- Returns:
- The number of edges.
-
renameType
Renames a type.The new name must be available.
- Parameters:
type- [in] The type to be renamed.newName- [in] The new name for the type.
-
tailsAndHeads
Gets all the tails and heads from the given edges collection.- Parameters:
edges- [in] Sparksee edge identifier collection.tails- [in|out] If not NULL, all the tails will be stored here.heads- [in|out] If not NULL, all the heads will be stored here.
-
newSessionAttribute
Creates a new Session attribute with a default value.Session attributes are exclusive for the Session (just its Session can use the attribute) and are automatically removed when the Session is closed (thus, attribute data is not persistent into the database).
Since they are not persistent, they cannot be retrieved from the database, so they do not have an identifier name.
- Parameters:
type- [in] Sparksee node or edge type identifier.dt- [in] Data type for the new attribute.kind- [in] Attribute kind.defaultValue- [in] The default value to use in each new node/edge.- Returns:
- Unique Sparksee attribute identifier.
-
heads
-
newAttribute
Creates a new attribute with a default value.- Parameters:
type- [in] Sparksee node or edge type identifier.name- [in] Unique name for the new attribute.dt- [in] Data type for the new attribute.kind- [in] Attribute kind.defaultValue- [in] The default value to use in each new node/edge.- Returns:
- Unique Sparksee attribute identifier.
-
renameType
-
explode
Selects all edges from or to the given node OID and for the given edge type.- Parameters:
oid- [in] Sparksee node OID.etype- [in] Sparksee edge type identifier.dir- [in] Direction.- Returns:
- Objects instance.
-
getAttributes
Gets all Sparksee attribute identifiers with a non-NULL value for the given Sparksee OID.- Parameters:
oid- [in] Sparksee OID.- Returns:
- Sparksee attribute identifier list.
-
findAttributes
Gets all existing Sparksee attribute identifiers for the given type identifier.- Parameters:
type- [in] Sparksee type identifier.- Returns:
- Sparksee attribute identifier list.
-
getArrayAttribute
Gets the ValueArray for the given array attribute and OID or NULL if it does not exist.- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee array attribute identifier.- Returns:
- A ValueArray. This returns a ValueArray, a NULL or throws an exception.
-
getAttribute
Gets the Value for the given attribute and OID.The other version of this call, where the Value is an output parameter instead of the return, is better because it allows the user to reuse an existing Value instance, whereas this call always creates a new Value instance to be returned.
It never returns NULL. Thus, in case the OID has a NULL value for the attribute it returns a NULL Value instance.
- Parameters:
oid- [in] Sparksee OID.attr- [in] Sparksee attribute identifier.- Returns:
- A new Value instance having the attribute value for the given OID.
-
findOrCreateObject
Finds one object having the given Value for the attribute or it creates one does not exist any.If the attribute is a node or edge attribute and at least one node/edge with that value is found, it returns one of them. But if it does not exist, then: If it's a node attribute it will create it and set the attribute. If it's an edge attribute it will return the InvalidOID.
Using this method with a global attribute will return the InvalidOID.
- Parameters:
attr- [in] Sparksee attribute identifier.value- [in] Value.- Returns:
- Sparksee OID or the Objects InvalidOID.
-
getEdgeData
Gets information about an edge.- Parameters:
edge- [in] Sparksee edge identifier.- Returns:
- An EdgeData instance.
-
drop
Drops all the OIDs from the given collection.See Drop method with the single OID parameter. This performs the same operation for each object in the given set.
- Parameters:
objs- [in] Objects collection with the OIDs to be removed.
-
newEdge
public long newEdge(int type, long tail, long head) Creates a new edge instance.- Parameters:
type- [in] Sparksee type identifier.tail- [in] Source Sparksee OID.head- [in] Target Sparksee OID.- Returns:
- Unique OID of the new edge instance.
-
getType
Gets information about the given type.- Parameters:
type- [in] Sparksee type identifier.- Returns:
- The Type for the given Sparksee type identifier.
-