Examples of computeEnhancements()


Examples of org.apache.stanbol.enhancer.engines.keywordextraction.engine.KeywordLinkingEngine.computeEnhancements()

        engine.referencedSiteName = TEST_REFERENCED_SITE_NAME;
        ContentItem ci = ciFactory.createContentItem(new StringSource(TEST_TEXT));
        //tells the engine that this is an English text
        ci.getMetadata().add(new TripleImpl(ci.getUri(), DC_LANGUAGE, new PlainLiteralImpl("en")));
        //compute the enhancements
        engine.computeEnhancements(ci);
        //validate the enhancement results
        Map<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>();
        expectedValues.put(ENHANCER_EXTRACTED_FROM, ci.getUri());
        expectedValues.put(DC_CREATOR,LiteralFactory.getInstance().createTypedLiteral(
            engine.getClass().getName()));
View Full Code Here

Examples of org.apache.stanbol.enhancer.engines.langid.LangIdEnhancementEngine.computeEnhancements()

        LangIdEnhancementEngine langIdEngine = new LangIdEnhancementEngine();
        ComponentContext context =  new MockComponentContext();
        context.getProperties().put(EnhancementEngine.PROPERTY_NAME, "langid");
        langIdEngine.activate(context);
        ContentItem ci = ciFactory.createContentItem(new StringSource(text));
        langIdEngine.computeEnhancements(ci);
        HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>();
        expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri());
        expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral(
            langIdEngine.getClass().getName()));
        int textAnnotationCount = validateAllTextAnnotations(ci.getMetadata(), text, expectedValues);
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.computeEnhancements()

            if (engine.canEnhance(ci) == EnhancementEngine.CANNOT_ENHANCE) {
                log.debug("[{}] cannot be enhanced by engine [{}], skipping",
                        ci.getUri().getUnicodeString(), engine);
            } else {
                // TODO should handle sync/async enhancing. All sync for now.
                engine.computeEnhancements(ci);
                log.debug("ContentItem [{}] enhanced by engine [{}] in {}ms",
                        new Object[]{ci.getUri().getUnicodeString(), engine,System.currentTimeMillis()-startEngine});
            }
        }
        log.debug("ContentItem [{}] enhanced in {}ms",ci.getUri().getUnicodeString(),(System.currentTimeMillis()-start));
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.computeEnhancements()

                //ensure that this engine exclusively access the content item
                log.trace("++ w: {}: {}","start sync execution", engine.getName());
                job.getLock().writeLock().lock();
                log.trace(">> w: {}: {}","start sync execution", engine.getName());
                try {
                    engine.computeEnhancements(job.getContentItem());
                    job.setCompleted(execution);
                } catch (EngineException e){
                    log.warn(e.getMessage(),e);
                    job.setFailed(execution, engine, e);
                } catch (RuntimeException e){
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.computeEnhancements()

                    job.getLock().writeLock().unlock();
                }
            } else if(engineState == EnhancementEngine.ENHANCE_ASYNC){
                try {
                    log.trace("++ n: start async execution of Engine {}",engine.getName());
                    engine.computeEnhancements(job.getContentItem());
                    log.trace("++ n: finished async execution of Engine {}",engine.getName());
                    job.setCompleted(execution);
                } catch (EngineException e) {
                    log.warn(e.getMessage(),e);
                    job.setFailed(execution, engine, e);
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.computeEnhancements()

                //ensure that this engine exclusively access the content item
                log.trace("++ w: {}: {}","start sync execution", engine.getName());
                job.getLock().writeLock().lock();
                log.trace(">> w: {}: {}","start sync execution", engine.getName());
                try {
                    engine.computeEnhancements(job.getContentItem());
                    job.setCompleted(execution);
                } catch (EngineException e){
                    log.warn(e.getMessage(),e);
                    job.setFailed(execution, engine, e);
                } catch (RuntimeException e){
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.computeEnhancements()

                    job.getLock().writeLock().unlock();
                }
            } else if(engineState == EnhancementEngine.ENHANCE_ASYNC){
                try {
                    log.trace("++ n: start async execution of Engine {}",engine.getName());
                    engine.computeEnhancements(job.getContentItem());
                    log.trace("++ n: finished async execution of Engine {}",engine.getName());
                    job.setCompleted(execution);
                } catch (EngineException e) {
                    log.warn(e.getMessage(),e);
                    job.setFailed(execution, engine, e);
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.computeEnhancements()

                //ensure that this engine exclusively access the content item
                log.debug("++ w: {}: {}","start sync execution", engine.getName());
                job.getLock().writeLock().lock();
                log.debug(">> w: {}: {}","start sync execution", engine.getName());
                try {
                    engine.computeEnhancements(job.getContentItem());
                    job.setCompleted(execution);
                } catch (EngineException e){
                    job.setFailed(execution, engine, e);
                } finally{
                    log.debug("<< w: {}: {}","finished sync execution", engine.getName());
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.computeEnhancements()

                    job.getLock().writeLock().unlock();
                }
            } else if(engineState == EnhancementEngine.ENHANCE_ASYNC){
                try {
                    log.debug("++ n: start async execution of Engine {}",engine.getName());
                    engine.computeEnhancements(job.getContentItem());
                    log.debug("++ n: finished async execution of Engine {}",engine.getName());
                    job.setCompleted(execution);
                } catch (EngineException e) {
                    job.setFailed(execution, engine, e);
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.