|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.connector.store.jpa.model.basic.SubgraphQuery
public class SubgraphQuery
Represents a temporary working area for a query that efficiently retrieves the nodes in a subgraph. This class uses the database to build up the content of the subgraph, and therefore requires write privilege on the database. The benefit is that it minimizes the amount of memory required to process the subgraph, plus the set of nodes that make up the subgraph can be produced with database joins.
The use of database joins also produces another benefit: the number of SQL statements necessary to build the set of nodes in a subgraph is equal to the depth of the subgraph, regardless of the number of child nodes at any level.
Method Summary | |
---|---|
void |
close()
Close this query object and clean up all in-database records associated with this query. |
static SubgraphQuery |
create(ExecutionContext context,
javax.persistence.EntityManager entities,
Long workspaceId,
UUID subgraphRootUuid,
Path subgraphRootPath,
int maxDepth)
Create a query that returns a subgraph at and below the node with the supplied path and the supplied UUID. |
void |
deleteSubgraph(boolean includeRoot)
Delete the nodes in the subgraph. |
javax.persistence.EntityManager |
getEntityManager()
|
List<ReferenceEntity> |
getInternalReferences()
Get the list of references that are owned by nodes within the subgraph and that point to other nodes in this same subgraph. |
List<ReferenceEntity> |
getInwardReferences()
Get the list of references that are owned by nodes outside of the subgraph that point to nodes in this subgraph. |
int |
getMaxDepth()
|
ChildEntity |
getNode()
Get the root node of the subgraph. |
int |
getNodeCount(boolean includeRoot)
|
List<Location> |
getNodeLocations(boolean includeRoot,
boolean includeChildrenOfMaxDepthNodes)
Get the Location for each of the nodes in the subgraph. |
List<ChildEntity> |
getNodes(boolean includeRoot,
boolean includeChildrenOfMaxDepthNodes)
Get the nodes in the subgraph. |
List<ReferenceEntity> |
getOutwardReferences()
Get the list of references that are owned by nodes within the subgraph and that point to nodes not in this same subgraph. |
List<PropertiesEntity> |
getProperties(boolean includeRoot,
boolean includeChildrenOfMaxDepthNodes)
Get the properties for each of the nodes in the subgraph. |
SubgraphQueryEntity |
getSubgraphQueryEntity()
|
Path |
getSubgraphRootPath()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static SubgraphQuery create(ExecutionContext context, javax.persistence.EntityManager entities, Long workspaceId, UUID subgraphRootUuid, Path subgraphRootPath, int maxDepth)
context
- the execution context; may not be nullentities
- the entity manager; may not be nullworkspaceId
- the ID of the workspace; may not be nullsubgraphRootUuid
- the UUID (in string form) of the root node in the subgraphsubgraphRootPath
- the path of the root node in the subgraphmaxDepth
- the maximum depth of the subgraph, or 0 if there is no maximum depth
public int getMaxDepth()
public javax.persistence.EntityManager getEntityManager()
public Path getSubgraphRootPath()
public SubgraphQueryEntity getSubgraphQueryEntity()
public int getNodeCount(boolean includeRoot)
public ChildEntity getNode()
root node
of the subgraph. This must be called before the query is closed
.
public List<ChildEntity> getNodes(boolean includeRoot, boolean includeChildrenOfMaxDepthNodes)
nodes
in the subgraph. This must be called before the query is closed
.
includeRoot
- true if the subgraph's root node is to be included, or false otherwiseincludeChildrenOfMaxDepthNodes
- true if the method is to include nodes that are children of nodes that are at the
maximum depth, or false if only nodes up to the maximum depth are to be included
public List<PropertiesEntity> getProperties(boolean includeRoot, boolean includeChildrenOfMaxDepthNodes)
properties
for each of the nodes in the subgraph. This must be called before the query is
closed
.
includeRoot
- true if the properties for the subgraph's root node are to be included, or false otherwiseincludeChildrenOfMaxDepthNodes
- true if the method is to include nodes that are children of nodes that are at the
maximum depth, or false if only nodes up to the maximum depth are to be included
public List<Location> getNodeLocations(boolean includeRoot, boolean includeChildrenOfMaxDepthNodes)
Location
for each of the nodes in the subgraph. This must be called before the query is closed
.
This method calls getNodes(boolean,boolean)
. Therefore, calling getNodes(boolean,boolean)
and this method
for the same subgraph is not efficient; consider just calling getNodes(boolean,boolean)
alone.
includeRoot
- true if the properties for the subgraph's root node are to be included, or false otherwiseincludeChildrenOfMaxDepthNodes
- true if the method is to include nodes that are children of nodes that are at the
maximum depth, or false if only nodes up to the maximum depth are to be included
locations
, one for each of the nodes in the subgraph, in breadth-first orderpublic List<ReferenceEntity> getInternalReferences()
public List<ReferenceEntity> getOutwardReferences()
public List<ReferenceEntity> getInwardReferences()
public void deleteSubgraph(boolean includeRoot)
getInwardReferences()
).
includeRoot
- true if the root node should also be deletedpublic void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |