public class GASContext<VS,ES,ST> extends Object implements IGASContext<VS,ES,ST>
Constructor and Description |
---|
GASContext(GASEngine gasEngine,
IGraphAccessor graphAccessor,
IGASState<VS,ES,ST> gasState,
IGASProgram<VS,ES,ST> gasProgram) |
Modifier and Type | Method and Description |
---|---|
IGASStats |
call()
Execute the associated
IGASProgram . |
boolean |
doRound(IGASStats stats)
Execute one iteration.
|
IGASProgram<VS,ES,ST> |
getGASProgram()
Return the program that is being evaluated.
|
IGASState<VS,ES,ST> |
getGASState()
The computation state.
|
IGraphAccessor |
getGraphAccessor()
The graph access object.
|
protected IFilter |
getLinkAttribFilter(IGASContext<VS,ES,ST> ctx,
org.openrdf.model.URI linkAttribType)
Return a filter that only visits the edges of graph that are instances of
the specified link attribute type.
|
org.openrdf.model.URI |
getLinkAttributeType()
Return non-
null iff there is a single link attribute type to
be visited. |
org.openrdf.model.URI |
getLinkType()
Return non-
null iff there is a single link type to be
visited. |
int |
getMaxIterations()
Return the maximum number iterations for the algorithm.
|
int |
getMaxIterationsAfterTargets()
Return the maximum number iterations for the algorithm to continue
once all the target vertices have been reached.
|
int |
getMaxVisited()
Return the maximum number of vertices that may be visited.
|
<T> IReducer<VS,ES,ST,T> |
getRunAfterOp()
Return an optional
IReducer that will run after the
IGASProgram is terminated. |
Set<org.openrdf.model.Value> |
getTargetVertices()
Get the target vertices for the program (if any).
|
TraversalDirectionEnum |
getTraversalDirection()
Return a type safe value indicating the traversal direction for the
IGASProgram . |
<T> T |
reduceOverFrontier(IStaticFrontier f,
IReducer<VS,ES,ST,T> op)
Reduce over the frontier (used for apply()).
|
void |
setLinkAttributeType(org.openrdf.model.URI linkAttributeType)
Imposes an optional restriction on which link attributes are considered
by the algorithm.
|
void |
setLinkType(org.openrdf.model.URI linkType)
Set an optional restriction on the type of the visited links.
|
void |
setMaxIterations(int newValue)
Specify the maximum number of iterations for the algorithm.
|
void |
setMaxIterationsAfterTargets(int newValue)
Specify the maximum number of iterations for the algorithm to continue
once all the target vertices have been reached.
|
void |
setMaxVisited(int newValue)
Specify the maximum number of vertices that may be visited.
|
<T> void |
setRunAfterOp(IReducer<VS,ES,ST,T> afterOp)
Set an optional
IReducer that will run after the
IGASProgram is terminated. |
void |
setTargetVertices(org.openrdf.model.Value[] targetVertices)
Set the target vertices for the program (if any).
|
void |
setTraversalDirection(TraversalDirectionEnum newVal)
Specify the traversal direction for the
IGASProgram . |
public GASContext(GASEngine gasEngine, IGraphAccessor graphAccessor, IGASState<VS,ES,ST> gasState, IGASProgram<VS,ES,ST> gasProgram)
namespace
- The namespace of the graph (KB instance).timestamp
- The timestamp of the graph view (this should be a read-only
view for non-blocking index reads).gasProgram
- The program to execute against that graph.public IGASState<VS,ES,ST> getGASState()
IGASContext
getGASState
in interface IGASContext<VS,ES,ST>
public IGASProgram<VS,ES,ST> getGASProgram()
IGASContext
getGASProgram
in interface IGASContext<VS,ES,ST>
public IGraphAccessor getGraphAccessor()
IGASContext
getGraphAccessor
in interface IGASContext<VS,ES,ST>
public IGASStats call() throws Exception
IGASContext
IGASProgram
.public boolean doRound(IGASStats stats) throws InterruptedException, ExecutionException, Exception
Property value access is on the SPO index. If we are doing a reverse gather (out-edges) then it will be right there and the Apply should be pushed into the Gather. If we are doing a forward gather (in-edges), then we are reading on OSP and will need to do a separate read on SPO.
doRound
in interface IGASContext<VS,ES,ST>
stats
- Used to report statistics about the execution of the
algorithm.InterruptedException
ExecutionException
Exception
public <T> T reduceOverFrontier(IStaticFrontier f, IReducer<VS,ES,ST,T> op) throws Exception
public void setMaxIterations(int newValue)
IGASContext
setMaxIterations
in interface IGASContext<VS,ES,ST>
newValue
- The maximum number of iterations.public TraversalDirectionEnum getTraversalDirection()
IGASContext
IGASProgram
.getTraversalDirection
in interface IGASContext<VS,ES,ST>
public void setTraversalDirection(TraversalDirectionEnum newVal)
IGASContext
IGASProgram
.
The value specified here is used to determine how the EdgesEnum
will be interpreted for the GATHER and SCATTER phases. The default is
TraversalDirectionEnum.Forward
.
setTraversalDirection
in interface IGASContext<VS,ES,ST>
TraversalDirectionEnum.asTraversed(EdgesEnum)
,
EdgesEnum.asUndirectedTraversal()
public int getMaxIterations()
IGASContext
getMaxIterations
in interface IGASContext<VS,ES,ST>
public void setMaxVisited(int newValue)
IGASContext
setMaxVisited
in interface IGASContext<VS,ES,ST>
newValue
- The maximum number of vertices in the frontier.public int getMaxVisited()
IGASContext
getMaxVisited
in interface IGASContext<VS,ES,ST>
public org.openrdf.model.URI getLinkType()
IGASContext
null
iff there is a single link type to be
visited. This corresponds to a view of the graph as sparse connectivity
matrix. The IGASEngine
can optimize traversal patterns using the
POS
index.
Note: When this option is used, the scatter and gather will not visit the property set for the vertex. Instead, the graph is treated as if it were an unattributed graph and only mined for the connectivity data.
getLinkType
in interface IGASContext<VS,ES,ST>
Value
for the predicate that identifies the desired
link type (there can be many types of links - the return value
specifies which attribute is of interest).public void setLinkType(org.openrdf.model.URI linkType)
IGASContext
Note: When this option is used, the scatter and gather will not visit the property set for the vertex. Instead, the graph is treated as if it were an unattributed graph and only mined for the connectivity data (which may include a link weight).
setLinkType
in interface IGASContext<VS,ES,ST>
linkType
- The link type to visit (optional). When null
, all
link types are visited.public org.openrdf.model.URI getLinkAttributeType()
IGASContext
null
iff there is a single link attribute type to
be visited. This imposes a restriction on which link attributes are
considered by the algorithm. The link attribute type restriction may be
(and often is) paired with a link type restriction.getLinkAttributeType
in interface IGASContext<VS,ES,ST>
Value
for the predicate that identifies the desired
link attribute type.IGASContext.setLinkType(URI)
public void setLinkAttributeType(org.openrdf.model.URI linkAttributeType)
IGASContext
setLinkAttributeType
in interface IGASContext<VS,ES,ST>
public void setTargetVertices(org.openrdf.model.Value[] targetVertices)
IGASContext
setTargetVertices
in interface IGASContext<VS,ES,ST>
public Set<org.openrdf.model.Value> getTargetVertices()
IGASContext
getTargetVertices
in interface IGASContext<VS,ES,ST>
public void setMaxIterationsAfterTargets(int newValue)
IGASContext
setMaxIterationsAfterTargets
in interface IGASContext<VS,ES,ST>
newValue
- The maximum number of iterations past the target vertices.public int getMaxIterationsAfterTargets()
IGASContext
getMaxIterationsAfterTargets
in interface IGASContext<VS,ES,ST>
protected IFilter getLinkAttribFilter(IGASContext<VS,ES,ST> ctx, org.openrdf.model.URI linkAttribType)
Note: For bigdata, the visited edges can be decoded to recover the original link as well.
public <T> void setRunAfterOp(IReducer<VS,ES,ST,T> afterOp)
IGASContext
IReducer
that will run after the
IGASProgram
is terminated. This may be used to extract results
from the visited vertices.setRunAfterOp
in interface IGASContext<VS,ES,ST>
afterOp
- The IReducer
.public <T> IReducer<VS,ES,ST,T> getRunAfterOp()
IGASContext
IReducer
that will run after the
IGASProgram
is terminated. This may be used to extract results
from the visited vertices.getRunAfterOp
in interface IGASContext<VS,ES,ST>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.