Hello,
how do I get the AnalysedText content part when using the REST API?
I'm trying to execute an enhancement chain via the REST API by calling
each enhancement engine with the result of the preceeding. This works
for the langdetect engine but when I'm calling some other engines, like
the opennlp-sentence engine, the result seems contain no additional
information. The error log is clean:
"19.07.2016 10:03:51.190 *INFO* [qtp298757786-36]
org.apache.stanbol.enhancer.jobmanager.event.impl.EventJobManagerImpl
Execution of Chain opennlp-sentenceChain finished after 3ms for
ContentItem
<urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce>
19.07.2016 10:03:51.190 *INFO* [qtp298757786-36]
org.apache.stanbol.enhancer.servicesapi.EnhancementJobManager >
processed ContentItem
<urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce> with
Chain 'opennlp-sentenceChain' in 2ms | chain:[opennlp-sentence: 2ms
(100%)], concurrency: 1.0 (0%)"
But the result seems to not contain the AnalysedText part which causes
errors in later steps.
The engines I try to call:
1. Tika
2. langdetect
3. opennlp-sentence
4. opennlp-token
5. opennlp-pos
6. opennlp-chunker
What I did so far:
- Get Stanbol code from https://svn.apache.org/repos/asf/stanbol/trunk/
- Build Stanbol with mvn clean install -DskipTests
- Start Stanbol with java -Xmx1g -jar
./org.apache.stanbol.launchers.stable-1.0.0-SNAPSHOT.jar
- Use Firefox HttpRequester Plugin to send a Requests to the
langdetect-Engine at
http://localhost:8080/enhancer/engine/langdetect?outputContent=*/*
with "Accept multipart/form-data" Header
- Received enhanced content (see below)
- Send this with content type "multipart/form-data; charset=UTF-8;
boundary=contentItem-U9u25OIBks0JM-j1GP" to
http://localhost:8080/enhancer/engine/opennlp-pos?outputContent=*/*
- Received the response shown below
- Send the response to the opennlp-chunker at
"http://localhost:8080/enhancer/engine/opennlp-chunker?outputContent=*/*"
with "multipart/form-data; charset=UTF-8;
boundary=contentItem-KFLGIdIWg8rZZ7AF_"
- Receive response with status 200 OK and content equal to the content
of the request
- error log:
> 19.07.2016 10:14:24.360 *WARN* [Thread-9]
org.apache.stanbol.enhancer.nlp.utils.NlpEngineHelper The Enhancement
Engine 'opennlp-chunker (impl: OpenNlpChunkingEngine)' CAN NOT enhance
ContentItem InMemoryContentItem
uri=[urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce],
content=[size:204 bytes;;mime-type:text/plain], metadata=[8 triples],
parts=[<urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce_main>,
<urn:apache.org:stanbol.enhancer:request.properties>,
<http://stanbol.apache.org/ontology/enhancer/executionmetadata#ChainExecution>]
because the AnalysedText ContentPart is missing. Users might want to add
an EnhancementEngine that creates the AnalysedText ContentPart such as
the POSTaggingEngine (o.a.stanbol.enhancer.engines.opennlp.pos)!
###########################################################################################
Content from langdetect:
###########################################################################################
--contentItem-U9u25OIBks0JM-j1GP
Content-Disposition: form-data; name="metadata";
filename="urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce"
Content-Type: application/ld+json; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ {
"@id" : "urn:enhancement-25ded47b-bdd2-cef8-abee-7ea258c03390",
"http://fise.iks-project.eu/ontology/confidence" : [ {
"@value" : "0.9999959994881431",
"@type" : "http://www.w3.org/2001/XMLSchema#double"
} ],
"http://fise.iks-project.eu/ontology/extracted-from" : [ {
"@id" :
"urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce"
} ],
"http://purl.org/dc/terms/created" : [ {
"@value" : "2016-07-14T15:12:09.795Z",
"@type" : "http://www.w3.org/2001/XMLSchema#dateTime"
} ],
"http://purl.org/dc/terms/creator" : [ {
"@value" :
"org.apache.stanbol.enhancer.engines.langdetect.LanguageDetectionEnhancementEngine"
} ],
"http://purl.org/dc/terms/language" : [ {
"@value" : "en"
} ],
"http://purl.org/dc/terms/type" : [ {
"@id" : "http://purl.org/dc/terms/LinguisticSystem"
} ],
"@type" : [ "http://fise.iks-project.eu/ontology/Enhancement",
"http://fise.iks-project.eu/ontology/TextAnnotation" ]
} ]
--contentItem-U9u25OIBks0JM-j1GP
Content-Disposition: form-data; name="content"
Content-Type: multipart/alternate;
boundary=contentParts-U9u25OIBks0JM-j1GP
Content-Transfer-Encoding: 8bit
--contentParts-U9u25OIBks0JM-j1GP
Content-Disposition: form-data;
name="urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce_main"
Content-Type: text/plain
Content-Transfer-Encoding: binary
The Stanbol enhancer can detect famous cities such as Paris and people
such as Bob Marley. It is hard to use its REST-API. We will see if the
language detection works, if there are more than one sentence.
--contentParts-U9u25OIBks0JM-j1GP--
--contentItem-U9u25OIBks0JM-j1GP--
###########################################################################################
Content from opennlp-pos:
###########################################################################################
--contentItem-KFLGIdIWg8rZZ7AF_
Content-Disposition: form-data; name="metadata";
filename="urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce"
Content-Type: application/ld+json; charset=UTF-8
Content-Transfer-Encoding: 8bit
[ {
"@id" : "urn:enhancement-25ded47b-bdd2-cef8-abee-7ea258c03390",
"http://fise.iks-project.eu/ontology/confidence" : [ {
"@value" : "0.9999959994881431",
"@type" : "http://www.w3.org/2001/XMLSchema#double"
} ],
"http://fise.iks-project.eu/ontology/extracted-from" : [ {
"@id" :
"urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce"
} ],
"http://purl.org/dc/terms/created" : [ {
"@value" : "2016-07-14T15:12:09.795Z",
"@type" : "http://www.w3.org/2001/XMLSchema#dateTime"
} ],
"http://purl.org/dc/terms/creator" : [ {
"@value" :
"org.apache.stanbol.enhancer.engines.langdetect.LanguageDetectionEnhancementEngine"
} ],
"http://purl.org/dc/terms/language" : [ {
"@value" : "en"
} ],
"http://purl.org/dc/terms/type" : [ {
"@id" : "http://purl.org/dc/terms/LinguisticSystem"
} ],
"@type" : [ "http://fise.iks-project.eu/ontology/Enhancement",
"http://fise.iks-project.eu/ontology/TextAnnotation" ]
} ]
--contentItem-KFLGIdIWg8rZZ7AF_
Content-Disposition: form-data; name="content"
Content-Type: multipart/alternate;
boundary=contentParts-KFLGIdIWg8rZZ7AF_
Content-Transfer-Encoding: 8bit
--contentParts-KFLGIdIWg8rZZ7AF_
Content-Disposition: form-data;
name="urn:content-item-sha1-ccfad800c413a3ba0297c202badb0eaebb4a57ce_main"
Content-Type: text/plain
Content-Transfer-Encoding: binary
The Stanbol enhancer can detect famous cities such as Paris and people
such as Bob Marley. It is hard to use its REST-API. We will see if the
language detection works, if there are more than one sentence.
--contentParts-KFLGIdIWg8rZZ7AF_--
--contentItem-KFLGIdIWg8rZZ7AF_--