Overview
Some of the pipeline processing elements enable you to use javascript to obtain metadata, create entities/associations, and perform a few other operations.
For example, the following list of elements can all make use of javascript:
- docMetadata
- contentMetadata
- text extraction
- criteria
- Follow Web Links/split
For the most part, examples involving javascript are described on the individual pages that define and describe these elements.
This page serves to set out some general guidelines and best practices for using javascript.
About The Javascript Framework
The Infinit.e platform supports scripting the transformation of source data using JavaScript via Rhino, Mozilla's open-source JavaScript implementation (http://www.mozilla.org/rhino/).
Note that unless turned off from the configuration files (via the "harvest.security" property), Javascript is prevented by the Java security manager from doing the following:
- "Internal" network access (ie to addresses 127.*.*.*, 10.*.*.* or 192.168.*.*)
- File access.
Importing
The Infinit.e Structured Analysis Harvester supports importing of JavaScript functions in two ways currently:
- specifying a javascript code block
- a lit or urls of javascript locations that can be imported.
Javascript Use Cases
In general terms, theuse of javascript for IKANOWs falls into several major categories
- obtaining metadata
- creating entities and associations
- using javascript for criteria, and other miscellaneous scenarios
Obtaining Metadata
When data is ingested into IKANOWs it is converted into metadata objects which are then available to functions and inline scripts.
You can get configure how you will get the metadata out of the text or metadata by setting script flags. For example, you can receive the metadata as _doc, _metadata, or as full text.
For more information about using javascript to get metadata and for detailed descriptions, see Content metadata, Manual text transformation.
Creating Entities and Associations
You can use javascript to create entities and associations by calling the metadata using the $SCRIPT and $FUNC scripting conventions.
For example, When document metadata iterates over a JSON array each item in the array is passed into the ScriptEngine and is made accessible via an object named: _iterator.
For more information about using javascript to create entities and associations, see Manual entities, Manual association of entities.
Criteria
IN PROGRESS