fusepoolp3 / p3-datatxt-stanbol Goto Github PK
View Code? Open in Web Editor NEWA Stanbol Enhancement Engine using dataTXT
License: Apache License 2.0
A Stanbol Enhancement Engine using dataTXT
License: Apache License 2.0
The trace
Caused by: java.lang.ClassCastException: org.apache.clerezza.rdf.core.UriRef cannot be cast to java.io.Serializable
at eu.spaziodati.datatxt.stanbol.enhancer.engines.translators.FiseTranslator.translate(FiseTranslator.java:47)
at eu.spaziodati.datatxt.stanbol.enhancer.engines.DatatxtNexEngine.computeEnhancements(DatatxtNexEngine.java:160)
This is cause by this logging in the following code snipet
public void translate(Pair<UriRef, MGraph> item, EnhancementEngine engine, String text, DatatxtResponse datatxtResponse) {
LOG.info(String.format("DatatxtAnnotator: Enhance ContentItem with FISE Annotations: ContentItem=%s, " +
"DatatxtResponse=%s", (item != null ? item.getKey() : item), GSON.toJson(datatxtResponse)));
Language lang = datatxtResponse.lang != null ? new Language(datatxtResponse.lang) : null;
Not sure why this fries to cast the UriRef - probably item.getKey() to Serializable, but removing the logging definitely solves the issue. I guess it has something to do with the inline if and generic type removal.
In any case this logging is problematic as regardless of the LOG level GSON.toJson(datatxtResponse)
is called - what I assume to be an expensive operation.
When sending a text with an unsupported Language the engine currently fails with a
Caused by: eu.spaziodati.datatxt.stanbol.enhancer.engines.client.DatatxtException: Unmanaged language'es'
at eu.spaziodati.datatxt.stanbol.enhancer.engines.client.DatatxtClient.performRequest(DatatxtClient.java:186)
This is not what a Stanbol Enhancement Engine is supposed to do. Instead an engine should check for supported languages within the canEnhance(..)
method and refuse to enhance content with unsupported language. But what it MUST NOT do is to fail in the computeEnhancement(..)
method because it accepted a request for an unsupported language
Their are the following possibilities to solve this:
canEnhance(..)
so that contents with unsupported languages are refusedde | en | fr | it | pt
canEnhance(..)
would accept content in any language, but the engine would not "crash" the enhancement chain in case of an unsupported one.As I do not see a service that can be used for (1) and I do not want to require code changes for the engine if dataTXT adds additional lanugages i will go for option (3) to fix this issue.
However I would strongly prefer a solution that can already decline requests in the canEnhance(..)
as this would avoid calls to the dataTXT service.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.