use of org.apache.clerezza.commons.rdf.BlankNode in project stanbol by apache.
the class MultipartRequestTest method getDummyRdfMetadata.
/**
* @param contentItemId
* @param rdfContentType
* @return
*/
private String getDummyRdfMetadata(final IRI contentItemId, String rdfContentType) {
Graph metadata = new SimpleGraph();
metadata.add(new TripleImpl(new BlankNode(), Properties.ENHANCER_EXTRACTED_FROM, contentItemId));
ByteArrayOutputStream out = new ByteArrayOutputStream();
serializer.serialize(out, metadata, rdfContentType);
String rdfContent = new String(out.toByteArray(), UTF8);
return rdfContent;
}
use of org.apache.clerezza.commons.rdf.BlankNode in project stanbol by apache.
the class ExecutionMetadataHelper method createChainExecutionNode.
public static BlankNodeOrIRI createChainExecutionNode(Graph graph, BlankNodeOrIRI executionPlan, IRI ciUri, boolean defaultChain) {
BlankNodeOrIRI node = new BlankNode();
graph.add(new TripleImpl(node, RDF_TYPE, EXECUTION));
graph.add(new TripleImpl(node, RDF_TYPE, CHAIN_EXECUTION));
graph.add(new TripleImpl(node, ENHANCES, ciUri));
graph.add(new TripleImpl(ciUri, ENHANCED_BY, node));
graph.add(new TripleImpl(node, STATUS, STATUS_SCHEDULED));
graph.add(new TripleImpl(node, EXECUTION_PLAN, executionPlan));
graph.add(new TripleImpl(node, IS_DEFAULT_CHAIN, lf.createTypedLiteral(defaultChain)));
return node;
}
use of org.apache.clerezza.commons.rdf.BlankNode 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;
}
Aggregations