當前位置: 首頁>>代碼示例>>Java>>正文


Java TechnicalClasses類代碼示例

本文整理匯總了Java中org.apache.stanbol.enhancer.servicesapi.rdf.TechnicalClasses的典型用法代碼示例。如果您正苦於以下問題:Java TechnicalClasses類的具體用法?Java TechnicalClasses怎麽用?Java TechnicalClasses使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TechnicalClasses類屬於org.apache.stanbol.enhancer.servicesapi.rdf包,在下文中一共展示了TechnicalClasses類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addSubjects

import org.apache.stanbol.enhancer.servicesapi.rdf.TechnicalClasses; //導入依賴的package包/類
/**
 * Add dc:subject property to items pointing to entities extracted by NLP
 * engines in the default chain. Given a node and a TripleCollection
 * containing fise:Enhancements about that node dc:subject properties are
 * added to an item pointing to entities referenced by those enhancements if
 * the enhancement confidence value is above a threshold.
 *
 * @param node
 * @param metadata
 */
private void addSubjects(MGraph targetGraph, UriRef itemRef, TripleCollection metadata) {
    final GraphNode enhancementType = new GraphNode(TechnicalClasses.ENHANCER_ENHANCEMENT, metadata);
    final Set<UriRef> entities = new HashSet<UriRef>();
    // get all the enhancements
    final Iterator<GraphNode> enhancements = enhancementType.getSubjectNodes(RDF.type);
    while (enhancements.hasNext()) {
        final GraphNode enhhancement = enhancements.next();
        final Iterator<Literal> confidenceLiterals = enhhancement.getLiterals(org.apache.stanbol.enhancer.servicesapi.rdf.Properties.ENHANCER_CONFIDENCE);
        //look the confidence value for each enhancement
        double enhancementConfidence = confidenceLiterals.hasNext() ? 
                LiteralFactory.getInstance().createObject(Double.class,
                (TypedLiteral) confidenceLiterals.next())  : 1;
        if (enhancementConfidence >= confidenceThreshold) {
            // get entities referenced in the enhancement 
            final Iterator<Resource> referencedEntities = enhhancement.getObjects(org.apache.stanbol.enhancer.servicesapi.rdf.Properties.ENHANCER_ENTITY_REFERENCE);
            while (referencedEntities.hasNext()) {
                final UriRef entity = (UriRef) referencedEntities.next();
                // Add dc:subject to the patent for each referenced entity
                targetGraph.add(new TripleImpl(itemRef, DC.subject, entity));
                entities.add(entity);
            }
        }

    }
    for (UriRef uriRef : entities) {
        // We don't get the entity description directly from metadata
        // as the context there would include
        addResourceDescription(uriRef, targetGraph);
    }
}
 
開發者ID:fusepool,項目名稱:datalifecycle,代碼行數:41,代碼來源:SourcingAdmin.java


注:本文中的org.apache.stanbol.enhancer.servicesapi.rdf.TechnicalClasses類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。