use of org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl in project stanbol by apache.
the class ExecutionPlanHelper method writeExecutionNode.
/**
* Writes all triples for an ep:ExecutionNode to the parsed {@link Graph}.
* An {@link BlankNode} is use for representing the execution node resource.
* @param graph the graph to write the triples. MUST NOT be empty
* @param epNode the BlankNodeOrIRI representing the ep:ExecutionPlan
* @param engineName the name of the engine. MUST NOT be <code>null</code> nor empty
* @param optional if the execution of this node is optional or required
* @param dependsOn other nodes that MUST BE executed before this one. Parse
* <code>null</code> or an empty set if none.
* @param enhProps the EnhancementProperties for this ExecutionNode or
* <code>null</code> if none
* @return the resource representing the added ep:ExecutionNode.
* @since 0.12.1
*/
public static BlankNodeOrIRI writeExecutionNode(Graph graph, BlankNodeOrIRI epNode, String engineName, boolean optional, Set<BlankNodeOrIRI> dependsOn, Map<String, Object> enhProps) {
if (graph == null) {
throw new IllegalArgumentException("The parsed Graph MUST NOT be NULL!");
}
if (engineName == null || engineName.isEmpty()) {
throw new IllegalArgumentException("The parsed Engine name MUST NOT be NULL nor empty!");
}
if (epNode == null) {
throw new IllegalArgumentException("The ep:ExecutionPlan instance MUST NOT be NULL!");
}
BlankNodeOrIRI node = new BlankNode();
graph.add(new TripleImpl(epNode, HAS_EXECUTION_NODE, node));
graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION_NODE));
graph.add(new TripleImpl(node, ENGINE, new PlainLiteralImpl(engineName)));
if (dependsOn != null) {
for (BlankNodeOrIRI dependend : dependsOn) {
if (dependend != null) {
graph.add(new TripleImpl(node, DEPENDS_ON, dependend));
}
}
}
graph.add(new TripleImpl(node, OPTIONAL, lf.createTypedLiteral(optional)));
writeEnhancementProperties(graph, node, engineName, enhProps);
return node;
}
use of org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl in project stanbol by apache.
the class ExecutionMetadataHelper method setExecutionFaild.
/**
* Set the parsed execution node to failed.
* @param graph
* @param execution
* @param message An message describing why the execution failed
*/
public static void setExecutionFaild(Graph graph, BlankNodeOrIRI execution, String message) {
Literal dateTime = lf.createTypedLiteral(new Date());
setStatus(graph, execution, STATUS_FAILED);
graph.add(new TripleImpl(execution, COMPLETED, dateTime));
if (message != null) {
graph.add(new TripleImpl(execution, STATUS_MESSAGE, new PlainLiteralImpl(message)));
} else {
throw new IllegalArgumentException("For faild Execution a STATUS message is required!");
}
}
Aggregations