Package org.apache.stanbol.enhancer.servicesapi

Examples of org.apache.stanbol.enhancer.servicesapi.EngineException


            }
        } catch (Exception e) {
          if (e instanceof RuntimeException) {
            throw (RuntimeException)e;
          } else {
            throw new EngineException(this, ci, e);
          }
        }
    }
View Full Code Here


                    entry.getValue(), contentLangauge);
                if (entitySuggestions != null && !entitySuggestions.isEmpty()) {
                    suggestions.put(entry.getKey(), entitySuggestions);
                }
            } catch (EntityhubException e) {
                throw new EngineException(this, ci, e);
            }
        }
        // now write the results (requires write lock)
        ci.getLock().writeLock().lock();
        try {
View Full Code Here

                    Token token = tokens.next();
                    tokenList.add(token);
                    tokenTextList.add(token.getSpan());
                    Value<PosTag> posValue = token.getAnnotation(POS_ANNOTATION);
                    if(posValue == null){
                        throw new EngineException("Missing POS value for Token '"
                            + token.getSpan()+" of ContentItem "+ci.getUri()
                            + "(Sentence: '"+sentence.getSpan()+"'). This may "
                            + "indicate that a POS tagging Engine is missing in "
                            + "the EnhancementChain or that the used POS tagging "
                            + "does not provide POS tags for each token!");
View Full Code Here

        } catch (NoConvertorException e) {
          log.error(e.getMessage(), e);
        }
      }
        } catch (IOException e) {
            throw new EngineException("Error while calling the CELI Sentiment Analysis service (configured URL: " +serviceURL+")!",e);
        } catch (SOAPException e) {
            throw new EngineException("Error wile encoding/decoding the request/response to the CELI Sentiment Analysis service!",e);
        }

  }
View Full Code Here

        MGraph results = new SimpleMGraph();
        ZemantaAPIWrapper zemanta = new ZemantaAPIWrapper(key);
        try {
            results.addAll(zemanta.enhance(text));
        } catch (IOException e) {
           throw new EngineException("Unable to get Enhancement from remote Zemanta Service",e);
        }
        //now we need to process the results and convert them into the Enhancer
        //annotation structure
        ci.getLock().writeLock().lock();
        try {
View Full Code Here

        } else { //try to load the configured model
            TokenizerModel model;
            try {
                model = openNLP.getModel(TokenizerModel.class, modelName, null);
            } catch (Exception e) {
                throw new EngineException("Error while loading the configured OpenNLP "
                    + "TokenizerModel '"+modelName+"' ("+getClass().getSimpleName()+" | name="
                    + getName() + ")!",e);
            }
            if(model == null){
                throw new EngineException("The configured OpenNLP TokenizerModel '"
                        + modelName +" is not available' ("+getClass().getSimpleName()
                        + " | name=" + getName() + ")!");
            }
            return new TokenizerME(model);
        }
View Full Code Here

                     * This depends if single requests can result in Exceptions
                     * (e.g. because of encoding problems) or if usually Exceptions
                     * are thrown because of general things like connection issues
                     * or service unavailability.
                     */
                throw new EngineException(this, ci, e);
            }
            if (results != null) {
                for (Toponym result : results) {
                    log.debug("process result {} {}",result.getGeoNameId(),result.getName());
                    Double score = getToponymScore(result);
View Full Code Here

        MGraph model = new SimpleMGraph();
        ci.getLock().readLock().lock();
        try {
            extractor.extract(ci.getUri().getUnicodeString(), ci.getStream(),null, ci.getMimeType(), model);
        } catch (ExtractorException e) {
            throw new EngineException("Error while processing ContentItem "
                    + ci.getUri()+" with HtmlExtractor",e);
        } finally {
            ci.getLock().readLock().unlock();
        }
        ClerezzaRDFUtils.urifyBlankNodes(model);
View Full Code Here

    Language lang = new Language(language); // clerezza language for PlainLiterals
    List<LexicalEntry> terms;
    try {
      terms = this.client.performMorfologicalAnalysis(text, language);
    } catch (IOException e) {
      throw new EngineException("Error while calling the CELI Lemmatizer" + " service (configured URL: " + serviceURL + ")!", e);
    } catch (SOAPException e) {
      throw new EngineException("Error wile encoding/decoding the request/" + "response to the CELI lemmatizer service!", e);
    }
    // get a write lock before writing the enhancements
    ci.getLock().writeLock().lock();
    try {
      LiteralFactory literalFactory = LiteralFactory.getInstance();
View Full Code Here

    Language lang = new Language(language); // clerezza language for PlainLiterals
    String lemmatizedContents;
    try {
      lemmatizedContents = this.client.lemmatizeContents(text, language);
    } catch (IOException e) {
      throw new EngineException("Error while calling the CELI Lemmatizer" + " service (configured URL: " + serviceURL + ")!", e);
    } catch (SOAPException e) {
      throw new EngineException("Error wile encoding/decoding the request/" + "response to the CELI lemmatizer service!", e);
    }
    // get a write lock before writing the enhancements
    ci.getLock().writeLock().lock();
    try {
      UriRef textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this);
View Full Code Here

TOP

Related Classes of org.apache.stanbol.enhancer.servicesapi.EngineException

Copyright © 2018 www.massapicom. 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.