...
The creationCriteriaScript runs before the association is generated (so can be safely used to remove items that would return errors).
See detailed example below
Examples
Basic Association
...
Would generate the 2 associations "alex/person lives in baltimore/city" and "craig/person lives in washintgon dc/city".
Anchor | ||||
---|---|---|---|---|
|
The associations code block below creates associations based on a twitter user(actor).
The creationCriteriaScript
establishes conditions for the creation of associations. For objects returned that do not match, associations are not created.
Code Block |
---|
},
{
"associations": [
{
"assoc_type": "Event",
"creationCriteriaScript": "$SCRIPT( return (null != _doc.metadata.json[0].object.actor); )",
"entity1_index": "$SCRIPT( return _doc.metadata.json[0].actor.preferredUsername + '/twitterhandle';)",
"entity2_index": "$SCRIPT( return _doc.metadata.json[0].object.actor.preferredUsername + '/twitterhandle';)",
"verb": "retweets",
"verb_category": "retweets"
},
{
"assoc_type": "Event",
"creationCriteriaScript": "$SCRIPT( return (null != _doc.metadata.json[0].object.actor) && (null != _doc.metadata.json[0].object.actor.location); )",
"entity1_index": "$SCRIPT( return _doc.metadata.json[0].object.actor.preferredUsername + '/twitterhandle';)",
"entity2_index": "$SCRIPT( return _doc.metadata.json[0].object.actor.location.displayName+ '/location';)",
"verb": "twitter_location",
"verb_category": "twitter_location"
},
{
"assoc_type": "Event",
"entity1_index": "$SCRIPT( return _doc.metadata.json[0].actor.preferredUsername + '/twitterhandle';)",
"entity2_index": "$SCRIPT( return _iterator.text + '/hashtag'; )",
"iterateOver": "json.twitter_entities.hashtags",
"verb": "tweets_about",
"verb_category": "tweets_about"
},
{
"assoc_type": "Event",
"entity1_index": "$SCRIPT( return _doc.metadata.json[0].actor.preferredUsername + '/twitterhandle';)",
"entity2_index": "$SCRIPT( return _iterator.screen_name + '/twitterhandle'; )",
"iterateOver": "json.twitter_entities.user_mentions",
"verb": "tweets_to",
"verb_category": "tweets_to"
},
{
"assoc_type": "Event",
"entity1_index": "$SCRIPT( return _doc.metadata.json[0].actor.preferredUsername + '/twitterhandle';)",
"entity2_index": "$SCRIPT( return _iterator.expanded_url + '/url'; )",
"iterateOver": "json.gnip.urls",
"verb": "tweets_link",
"verb_category": "tweets_link"
}
]
}, |
Output:
The following associations are output, based on the entity types and the creationcriteriaScript.
Code Block |
---|
{
"associations": [
{
"assoc_type": "Event",
"entity1": "focalcrm",
"entity1_index": "focalcrm/twitterhandle",
"entity2": "crm",
"entity2_index": "crm/hashtag",
"verb": "tweets_about",
"verb_category": "tweets_about"
},
{
"assoc_type": "Event",
"entity1": "focalcrm",
"entity1_index": "focalcrm/twitterhandle",
"entity2": "http://www.crmbuyer.com/rsstory/76578.html",
"entity2_index": "http://www.crmbuyer.com/rsstory/76578.html/url",
"verb": "tweets_link",
"verb_category": "tweets_link"
} |
Panel |
---|
Footnotes: Legacy documentation: Legacy documentation:
|
...