|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.stanbol.enhancer.servicesapi.helper.ExecutionMetadataHelper
public class ExecutionMetadataHelper
This class defines utility methods for writing and updating
Execution Metadata. This will be usually needed by
EnhancementJobManager implementations.
| Constructor Summary | |
|---|---|
ExecutionMetadataHelper()
|
|
| Method Summary | |
|---|---|
static org.apache.clerezza.rdf.core.NonLiteral |
createChainExecutionNode(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral executionPlan,
org.apache.clerezza.rdf.core.UriRef ciUri,
boolean defaultChain)
|
static org.apache.clerezza.rdf.core.NonLiteral |
createEngineExecution(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral chainExecution,
org.apache.clerezza.rdf.core.NonLiteral executionNode)
|
static org.apache.clerezza.rdf.core.NonLiteral |
getChainExecution(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.UriRef ciUri)
Getter for the ChainExecution used to enhance the content item |
static org.apache.clerezza.rdf.core.NonLiteral |
getChainExecutionForChainName(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.TripleCollection ep,
java.lang.String chainName)
Getter for the ExecutionMetadata.CHAIN_EXECUTION node of an
graph containing ChainExecution metadata for the parsed Chain.getName(). |
static org.apache.clerezza.rdf.core.NonLiteral |
getChainExecutionForExecutionPlan(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral executionPlanNode)
Getter for the ExecutionMetadata.CHAIN_EXECUTION node of an
graph containing ChainExecution metadata for the parsed
ExecutionPlan.EXECUTION_PLAN node |
static java.util.Date |
getCompleted(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
Getter for the completed dateTime of an 'em:Execution' |
static org.apache.clerezza.rdf.core.NonLiteral |
getExecutionNode(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
Getter for the ep:ExecutionNode for a given em:Execution. |
static org.apache.clerezza.rdf.core.NonLiteral |
getExecutionPlanNode(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.NonLiteral chainExecutionNode)
Getter for the ep:ExecutionPlan node for the parsed em:ChainExecution node |
static java.util.Set<org.apache.clerezza.rdf.core.NonLiteral> |
getExecutions(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.NonLiteral chainExecutionNode)
Get ExecutionMetadata.EXECUTION nodes that are
ExecutionMetadata.EXECUTION_PART of the parsed
ExecutionMetadata.CHAIN_EXECUTION node |
static java.util.Date |
getStarted(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
Getter for the started dateTime of an 'em:Execution' |
static java.util.Map<org.apache.clerezza.rdf.core.NonLiteral,org.apache.clerezza.rdf.core.NonLiteral> |
initExecutionMetadata(org.apache.clerezza.rdf.core.MGraph em,
org.apache.clerezza.rdf.core.TripleCollection ep,
org.apache.clerezza.rdf.core.UriRef ciUri,
java.lang.String chainName,
java.lang.Boolean isDefaultChain)
Initialises execution metadata based on the parsed parameter. |
static org.apache.clerezza.rdf.core.MGraph |
initExecutionMetadataContentPart(ContentItem contentItem)
Getter/Initialiser for the execution metadata content part of the parsed content item. |
static boolean |
isExecutionFailed(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
Tests if the status if an
execution is
failed. |
static boolean |
isExecutionFinished(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
Tests if the status if an
execution has already finished. |
static void |
setExecutionCompleted(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution,
java.lang.String message)
Sets the state of the ExecutionNode to completed |
static void |
setExecutionFaild(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution,
java.lang.String message)
Set the parsed execution node to failed. |
static void |
setExecutionInProgress(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
Sets an execution node to in-progress. |
static void |
setExecutionScheduled(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
Sets the state of the ExecutionNode to scheduled and deletes any started, completed times |
static void |
setExecutionSkipped(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution,
java.lang.String message)
Sets an execution node to skipped. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExecutionMetadataHelper()
| Method Detail |
|---|
public static org.apache.clerezza.rdf.core.NonLiteral createChainExecutionNode(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral executionPlan,
org.apache.clerezza.rdf.core.UriRef ciUri,
boolean defaultChain)
public static org.apache.clerezza.rdf.core.NonLiteral createEngineExecution(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral chainExecution,
org.apache.clerezza.rdf.core.NonLiteral executionNode)
public static void setExecutionCompleted(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution,
java.lang.String message)
graph - execution - message - An optional message
public static void setExecutionScheduled(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
graph - the graph holding the execution metadataexecution - the execution node
public static void setExecutionFaild(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution,
java.lang.String message)
graph - execution - message - An message describing why the execution failed
public static void setExecutionSkipped(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution,
java.lang.String message)
graph - execution - message - An optional message why this execution was skipped
public static void setExecutionInProgress(org.apache.clerezza.rdf.core.MGraph graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
graph - execution -
public static final org.apache.clerezza.rdf.core.NonLiteral getChainExecutionForChainName(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.TripleCollection ep,
java.lang.String chainName)
ExecutionMetadata.CHAIN_EXECUTION node of an
graph containing ChainExecution metadata for the parsed Chain.getName().
If both the execution metadata and the execution plan are in the same
graph one need to parse the same triple collection instance for both
the execution metadata and the execution plan.
em - the triple collection containing execution metadataep - the triple collection containing the execution planchainName - the name of the executed chain
null if not found.
public static org.apache.clerezza.rdf.core.NonLiteral getChainExecutionForExecutionPlan(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral executionPlanNode)
ExecutionMetadata.CHAIN_EXECUTION node of an
graph containing ChainExecution metadata for the parsed
ExecutionPlan.EXECUTION_PLAN node
graph - the graph containing the Execution MetadataexecutionPlanNode - the ExecutionPlan.EXECUTION_PLAN node
ExecutionMetadata.CHAIN_EXECUTION nodepublic static org.apache.clerezza.rdf.core.MGraph initExecutionMetadataContentPart(ContentItem contentItem)
ExecutionMetadata.CHAIN_EXECUTION. If it does not already exist
this method creates an empty graph and register it with the parsed
content item otherwise it returns the existing part registered under that
URI.
Typically users will also want to use
#initExecutionMetadata(MGraph, TripleCollection, UriRef, String, boolean)
to initialise the state based on the grpah returned by this method.
NOTES:
ExecutionMetadata.CHAIN_EXECUTION that is not of type
MGraph this method will replace it with an empty MGraph.
contentItem - the contentItem
MGraph with the execution metadata as registered as
content part with the URI ExecutionMetadata.CHAIN_EXECUTION to
the ContentItem
java.lang.IllegalArgumentException - if the parsed content itme is null.
public static final java.util.Map<org.apache.clerezza.rdf.core.NonLiteral,org.apache.clerezza.rdf.core.NonLiteral> initExecutionMetadata(org.apache.clerezza.rdf.core.MGraph em,
org.apache.clerezza.rdf.core.TripleCollection ep,
org.apache.clerezza.rdf.core.UriRef ciUri,
java.lang.String chainName,
java.lang.Boolean isDefaultChain)
This method can be therefore used to both:
EnhancementJobManager implementation can start processing a
ContentItem by using an Chain
EnhancementJobManager to continue from an uncompleted enhancement.
If both the execution metadata and the execution plan are stored within the same graph users need to base this graph as both the first and second parameter
em - The graph containing the execution metadata. MUST NOT be NULLep - The graph containing the execution plan. MUST NOT be NULLciUri - the URI of the content item. MUST NOT be NULLchainName - the name of the chain to execute. May be NULL if
initialising from existing metadata. MUST NOT be NULL if initialising from
empty execution metadataisDefaultChain - if the chain to execute is the default chain. Will be
ignored if initialising from existing execution metadata. MUST NOT be NULL
if initialising from empty execution metadata
java.lang.IllegalArgumentException - if any of the requirements stated in the
documentation for the parameters is not fulfilled.
public static org.apache.clerezza.rdf.core.NonLiteral getExecutionNode(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
graph - the graph containing the execution metadataexecution - the em:Execution node
public static java.util.Set<org.apache.clerezza.rdf.core.NonLiteral> getExecutions(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.NonLiteral chainExecutionNode)
ExecutionMetadata.EXECUTION nodes that are
ExecutionMetadata.EXECUTION_PART of the parsed
ExecutionMetadata.CHAIN_EXECUTION node
em - the graph with the execution metadatachainExecutionNode - the chain execution node
public static org.apache.clerezza.rdf.core.NonLiteral getExecutionPlanNode(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.NonLiteral chainExecutionNode)
em - the execution metadatachainExecutionNode - the chain execution node
public static org.apache.clerezza.rdf.core.NonLiteral getChainExecution(org.apache.clerezza.rdf.core.TripleCollection em,
org.apache.clerezza.rdf.core.UriRef ciUri)
em - the graph with the execution metadataciUri - the ID of the content item
ExecutionMetadata.ENHANCES the ContentItem
public static boolean isExecutionFailed(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
status if an
execution is
failed.
graph - the graph with the execution metadataexecution - the execution node
true if the status is faild. Otherwise false.
public static boolean isExecutionFinished(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
status if an
execution has already finished. This
includes the states completed
and failed.
graph - the graph with the execution metadataexecution - the execution node
true if the execution has already finished
public static java.util.Date getStarted(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
graph - the graphexecution - the execution instance
null if not present
public static java.util.Date getCompleted(org.apache.clerezza.rdf.core.TripleCollection graph,
org.apache.clerezza.rdf.core.NonLiteral execution)
graph - the graphexecution - the execution instance
null if not present
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||