Making links

Entity Extraction Scripts provide a way of connecting text references to create semantic links between objects. If those links are between entities, they'll be exported to the network.

Using @connect

@connect is an output action. It produces a link between text references. Each of the text references is assigned a role in the relationship.

The link itself has a namespace and name, just like text references on the graph. Use "tag" namespace to produce links that appear in the output.

tag:Person = $p
tag:Car = $c
> @connect<"has-car"=$p, "is-owned"=$c> tag:Ownership

This first matches a pattern "[Person] owns [Car]", then creates a new link "Ownership". In this link, the role of the person is "has-car" while the role of the Car is "is-owned".

It's possible to add more then two link targets. ETA will expand such link to multiple links between entities, each link having two targets.

Using "instance" role

The example above links a Person with a Car, but does not leave a visible text reference for the ownership. To add one, add a third text reference with "instance" role.

It's often easiest to create the "instance" text reference at the same time as the link itself:

tag:Person = $p
Token<text()="owns"> = $inst
tag:Car = $c
> $inst = tag:Ownership
> @connect<"has-car"=$p, "is-owned"=$c, "instance"=$inst> tag:Ownership

This rule has two output actions: it produces a text reference on top of the word "owns", and connects all three text references (Person, Car, Ownership) to create a link.

Because Ownership is not an Entity, it will not appear on the network. However, it is a visible "instance" of the link, allowing quick identification of where the information is coming from.