Skip to main content

CREATE EDGE (ontology)

Commands › Extracting entities from documents · Admins only, through sercha_define or a tenant file

Declares an edge between two entities of an ontology. Extraction writes the edge between instances: inside one document (an internal edge) or across documents by matching a field to the target's key (an external edge). Queries follow it with VIA. A qualified name <ontology>.<name> makes an ontology edge; an unqualified name makes a named edge between relations (CREATE EDGE).

Syntax​

CREATE EDGE <ontology>.<name>
ON <ontology>.<Source> [ IN <corpus> ]
<VERB>
<ontology>.<Target> [ IN <corpus> ]
[ LINK BY <field> RESOLVE { EXACT | FUZZY } [ WITHIN <ontology>.<Entity> ] ]

Parameters​

ParameterDescription
<ontology>.<name>The edge's address. DROP EDGE <ontology>.<name> removes it.
<ontology>.<Source>, <ontology>.<Target>The two entities. Both must be qualified and must exist when the statement runs.
IN <corpus>Which corpus holds that end's instances, for an edge between entities extracted in different corpora. Pins the entity to that corpus; an entity already pinned to another corpus is refused.
<VERB>Any word, such as CITES or BILLED_BY.
LINK BY <field>Makes the edge external: the source's <field> value is matched against the target's key. Leave out LINK BY and RESOLVE for an internal edge, decided by the document's structure.
RESOLVE EXACTLinks on equal values.
RESOLVE FUZZYLinks on close values. Needs WITHIN.
WITHIN <ontology>.<Entity>The scope a fuzzy match searches.

Usage notes​

  • The edge reaches extraction after REBIND CORPUS and a RUN BINDING. Edges added to entities already extracted need a full re-extraction; to link values the entities already carry without one, use a named edge (CREATE EDGE), which accepts two corpus entities.
  • UNDER in CREATE ENTITY (extraction) creates the internal part_of edge for you.

Examples​

An external edge: each invoice names its supplier.

CREATE EDGE finance.billed_by
ON finance.Invoice BILLED_BY finance.Supplier
LINK BY supplier RESOLVE EXACT;
result
edge finance.billed_by created (id=...)

Follow it:

SELECT a.invoice_no, b.name FROM books.Invoice a JOIN books.Supplier b VIA a.billed_by

A fuzzy edge across two corpora:

CREATE EDGE finance.refers_to
ON finance.Note IN notes REFERS_TO finance.Invoice IN books
LINK BY invoice_ref RESOLVE FUZZY WITHIN finance.Invoice;

Not supported​

RefusedWrite instead
RESOLVE without LINK BYBoth, or neither for an internal edge
RESOLVE SEMANTICRESOLVE FUZZY
An unqualified end<ontology>.<Entity>
-- Refused by the engine
CREATE EDGE finance.billed_by ON finance.Invoice BILLED_BY finance.Supplier RESOLVE EXACT
-- Refused by the engine
CREATE EDGE finance.billed_by ON finance.Invoice BILLED_BY finance.Supplier LINK BY supplier RESOLVE SEMANTIC

See also​

CREATE ENTITY (extraction) · DROP EDGE · CREATE EDGE · VIA · REBIND CORPUS