|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.upc.dama.dex.core.Graph
public abstract class Graph
Graph representation.
This class is the general DEX graph representation. Especially,
DEX allows for the manipulation of attributed labeled
directed multigraphs (labels represent object types).
A Graph has the following characteristics:
GraphPool.
Graph.
Graph.
long values, whereas
node and edge type identifiers are int values.
There are different kind of edge types. They are classified as follows:
Directed edges have a node which is the tail (the source of the edge) and a node which is the head (the destination of the edge). In case of undirected edges, two nodes at the extreme of the edge play the two roles, head and tail. Whereas undirected edges allow for any kind of navigation, directed edges restrict the navigation to the direction of the edge. The edges have their phisically-stored object identifier.
Previous versions of Dex (v4.1.x and older) have another type of edges called virtual edges. Check out the documentation of previous version of Dex to have a detailed explanation about the functionality of virtual edges. Although virtual edges have been removed, the functionality they provided can be simulated as follows. Let's suppose we have a virtual edge defined between the attributes ATTR_A and ATTR_B. These edges allow for navigating from any object OBJ having an attribute value for the attribute ATTR_A to those objects having the same attribute value for the attribute ATTR_B. That is, this can be done as follows: (i) Getting the value of OBJ for the attribute ATTR_A. (ii) Selecting the objects having the retrieved value for attribute ATTR_B.
Restricted edges define which must be the type of the tail nodes and the type of the head nodes, thus edges only will be allowed between nodes belonging to the specified types in the restriction. In case of unrestricted edges, there is no restriction and edges are allowed between nodes belonging to any type.
Materialized edges make possible materializing and storing the
neighbors for each OID in order to considerably increase the performance
of the neighbors method (Graph.neighbors(long, int, short)).
Unfortunatelly, it slightly decreases the performance of the construction
of new edge instances. So, only if you will make intensive use of neighbors
method should force materialize neighbors. This can be done by means
of a parameter at the definition of new edge types
(Graph.newEdgeType(java.lang.String, boolean, boolean) and
Graph.newRestrictedEdgeType(java.lang.String, int, int, boolean)).
By default, edges types will not materialize neighbors.
Attributes
Basically attributes are restricted to a given node or edge type when
they are created
(see Graph.newAttribute(int, java.lang.String, short, short)).
That is, only node or edge objects of the corresponding restricting type
can set and get values from that attribute identifier.
But also, attributes can be global. That is, all node or edge objects
(no matters which type they belong to) can set and get values from that
attribute identifier. To do that, Identifiers.GLOBAL_TYPE must be
used when creating the attribute.
There are three kind of attributes:
Graph.ATTR_KIND_BASIC allows for storing a value for each object but
they cannot be used at query methods (such
as Graph.select(long, short, edu.upc.dama.dex.core.Value)),
Graph.ATTR_KIND_INDEXED allows for storing a value for each object
and they can be used at query methods.
Graph.ATTR_KIND_UNIQUE works as Graph.ATTR_KIND_INDEXED but
additionally they have a constraint: two different objects cannot have
the same value but NULL values.
DbGraph| Nested Class Summary | |
|---|---|
static class |
Graph.AttributeData
Stores information about an attribute. |
static class |
Graph.AttributeStats
Attribute statistics. |
static class |
Graph.TypeData
Stores information about a node or edge type. |
| Field Summary | |
|---|---|
static short |
ATTR_KIND_BASIC
Basic attribute kind. |
static short |
ATTR_KIND_INDEXED
Indexed attribute kind. |
static short |
ATTR_KIND_UNIQUE
Unique attribute kind. |
static short |
EDGES_BOTH
In-going and out-going both edge direction identifier. |
static short |
EDGES_IN
In-going edge direction identifier. |
static short |
EDGES_OUT
Out-going edge direction identifier. |
protected long |
numEdges
Total number of edges. |
protected long |
numNodes
Total number of nodes. |
static short |
OPERATION_BETWEEN
Between two values operation identifier. |
static short |
OPERATION_EQ
Equal operation identifier. |
static short |
OPERATION_ERE
Case sensitive regular expression operation identifier. |
static short |
OPERATION_GE
Greater or equal operation identifier. |
static short |
OPERATION_GT
Greater than operation identifier. |
static short |
OPERATION_ILIKE
Insensitive like operation identifier. |
static short |
OPERATION_LE
Less or equal operation identifier. |
static short |
OPERATION_LIKE
Like operation identifier. |
static short |
OPERATION_LT
Less than operation identifier. |
static short |
OPERATION_NE
Not equal operation identifier. |
static short |
ORDER_ASCENDENT
Ascendent order identifier. |
static short |
ORDER_DESCENDENT
Descendent order identifier. |
| Fields inherited from interface edu.upc.dama.dex.core.Identifiers |
|---|
DBGRAPH_ID, GLOBAL_TYPE, INVALID_ATTRIBUTE, INVALID_EDGE, INVALID_NODE, INVALID_OID, INVALID_TYPE |
| Method Summary | |
|---|---|
protected void |
close()
Closes the instance. |
long |
degree(long oid,
int type,
short direction)
Gets the degree for a node for the given edge type. |
boolean |
drop(long oid)
Drops a node or edge. |
long |
edges()
Gets the total number of edges. |
java.util.Set |
edgeTypes()
Gets all edge type identifiers. |
boolean |
existsEdge(long oid1,
long oid2,
int type)
Deprecated. As of release 1.2, replace by Graph.findEdge(long, long, int) or
Graph.findEdges(long, long, int). |
boolean |
existsEdgeIn(long oid1,
long oid2,
int type)
Deprecated. As of release 1.2, replace by Graph.findEdge(long, long, int) or
Graph.findEdges(long, long, int). |
boolean |
existsEdgeOut(long oid1,
long oid2,
int type)
Deprecated. As of release 1.2, replace by Graph.findEdge(long, long, int) or
Graph.findEdges(long, long, int). |
boolean |
existsNode(long oid)
Deprecated. As of release 1.2, replace by Graph.getObjectType(long). |
Objects |
explode(long oid,
int type,
short direction)
Explodes an edge type from the given node. |
Objects |
explode(long oid,
java.lang.String type,
short direction)
Deprecated. As of release 1.2, replace by Graph.explode(long, int, short). |
Objects |
explode(Objects nodes,
int type,
short direction)
Explodes an edge type from the given node. |
Objects |
explode(Objects nodes,
java.lang.String type,
short direction)
Deprecated. As of release 1.2, replace by Graph.explode(long, int, short). |
void |
export(java.io.PrintWriter ps,
Export.Type type,
Export extra)
Exports the Graph. |
long |
findAttribute(int type,
java.lang.String name)
Gets the attribute identifier for the given node or edge type and name. |
Attribute[] |
findAttributes(int type)
Deprecated. As of release 1.2, replaced by Graph.getAttributesFromType(int). |
Attribute[] |
findAttributes(long oid)
Deprecated. As of release 1.2, replaced by Graph.getAttributes(long). |
long |
findEdge(long tail,
long head,
int type)
Gets just an edge of the given type between two given nodes. |
Objects |
findEdges(long tail,
long head,
int type)
Gets all the edges of the given type between two given nodes. |
long[] |
findEdges(long tail,
long head,
int type,
int max)
Deprecated. As of release 1.2, replaced by Graph.findEdges(long, long, int) |
int |
findEdgeType(java.lang.String name)
Deprecated. As of release 1.2, replaced by Graph.findType(java.lang.String). |
int |
findNodeType(java.lang.String name)
Deprecated. As of release 1.2, replaced by Graph.findType(java.lang.String). |
long |
findObj(long attr,
Value v)
Finds a node or edge identifier which has the given value for the given attribute. |
int |
findType(java.lang.String name)
Gets the node or edge type identifier for the given name. |
Value |
getAttribute(long oid,
long attribute)
Gets the value for an attribute for the given node or edge identifier. |
boolean |
getAttribute(long oid,
long attribute,
Value v)
Gets the value for an attribute for the given node or edge identifier. |
Value |
getAttribute(long oid,
java.lang.String attribute)
Deprecated. As of release 1.2, replace by Graph.getAttribute(long, long, edu.upc.dama.dex.core.Value). |
long |
getAttributeCount(long attribute)
Deprecated. As of release 1.2, replace by Graph.getAttributeData(long). |
Graph.AttributeData |
getAttributeData(long attribute)
Gets information about an attribute. |
long |
getAttributeIntervalCount(long attribute,
Value low,
boolean includeLow,
Value high,
boolean includeHigh)
Retrieves how many objects have a value into the given range for the given attribute. |
java.lang.String |
getAttributeName(long attribute)
Deprecated. As of release 1.2, replace by Graph.getAttributeData(long). |
java.util.Set |
getAttributes(long oid)
Gets all the not-null attributes for the given node or edge identifier. |
java.util.Set |
getAttributesFromType(int type)
Gets all the attributes for the given node or edge type. |
long |
getAttributeSize(long attribute)
Deprecated. As of release 1.2, replace by Graph.getAttributeData(long). |
Graph.AttributeStats |
getAttributeStats(long attribute)
Calculates statistics for the given attribute. |
short |
getAttributeType(long attribute)
Deprecated. As of release 1.2, replace by Graph.getAttributeData(long). |
long[] |
getEdge(long oid)
Gets the tail and head of the given edge. |
long |
getEdgePeer(long edge,
long node)
Deprecated. As of release 1.2, replaced by Graph.getEdge(long). |
java.util.Iterator |
getEdgeTypes()
Deprecated. As of release 1.2, replace by Graph.edgeTypes(). |
GraphPool |
getGraphPool()
Gets the parent GraphPool instance. |
long |
getHead(long oid)
Deprecated. As of release 1.2, replaced by Graph.getEdge(long). |
java.util.Iterator |
getNodeTypes()
Deprecated. As of release 1.2, replace by Graph.nodeTypes(). |
int |
getObjectType(long oid)
Gets the node or edge type identifier for the given node or edge identifier. |
Session |
getSession()
Gets the parent Session instance. |
long |
getTail(long oid)
Deprecated. As of release 1.2, replaced by Graph.getEdge(long). |
int |
getType(long oid)
Gets the node or edge type identifier for the given node or edge identifier. |
Graph.TypeData |
getTypeData(int type)
Gets information about a type. |
java.lang.String |
getTypeName(int type)
Deprecated. As of release 1.2, replace by Graph.getTypeData(int). |
Values |
getValues(long attribute,
short order)
Gets a Value collection which contains all the different
values of the given attribute. |
Objects |
heads(Objects edges)
Gets the collection of head node identifiers from a collection of edge identifiers. |
boolean |
indexAttribute(long attribute,
short kind)
Changes the attribute kind. |
boolean |
isEdgeTypeDirected(int type)
Deprecated. As of release 1.2, replace by Graph.getTypeData(int). |
boolean |
isEdgeTypeRestricted(int type)
Deprecated. As of release 1.2, replace by Graph.getTypeData(int). |
boolean |
isEdgeTypeUndirected(int type)
Deprecated. As of release 1.2, replace by Graph.getTypeData(int). |
boolean |
isOpen()
Gets if the Graph is open. |
boolean |
isTypeEdge(int type)
Gets if the given type is an edge type identifier. |
boolean |
isTypeNode(int type)
Gets if the given type is an node type identifier. |
Objects |
neighbors(long oid,
int type,
short direction)
Gets the neighbors from a node for the given edge type. |
Objects |
neighbors(long oid,
java.lang.String type,
short direction)
Deprecated. As of release 1.2, replace by Graph.neighbors(long, int, short). |
Objects |
neighbors(Objects nodes,
int type,
short direction)
Gets the neighbors from a node for the given edge type. |
Objects |
neighbors(Objects nodes,
java.lang.String type,
short direction)
Deprecated. As of release 1.2, replace by Graph.neighbors(long, int, short). |
long |
newAttribute(int type,
java.lang.String name,
short datatype)
Creates a new Graph.ATTR_KIND_INDEXED attribute. |
long |
newAttribute(int type,
java.lang.String name,
short datatype,
short kind)
Creates a new attribute. |
long |
newEdge(long tail,
long head,
int type)
Creates a new edge of the given type identifier between two given nodes. |
long |
newEdge(long attrTail,
Value vTail,
long attrHead,
Value vHead,
int type)
Creates a new edge of the given type identifier between two nodes. |
int |
newEdgeType(java.lang.String name)
Creates a new directed edge type. |
int |
newEdgeType(java.lang.String name,
boolean directed)
Creates a new edge type. |
int |
newEdgeType(java.lang.String name,
boolean directed,
boolean neighbors)
Creates a new edge type. |
long |
newNode(int type)
Creates a new node of the given type identifier. |
int |
newNodeType(java.lang.String name)
Creates a new node type. |
int |
newRestrictedEdgeType(java.lang.String name,
int typeTail,
int typeHead)
Creates a new restricted edge type. |
int |
newRestrictedEdgeType(java.lang.String name,
int typeTail,
int typeHead,
boolean neighbors)
Creates a new restricted edge type. |
long |
newTransientAttribute(int type,
short datatype)
Creates a new transient Graph.ATTR_KIND_BASIC attribute with an
auto-generated unique name. |
long |
newTransientAttribute(int type,
short datatype,
short kind)
Creates a new transient attribute with an auto-generated unique name. |
int |
newUndirectedEdgeType(java.lang.String name)
Creates a new undirected edge type. |
long |
nodes()
Gets the total number of nodes. |
java.util.Set |
nodeTypes()
Gets all node type identifiers. |
boolean |
removeAttribute(long attribute)
Removes an attribute. |
boolean |
removeType(int type)
Removes a node or edge type. |
Objects |
select(int type)
Selects all the nodes or edges of the given type. |
Objects |
select(int type,
java.lang.String attribute,
Operation op,
Value v)
Deprecated. As of release 1.2, replace by Graph.select(long, short, edu.upc.dama.dex.core.Value). |
Objects |
select(long attribute,
Operation op,
Value v)
Deprecated. As of release 1.2, replace by Graph.select(long, short, edu.upc.dama.dex.core.Value). |
Objects |
select(long attribute,
short op,
Value v)
Selects all the nodes or edges which satisfy the condition. |
Objects |
select(long attribute,
short op,
Value v1,
Value v2)
Selects all the nodes or edges which satisfy the condition. |
boolean |
setAttribute(long oid,
long attribute,
Value v)
Sets a value for an attribute for the given node or edge identifier. |
boolean |
setAttribute(long oid,
java.lang.String attribute,
Value v)
Deprecated. As of release 1.2, replace by Graph.setAttribute(long, long, edu.upc.dama.dex.core.Value). |
Objects |
tails(Objects edges)
Gets the collection of tail node identifiers from a collection of edge identifiers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final short ATTR_KIND_BASIC
See Attribute section at Graph.
public static final short ATTR_KIND_UNIQUE
See Attribute section at Graph.
public static final short ATTR_KIND_INDEXED
See Attribute section at Graph.
public static final short ORDER_ASCENDENT
public static final short ORDER_DESCENDENT
public static final short OPERATION_LT
Null Value cannot be used for this operation.
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_LE
Null Value cannot be used for this operation.
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_EQ
Null Value can be used for this operation to retrieve all objects having a null value.
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_GE
Null Value cannot be used for this operation.
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_GT
Null Value cannot be used for this operation.
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_NE
Null Value can be used for this operation to retrieve all objects having a non-null value.
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_BETWEEN
Null Value cannot be used for this operation.
Graph.select(long, short, edu.upc.dama.dex.core.Value, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_LIKE
Null Value cannot be used for this operation.
This is an specific String operation. It allows for searching substrings. It is case sensitive.
Ex:
'AAABBBCCCD' LIKE 'BBB' returnstrue'AAABBBCCCD' LIKE 'bbb' returnsfalse'AAABBBCCCD' LIKE 'E' returnsfalse
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_ILIKE
Null Value cannot be used for this operation.
This is an specific String operation. It allows for searching substrings. It is not case sensitive.
Ex:
'AAABBBCCCD' ILIKE 'BBB' returnstrue'AAABBBCCCD' ILIKE 'bbb' returnstrue'AAABBBCCCD' ILIKE 'E' returnsfalse
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short OPERATION_ERE
Null Value cannot be used for this operation.
This is an specific String operation. It allows for searching regular expressions inside strings. It is case sensitive.
Regular expression format conforms most of the POSIX Extended Regular Expressions. Implemented operators are:
| operator | description | examples |
|---|---|---|
| letter | expects a that letter | a : true if it includes an a |
| E1E2 | two or more consecutive expressions are concatenated | b : true if it includes a substring ab |
| E1|E2 | expects one of both expressions | cat|dog : true if it includes cat or dog |
| (E) | groups an expression | r(u|a)n : true if it includes run or ran |
| E{m,M} | an expression is repeated from a minimimum times, m, to a
maximum times, M. If maximum, M, is zero, then unlimited number of repetitions is accepted |
ab{1,3} : true if includes ab, abb or abbb |
| E* E+ E? | equivalent to: E{0,0} E{1,0} E{0,1} | |
| [letters] | equivalent to: (letter1|letter2|...|lettern) | [abc] : true if there is any of a or b or c |
| [^letters] | expects none of those letters | [^abc] : false if there is any of a or b or c |
| . | accepts any letter, equivalent to [^] | |
| ^E | expects an expression at the beggining | ^a : true if it starts with a |
| E$ | expects an expression at the end | a$ : true if it ends with a |
Ex:
'AAABBBCCCD' ERE 'A+B*C+' returnstrue'AAACCCD' ERE 'B*C+' returnstrue'AAACCCD' ERE 'B+C+' returnsfalse'AAACCCD' ERE '^A[^]*D$' returnstrue'AAACCCD' ERE 'B*C+$' returnsfalse
Graph.select(long, short, edu.upc.dama.dex.core.Value),
Constant Field Valuespublic static final short EDGES_IN
Graph.explode(long, int, short),
Constant Field Valuespublic static final short EDGES_OUT
Graph.explode(long, int, short),
Constant Field Valuespublic static final short EDGES_BOTH
Graph.explode(long, int, short),
Constant Field Valuesprotected long numNodes
protected long numEdges
| Method Detail |
|---|
protected void close()
Once executed, the instance becomes invalid.
public boolean isOpen()
Graph is open.
Only opened Graphs can execute methods, otherwise
they will fail.
true if the Graph is open,
false otherwise.public Session getSession()
Session instance.
Session instance.public GraphPool getGraphPool()
GraphPool instance.
GraphPool instance.public int newNodeType(java.lang.String name)
It fails if there is another type with the given name.
name - Name of the node type.
public int newEdgeType(java.lang.String name,
boolean directed)
It fails if there is another type with the given name.
By default neighbors are not materialized.
name - Name of the edge type.directed - If true then the edge type is
directed, otherwise the edge type is undirected.
public int newEdgeType(java.lang.String name,
boolean directed,
boolean neighbors)
It fails if there is another type with the given name.
name - Name of the edge type.directed - If true then the edge type is
directed, otherwise the edge type is undirected.neighbors - Materialize neighbors or not.
public int newEdgeType(java.lang.String name)
It fails if there is another type with the given name.
By default neighbors are not materialized.
name - Name of the edge type.
public int newUndirectedEdgeType(java.lang.String name)
It fails if there is another type with the given name.
By default neighbors are not materialized.
name - Name of the edge type.
public int newRestrictedEdgeType(java.lang.String name,
int typeTail,
int typeHead)
It fails if there is another type with the given name.
By default neighbors are not materialized.
name - Name of the edge type.typeTail - Tail node type identifier.typeHead - Head node type identifier.
public int newRestrictedEdgeType(java.lang.String name,
int typeTail,
int typeHead,
boolean neighbors)
It fails if there is another type with the given name.
name - Name of the edge type.typeTail - Tail node type identifier.typeHead - Head node type identifier.neighbors - Materialize neighbors or not.
public int findType(java.lang.String name)
name - Node or edge type name.
Identifiers.INVALID_TYPE if there is no node or edge type
with the given name.@Deprecated public int findNodeType(java.lang.String name)
Graph.findType(java.lang.String).
name - Node type name.
Identifiers.INVALID_TYPE if there is no node type
with the given name.@Deprecated public int findEdgeType(java.lang.String name)
Graph.findType(java.lang.String).
name - Edge type name.
Identifiers.INVALID_TYPE if there is no edge type
with the given name.public Graph.TypeData getTypeData(int type)
It cannot be Identifiers.INVALID_TYPE neither Identifiers.GLOBAL_TYPE.
type - Node or edge type identifier.
Graph.TypeData@Deprecated public java.lang.String getTypeName(int type)
Graph.getTypeData(int).
type - Node or edge type identifier.
public boolean removeType(int type)
Additionally, it also drops all node or edge beloging to the given type. It fails with an exception if the type has attributes or if instances of the type are being used in some edge.
WARNING: This method can be very expensive when the schema of the graph has unrestricted edges.
type - Node or edge type identifier.
true if the type is successfully removed.public boolean isTypeEdge(int type)
type - Type.
true if the given type is an
edge type identifier, false otherwise.public boolean isTypeNode(int type)
type - Type.
true if the given type is an
node type identifier, false otherwise.@Deprecated public java.util.Iterator getNodeTypes()
Graph.nodeTypes().
public java.util.Set nodeTypes()
@Deprecated public java.util.Iterator getEdgeTypes()
Graph.edgeTypes().
public java.util.Set edgeTypes()
@Deprecated public boolean isEdgeTypeRestricted(int type)
Graph.getTypeData(int).
type - Edge type identifier.
true if the given edge type is
restricted, false otherwise.@Deprecated public boolean isEdgeTypeDirected(int type)
Graph.getTypeData(int).
type - Edge type identifier.
true if the given edge type is
directed, false otherwise.@Deprecated public boolean isEdgeTypeUndirected(int type)
Graph.getTypeData(int).
type - Edge type identifier.
true if the given edge type is
undirected, false otherwise.public long newNode(int type)
type - Node type identifier.
public long newEdge(long tail,
long head,
int type)
tail - Node identifier, the tail of the new edge.head - Node identifier, the head of the new edge.type - Edge type identifier.
public long newEdge(long attrTail,
Value vTail,
long attrHead,
Value vHead,
int type)
attrTail - Tail attribute identifier.vTail - Value to find the tail object.attrHead - Head attribute identifier.vHead - Value to find the tail object.type - Edge type identifier.
public int getObjectType(long oid)
It throws an exception if the given node or edge identifier does not exist.
oid - Node or edge identifier.
public int getType(long oid)
oid - Node or edge identifier.
public long nodes()
public long edges()
public boolean drop(long oid)
It also remove all its attribute values.
oid - Node or edge identifier.
true.
public long newAttribute(int type,
java.lang.String name,
short datatype,
short kind)
For Value.TEXT attributes see TextStream.
Attribute name cannot contain "//".
type - Node or edge type identifier.
If type is Identifiers.GLOBAL_TYPE then it creates a global attribute.name - Name of the attribute.datatype - Data type of the attribute. It must be
Value.BOOL, Value.DOUBLE, Value.INT,
Value.LONG, Value.STRING or Value.TIMESTAMP,
or Value.TEXT.kind - Attribute kind.
It must be Graph.ATTR_KIND_BASIC or
Graph.ATTR_KIND_INDEXED or Graph.ATTR_KIND_UNIQUE.
Graph
public long newAttribute(int type,
java.lang.String name,
short datatype)
Graph.ATTR_KIND_INDEXED attribute.
This call exists just to keep compatibility with the old behaviour, where all attributes had to be indexed with no choice.
If the method is called with Value.TEXT as the datatype,
it will fail since they cannot be indexed.
Attribute name cannot contain "//".
type - Node or edge type identifier.
If type is Identifiers.GLOBAL_TYPE then it creates a global attribute.name - Name of the attribute.datatype - Data type of the attribute. It must be
Value.BOOL, Value.DOUBLE, Value.INT,
Value.LONG, Value.STRING or Value.TIMESTAMP.
Graph.newAttribute(int, java.lang.String, short, short)
public long newTransientAttribute(int type,
short datatype,
short kind)
Created attribute is transient, that means that it is destroyed
when its parent Session instance is closed.
For Value.TEXT attributes see TextStream.
type - Node or edge type identifier.datatype - Data type of the attribute. It must be
Value.BOOL, Value.DOUBLE, Value.INT,
Value.LONG, Value.STRING or Value.TIMESTAMP,
or Value.TEXT.kind - Attribute kind (see Attribute section at Graph).
It must be Graph.ATTR_KIND_BASIC or
Graph.ATTR_KIND_INDEXED or Graph.ATTR_KIND_UNIQUE.
public long newTransientAttribute(int type,
short datatype)
Graph.ATTR_KIND_BASIC attribute with an
auto-generated unique name.
This call exists just to keep compatibility with the old behaviour, where all attributes had to be indexed with no choice.
Created attribute is transient, that means that it is destroyed
when its parent Session instance is closed.
For Value.TEXT attributes see TextStream.
type - Node or edge type identifier.datatype - Data type of the attribute. It must be
Value.BOOL, Value.DOUBLE, Value.INT,
Value.LONG, Value.STRING or Value.TIMESTAMP,
or Value.TEXT.
public Graph.AttributeData getAttributeData(long attribute)
It cannot be Identifiers.INVALID_ATTRIBUTE.
attribute - Attribute identifier.
Graph.AttributeDatapublic Graph.AttributeStats getAttributeStats(long attribute)
Graph.ATTR_KIND_INDEXED or
Graph.ATTR_KIND_UNIQUE attributes.
attribute - Attribute identifier.
Graph.AttributeStats
public long getAttributeIntervalCount(long attribute,
Value low,
boolean includeLow,
Value high,
boolean includeHigh)
Graph.ATTR_KIND_INDEXED or
Graph.ATTR_KIND_UNIQUE attributes.
Given values must be the same type than the attribute.
attribute - Attribute identifier.low - Lower bound of the range.includeLow - Include lower bound of the range iff true.high - Higher bound of the range.includeHigh - Include higher bound of the range iff true.
@Deprecated public java.lang.String getAttributeName(long attribute)
Graph.getAttributeData(long).
attribute - Attribute identifier.
@Deprecated public long getAttributeSize(long attribute)
Graph.getAttributeData(long).
attribute - Attribute identifier.
@Deprecated public long getAttributeCount(long attribute)
Graph.getAttributeData(long).
attribute - Attribute identifier.
@Deprecated public short getAttributeType(long attribute)
Graph.getAttributeData(long).
attribute - Attribute identifier.
Value
public long findAttribute(int type,
java.lang.String name)
type - Node or edge type identifier.name - Attribute name.
Identifiers.INVALID_ATTRIBUTE if
there is no attribute with the given name for the given node or edge
type.public java.util.Set getAttributesFromType(int type)
type - Node or edge type identifier.
public boolean removeAttribute(long attribute)
Additionally, it removes the value from all the node or edge which have a value for the given attribute.
attribute - Attribute identifier.
true.
public boolean indexAttribute(long attribute,
short kind)
The current kind is Graph.ATTR_KIND_BASIC and the new one is
Graph.ATTR_KIND_UNIQUE/Graph.ATTR_KIND_INDEXED or
the current kind is Graph.ATTR_KIND_UNIQUE and the new one is
Graph.ATTR_KIND_BASIC/Graph.ATTR_KIND_INDEXED.
attribute - Attribute identifier.kind - The new attribute kind (see Attribute section at Graph).
public boolean setAttribute(long oid,
long attribute,
Value v)
For Value.TEXT attributes see TextStream.
oid - Node or edge identifier.attribute - Attribute identifier.v - Value.
true
public boolean setAttribute(long oid,
java.lang.String attribute,
Value v)
Graph.setAttribute(long, long, edu.upc.dama.dex.core.Value).
For Value.TEXT attributes see TextStream.
oid - Node or edge identifier.attribute - Attribute identifier name.v - Value.
true
public Value getAttribute(long oid,
long attribute)
For Value.TEXT attributes see TextStream.
oid - Node or edge identifier.attribute - Attribute identifier.
public Value getAttribute(long oid,
java.lang.String attribute)
Graph.getAttribute(long, long, edu.upc.dama.dex.core.Value).
For Value.TEXT attributes see TextStream.
oid - Node or edge identifier.attribute - Attribute identifier name.
public boolean getAttribute(long oid,
long attribute,
Value v)
For Value.TEXT attributes see TextStream.
oid - Node or edge identifier.attribute - Attribute identifier.v - Once the method is successfully execute, it contains
the value for the attribute.
true.
public Values getValues(long attribute,
short order)
Value collection which contains all the different
values of the given attribute.
attribute - Attribute identifier.order - Ascendent or descendent (Graph.ORDER_ASCENDENT,
or Graph.ORDER_DESCENDENT).
Value collection.Valuespublic java.util.Set getAttributes(long oid)
oid - Node or edge identifier.
@Deprecated public Attribute[] findAttributes(long oid)
Graph.getAttributes(long).
oid - Node or edge identifier.
Attribute@Deprecated public Attribute[] findAttributes(int type)
Graph.getAttributesFromType(int).
type - Node or edge type identifier.
Attribute array which contains for each element
into the array: the attribute identifier in the Attribute.value
field and the attribute name in the Attribute.name field.public long[] getEdge(long oid)
oid - Edge identifier.
@Deprecated public long getTail(long oid)
Graph.getEdge(long).
oid - Edge identifier.
@Deprecated public long getHead(long oid)
Graph.getEdge(long).
oid - Edge identifier.
public long getEdgePeer(long edge,
long node)
Graph.getEdge(long).
If node is the tail of the edge then it
returns the head and if node is the
head of the edge then it returns the tail.
edge - Edge identifier.node - Node identifier.
public long findObj(long attr,
Value v)
attr - Attribute identifier.v - Value.
Identifiers.INVALID_OID
if there is no node or edge with the given value for the given
attribute.
public Objects findEdges(long tail,
long head,
int type)
Thus, for all the edge identifier in the obtained collection,
tail is the tail of the edge and
head is the head of the edge.
tail - Tail node identifier.head - Head node identifier.type - Edge type identifier.
public long findEdge(long tail,
long head,
int type)
Thus, for the obtained edge identifier,
tail is the tail of the edge and
head is the head of the edge.
tail - Tail node identifier.head - Head node identifier.type - Edge type identifier.
Identifiers.INVALID_EDGE
if there is no edge of the given between the two given nodes.
@Deprecated
public long[] findEdges(long tail,
long head,
int type,
int max)
Graph.findEdges(long, long, int)
Thus, for all the edge identifier in the obtained collection,
tail is the tail of the edge and
head is the head of the edge.
tail - Tail node identifier.head - Head node identifier.type - Edge type identifier.
@Deprecated public boolean existsNode(long oid)
Graph.getObjectType(long).
oid - Number.
true if oid is an existing
node identifier, false otherwise.
@Deprecated
public boolean existsEdgeIn(long oid1,
long oid2,
int type)
Graph.findEdge(long, long, int) or
Graph.findEdges(long, long, int).
oid2 to oid1 or not.
oid1 - Node identifier.oid2 - Node identifier.type - Edge type identifier.
true if there is an edge of
the given type between the two given nodes where
oid2 is the tail of the edge and
oid1 is the head of the edge, otherwise it returns
false.
@Deprecated
public boolean existsEdgeOut(long oid1,
long oid2,
int type)
Graph.findEdge(long, long, int) or
Graph.findEdges(long, long, int).
oid1 to oid2 or not.
oid1 - Node identifier.oid2 - Node identifier.type - Edge type identifier.
true if there is an edge of
the given type between the two given nodes where
oid1 is the tail of the edge and
oid2 is the head of the edge, otherwise it returns
false.
@Deprecated
public boolean existsEdge(long oid1,
long oid2,
int type)
Graph.findEdge(long, long, int) or
Graph.findEdges(long, long, int).
oid1 - Node identifier.oid2 - Node identifier.type - Edge type identifier.
true if there is an edge of
the given type between the two given nodes, otherwise it returns
false.public Objects select(int type)
type - Node or edge type identifier.
Objects
@Deprecated
public Objects select(long attribute,
Operation op,
Value v)
Graph.select(long, short, edu.upc.dama.dex.core.Value).
The condition restricts the results. Only those nodes or edges
which satisfy the condition will be returned. The condition
is set by means of an operation and a Value.
attribute - Attribute identifier. It must be indexed.op - Logical Operation.v - Value to be satisified in the condition.
Objects,
Operation
public Objects select(long attribute,
short op,
Value v)
The condition restricts the results. Only those nodes or edges
which satisfy the condition will be returned. The condition
is set by means of an operation and a Value.
attribute - Attribute identifier. It must be indexed.op - Logical operation. It must be Graph.OPERATION_LT,
Graph.OPERATION_LE, Graph.OPERATION_EQ, Graph.OPERATION_GE,
Graph.OPERATION_GT, Graph.OPERATION_NE, Graph.OPERATION_LIKE,
or Graph.OPERATION_ILIKE.v - Value to be satisified in the condition.
Objects
public Objects select(long attribute,
short op,
Value v1,
Value v2)
The condition restricts the results. Only those nodes or edges
which satisfy the condition will be returned. The condition
is set by means of an operation and a Value.
attribute - Attribute identifier.op - Logical operation. It must be Graph.OPERATION_BETWEEN.v1 - Value lower bound in the condition.v2 - Value upper bound in the condition.
Objects
@Deprecated
public Objects select(int type,
java.lang.String attribute,
Operation op,
Value v)
Graph.select(long, short, edu.upc.dama.dex.core.Value).
The condition restricts the results. Only those nodes or edges
which satisfy the condition will be returned. The condition
is set by means of an operation and a Value.
type - Node or edge type identifier.attribute - Attribute name. It must be indexed.op - Logical Operation.v - Value to be satisified in the condition.
Objects,
Operation
public Objects explode(long oid,
int type,
short direction)
oid - Node identifier.type - Edge type identifier.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT
or Graph.EDGES_BOTH.
Objects
public Objects explode(long oid,
java.lang.String type,
short direction)
Graph.explode(long, int, short).
oid - Node identifier.type - Edge type identifier name.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT
or Graph.EDGES_BOTH.
Objects
public Objects explode(Objects nodes,
int type,
short direction)
nodes - Node identifiers.type - Edge type identifier.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT
or Graph.EDGES_BOTH.
Objects
public Objects explode(Objects nodes,
java.lang.String type,
short direction)
Graph.explode(long, int, short).
nodes - Node identifiers.type - Edge type identifier name.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT
or Graph.EDGES_BOTH.
Objects
public Objects neighbors(long oid,
int type,
short direction)
oid - Node identifier.type - Edge type identifier.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT or
Graph.EDGES_BOTH.
Objects
@Deprecated
public Objects neighbors(long oid,
java.lang.String type,
short direction)
Graph.neighbors(long, int, short).
oid - Node identifier.type - Edge type identifier name.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT or
Graph.EDGES_BOTH.
Objects
public Objects neighbors(Objects nodes,
int type,
short direction)
nodes - Node identifiers.type - Edge type identifier.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT or
Graph.EDGES_BOTH.
Objects
@Deprecated
public Objects neighbors(Objects nodes,
java.lang.String type,
short direction)
Graph.neighbors(long, int, short).
nodes - Node identifiers.type - Edge type identifier name.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT or
Graph.EDGES_BOTH.
Objects
public long degree(long oid,
int type,
short direction)
oid - Node identifier.type - Edge type identifier.direction - It must be Graph.EDGES_IN, Graph.EDGES_OUT or
Graph.EDGES_BOTH.
Objectspublic Objects tails(Objects edges)
edges - Edge identifier collection.
public Objects heads(Objects edges)
edges - Edge identifier collection.
public void export(java.io.PrintWriter ps,
Export.Type type,
Export extra)
Graph.
If extra is null, then a
Graph.DefaultExport is used.
ps - Output stream.type - Export type (Export.Type)extra - Export definition.Export,
Graph.DefaultExport
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||