Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The following code demonstrates how to specify a basic association (Note: The sample event specification and sample event output below is extracted from a sample MySql Database Source the full content of which can be viewed here.):

Code Block
titleBasic Event Specification Example
{
    //...
    "associations" : [
      {
        "entity1" : "$metadata.offense,$metadata.method",
        "verb" : "reported",
        "verb_category" : "crime",
        "time_start" : "$metadata.reportdatetime", 
        "geo_index" : "Location",
        "geotag" : {
           "lat" : "$metadata.latitude",
           "lon" : "$metadata.longitude"}
      },
    ],
    //...
}

...

  • event_type
    "Event", "Fact", "Summary"
    The "assoc_type" field sub-categorizes the "event" object into one of three types, "Event", "Fact", or "Summary". Examples provided below should make the distinction clearer, but it can be simply described as follows:
    • "Event": link multiple entities (via "entity1_index", "entity2_index", "geo_index") and represent a transient activity (eg travel)
    • "Fact": link multiple entities like "Events" but represent (transient or permanent) relationships (eg being president)
    • "Summary": generally link 1 entity to a free text (eg a quotation: "Obama says...").
Specifying

...

Additive events

Specifying Multiplicative Associations

Multiplicative association are associations that are created by "multiplying" a combination of entities, locations, and times together to determine the number of associations to extract from the source data. For example, in the following sample document describing a terrorist attack one terrorist (perpetrator) attacked two different types of victims (police officers and military personnel) in Sri Lanka. The association specification uses the multiplicative format to create events using the following math to determine the total number of associations: Entity1 (PersonPerpetrator) X * Entity2 (VictimType) X * Geo_index (Location) = Total Number of Associations.

...

Info
  • If the "iterateOver" field contains neither "," or "/" ("," is for additive associations, see below) then it is treated as an iterator over a metadata field, just as described under Specifying Entities, section "Create Entities from Arrays of Items".
  • To iterate just over a single entity type, use "dummy", eg "entity1/dummy" . However there is currently a known bug where "entity1" must be present, eg "entity2/dummy" will not work. However "entity2,dummy" should work for that particular instanceor "entity2,dummy" (The '/' vs ',' are equivalent in this case).
Specifying Additive Associations

Additive associations cover the less common case where (eg) 2 entity types have the same number of elements and are ordered "in lock step". For example:

Code Block
"entities": [
	{ "index": "alex/person", ... },
	{ "index": "craig/person", ... },
	{ "index": "baltimore/city", ... },
	{ "index": "washington dc/city", ...},
	...
]

In this case the additive association specification:

Code Block
{
	"iterateOver": "entity1,entity2", // note "," instead of "/"
	"entity1": "Person",
	"entity2": "City",
	"verb_category": "lives in",
	...
}

Would generate the 2 associations "alex/person lives in baltimore/city" and "craig/person lives in washintgon dc/city".

Further Reading