use of org.apache.clerezza.commons.rdf.impl.utils.TripleImpl in project stanbol by apache.
the class EnhancementEngineHelper method createTopicEnhancement.
/**
* Create a new instance with the types enhancer:Enhancement and
* enhancer:TopicAnnotation in the parsed graph along with default properties
* (dc:creator, dc:created and enhancer:extracted-form) and return
* the IRI of the extraction so that engines can further add.
*
* @param metadata the graph
* @param engine the engine
* @param contentItemId the id
*
* @return the URI of the new enhancement instance
*/
public static IRI createTopicEnhancement(Graph metadata, EnhancementEngine engine, IRI contentItemId) {
IRI enhancement = createEnhancement(metadata, engine, contentItemId);
metadata.add(new TripleImpl(enhancement, RDF_TYPE, ENHANCER_TOPICANNOTATION));
return enhancement;
}
use of org.apache.clerezza.commons.rdf.impl.utils.TripleImpl in project stanbol by apache.
the class EnhancementEngineHelper method createEntityEnhancement.
/**
* Create a new instance with the types enhancer:Enhancement and
* enhancer:EntityAnnotation in the parsed graph along with default properties
* (dc:creator, dc:created and enhancer:extracted-form) and return
* the IRI of the extraction so that engines can further add.
*
* @param metadata the graph
* @param engine the engine
* @param contentItemId the id
*
* @return the URI of the new enhancement instance
*/
public static IRI createEntityEnhancement(Graph metadata, EnhancementEngine engine, IRI contentItemId) {
IRI enhancement = createEnhancement(metadata, engine, contentItemId);
metadata.add(new TripleImpl(enhancement, RDF_TYPE, ENHANCER_ENTITYANNOTATION));
return enhancement;
}
use of org.apache.clerezza.commons.rdf.impl.utils.TripleImpl in project stanbol by apache.
the class EnhancementEngineHelper method createEnhancement.
/**
* Create a new enhancement instance in the metadata-graph of the content
* item along with default properties (dc:creator and dc:created) and return
* the IRI of the extraction so that engines can further add. <p>
* <i>NOTE:</i> This method was protected prior to <code>0.12.1</code> (see
* <a href="https://issues.apache.org/jira/browse/STANBOL-1321">STANBOL-1321</a>)
*
* @param ci the ContentItem being under analysis
* @param engine the Engine performing the analysis
*
* @return the URI of the new enhancement instance
* @since 0.12.1
*/
public static IRI createEnhancement(Graph metadata, EnhancementEngine engine, IRI contentItemId) {
LiteralFactory literalFactory = LiteralFactory.getInstance();
IRI enhancement = new IRI("urn:enhancement-" + EnhancementEngineHelper.randomUUID());
//add the Enhancement Type
metadata.add(new TripleImpl(enhancement, RDF_TYPE, ENHANCER_ENHANCEMENT));
//add the extracted from content item
metadata.add(new TripleImpl(enhancement, ENHANCER_EXTRACTED_FROM, contentItemId));
// creation date
metadata.add(new TripleImpl(enhancement, DC_CREATED, literalFactory.createTypedLiteral(new Date())));
// the engines that extracted the data
// TODO: add some kind of versioning info for the extractor?
// TODO: use a public dereferencing URI instead? that would allow for
// explicit versioning too
/* NOTE (Rupert Westenthaler 2010-05-26):
* The Idea is to use the ComponentContext in the activate() method of
* an Enhancer to get the bundle name/version and use that as an
* URI for the creator.
* We would need to add getEnhancerID() method to the enhancer interface
* to access this information
*/
metadata.add(new TripleImpl(enhancement, DC_CREATOR, literalFactory.createTypedLiteral(engine.getClass().getName())));
return enhancement;
}
use of org.apache.clerezza.commons.rdf.impl.utils.TripleImpl in project stanbol by apache.
the class EnhancementEngineHelper method createNewExtraction.
/**
* Create a new extraction instance in the metadata-graph of the content
* item along with default properties (dc:creator and dc:created) and return
* the IRI of the extraction so that engines can further add
*
* @param ci the ContentItem being under analysis
* @param engine the Engine performing the analysis
* @return the URI of the new extraction instance
* @deprecated will be remove with 1.0
* @see EnhancementEngineHelper#createEntityEnhancement(ContentItem, EnhancementEngine)
* @see EnhancementEngineHelper#createTextEnhancement(ContentItem, EnhancementEngine)
*/
@Deprecated
public static IRI createNewExtraction(ContentItem ci, EnhancementEngine engine) {
LiteralFactory literalFactory = LiteralFactory.getInstance();
Graph metadata = ci.getMetadata();
IRI extraction = new IRI("urn:extraction-" + EnhancementEngineHelper.randomUUID());
metadata.add(new TripleImpl(extraction, RDF_TYPE, ENHANCER_EXTRACTION));
// relate the extraction to the content item
metadata.add(new TripleImpl(extraction, ENHANCER_RELATED_CONTENT_ITEM, new IRI(ci.getUri().getUnicodeString())));
// creation date
metadata.add(new TripleImpl(extraction, DC_CREATED, literalFactory.createTypedLiteral(new Date())));
// the engines that extracted the data
// TODO: add some kind of versioning info for the extractor?
// TODO: use a public dereferencing URI instead? that would allow for
// explicit versioning too
metadata.add(new TripleImpl(extraction, DC_CREATOR, literalFactory.createTypedLiteral(engine.getClass().getName())));
return extraction;
}
use of org.apache.clerezza.commons.rdf.impl.utils.TripleImpl 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;
}
Aggregations