toentity

Purpose

Converts entity name variants into a Standard entity name determined by the "Entity Extraction" node. This function is useful when XPDL rules refer to previously extracted entities.

Syntax

toentity([[entity_type,] term[,…​])

Arguments

The function takes one required argument term that defines the term to replace.

The first optional argument restricts the entity type ("people", "organization", "geoadministrative" etc.).

The function also supports a named parameter field which is used to convert an argument to a specific entity attribute.

If the name of an entity or named parameter field includes numbers or special characters (&, /, etc.), then it must be enclosed in quotes, for example: toentity("A&B", $1, field:="A/B")

The optional named parameter default specifies an attribute value in cases where it was not possible to convert it into the standard entity name. This happens if the entity was not calculated or works incorrectly.

Returned Value

The entity of the defined type or its target attributes.

Examples

Dataset

XPDL rule

Result

J&J

rule: r1

{

query: {"J&J"}:1

result: Match = toentity(companies|organizations, $1)

}

Johnson & Johnson

Paris

rule: r1

{

query: {"Paris"}:1

result: Match = toentity(geoadministrative, $1, field:=country)

}

France

John Smith

rule: r1

{

query: {"John Smith"}:1

result: Match = toentity(geoadministrative, $1, field:=country, default:="empty")

}

empty