Overview
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/). The following document provides an introduction to specifying JavaScript based data transformation via the Structured Analysis Harvester object.
...
- A boolean, in which case the entity object is only created if
- A string, in which case any non-null string is treated like a boolean false, and in addition the string is logged as an error that can be accessed from the "harvest.harvest_message" field of sources.
Info |
---|
The creation criteria script is executed before any other scripts in the specification object. |
...
- At the top level of the "structuredAnalysis" object, create a "caches" object that consists of the following:
- For every lookup table, a local name you specify and then the "_id" field of a JSON share (see share API documentation, or uploaded via the File Uploader). For example:
Code Block | ||
---|---|---|
| ||
"structuredAnalysis": { "caches": { "myLookupTable": "4e0c7e99eb5af0fbdcfbf697" } } |
- Then within any script in the "structuredAnalysis", you can access the JSON object by indexing the global variable "_cache" with the local name specified as above. For example, say the following JSON object has been uploaded:
...
Code Block |
---|
{ "structuredAnalysis": { // (caches object specified as above) //... "entities": [ //... { "iterateOver": "geo.countries", "disambiguatedName": "$SCRIPT( return _cache['myLookupTable'][ _value ];)", "type": "Country" } ], //... } } |
...