Overview
This toolkit element enables the generation of one or more types of entity based on the document or content metadata. The expressions default to replacement strings, or $SCRIPT(...) can be used to return a string using javascript.
...
See detailed example below.
...
iterateOver
For Manual Entities you can use iterateOver
, in the more advanced case where you want to extract entities from metadata arrays.
...
You can still throw errors from the script by checking if "(_iterator==null)" if you want to) This enables writing objects that will handle fields being either primitives or objects (eg by checking vs _iterator and _value).
...
creationcriteriaScripts
You can use "creationCriteriaScript" scriptlets to filter out unwanted entities. eg when looping over metadata arrays.
...
Code Block |
---|
], "mediaType": ["Social"], "metadata": {"json": [{ "actor": { "displayName": "CRM Buddy", "followersCount": "245", "friendsCount": "0", "id": "id:twitter.com:835627776", "image": "http://a0.twimg.com/profile_images/2630355549/8cad59efaddd57283dbb159332336744_normal.jpeg", "languages": ["en"], "link": "http://www.twitter.com/FocalCRM", "links": [{"rel": "me"}], "listedCount": "6", "objectType": "person", "postedTime": "2012-09-20T13:59:56.000Z", "preferredUsername": "FocalCRM", "statusesCount": "3688", "summary": "", "verified": "false" }, |
...
Extracting Entities From Arrays with iterateOver
You can use iterateOver
to create an entity for each object in an array.
...
Code Block |
---|
"victim": [ { "child": "No", "combatant": "No", "deadcount": "1", "definingcharacteristic": "Unknown", "hostagecount": "0", "indicator": "Targeted", "nationality": "Afghanistan", "targetedcharacteristic": "Unknown", "victimtype": "Civilian", "woundedcount": "4" }, { "child": "Yes", "combatant": "No", "deadcount": "2", "definingcharacteristic": "Unknown", "hostagecount": "0", "indicator": "Targeted", "nationality": "Afghanistan", "targetedcharacteristic": "Unknown", "victimtype": "Civilian", "woundedcount": "0" } ], |
...
Specifying Entity Geographic Location
It is also possible to set values for entity parameters using Javascript functions declared in Globals.
...