Wiki
Clone wikicamel-taxon / Home
Taxon Component
Taxon is an Open Source system for tagging/classifying electronic documents with metadata using a custom taxonomy. Read more about taxon here http://www.taxon.dk/about-taxon.
The Camel taxon: component uses a Taxon webservice to classify a message.
The component is only compatible with Taxon version 3.x
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency> <groupId>dk.syddjurs.camel</groupId> <artifactId>camel-taxon</artifactId> <version>1.0.0</version> </dependency>
URI format
taxon:endpointUrl[?options]
Options
Property | Default | Usage | Description |
---|---|---|---|
taxonomy | null | Required | The relative path to the taxonomy to use. E.g. ../system/taxonomies/test_lookup.json |
text | null | Optional | By default the component will classify the text in the message body. If this text property is set the component will classify the value of this property instead of the message body. |
subject | null | Optional | If specified, the text value in this setting will also be used when Taxon classifies the message. Use it if you have document title, email subject, file name or other important metadata you want Taxon to use when classifying the message. |
settings | null | Optional | Json array of settings sent to the Taxon web service. Refer to the Taxon manual for details about possible settings. E.g. {"numberResultsReturned":1,"onNoResultsIgnoreTermConstraints":1} |
Exchange data format
Camel will leave the message body unmodified. Results from the Taxon service are returned in headers (see section below)
Message Headers
Header | Description |
---|---|
CamelTaxonStatus | The status returned from the Taxon service. E.g. "OK", "Error". |
CamelTaxonError | If CamelTaxonStatus equals "Error", this header contains a json array of ErrorCode and ErrorText entries. E.g. [{\"ErrorCode\":\"9010\",\"ErrorText\":\"Text is empty\"}] |
CamelTaxonFullResult | The raw result returned from the Taxon service. |
CamelTaxonClass | The name of the highest ranked class. E.g. 01.02. If no class was found this header is not set. |
CamelTaxonTitle | The title of the higest ranked class. E.g. Scandinavia. If no class was found this header is not set. |
CamelTaxonScoreTotal | The ScoreTotal value of the higest ranked class. E.g. 15. If no class was found this header is not set. |
CamelTaxonConfidenceCoefficient | The ConfidenceCoefficient value of the highest ranked class. E.g. 100. If no class was found this header is not set. |
Samples
Classifying a message body
from("direct:start") .setBody(simple("Denmark")) .to("taxon:http://www.example.org/taxon-ws.php?taxonomy=../system/taxonomies/test_lookup.json) .log("CamelTaxonFullResult: ${in.header.CamelTaxonFullResult}") .to("mock:result");
Classifying custom text sent as parameter
from("direct:start") .to("taxon:http://www.example.org/taxon-ws.php?taxonomy=../system/taxonomies/test_lookup.json&text=Denmark) .log("CamelTaxonFullResult: ${in.header.CamelTaxonFullResult}") .to("mock:result");
Updated