Wiki

Clone wiki

camel-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

PropertyDefaultUsageDescription
taxonomynullRequiredThe relative path to the taxonomy to use. E.g. ../system/taxonomies/test_lookup.json
textnullOptionalBy 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.
subjectnullOptionalIf 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.
settingsnullOptionalJson 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

HeaderDescription
CamelTaxonStatusThe status returned from the Taxon service. E.g. "OK", "Error".
CamelTaxonErrorIf CamelTaxonStatus equals "Error", this header contains a json array of ErrorCode and ErrorText entries.
E.g. [{\"ErrorCode\":\"9010\",\"ErrorText\":\"Text is empty\"}]
CamelTaxonFullResultThe raw result returned from the Taxon service.
CamelTaxonClassThe name of the highest ranked class. E.g. 01.02.
If no class was found this header is not set.
CamelTaxonTitleThe title of the higest ranked class. E.g. Scandinavia.
If no class was found this header is not set.
CamelTaxonScoreTotalThe ScoreTotal value of the higest ranked class. E.g. 15.
If no class was found this header is not set.
CamelTaxonConfidenceCoefficientThe 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