IF Commons GitHub

entityLink

concept

A record of one source linked to an entity that other sources also hold, with the rule that found it and the score, so that who is the same person or thing is a fact with a reason and not a guess

Model proof. Written in commons/data/models/proof/mod.ts:115. Identified by entityLinkId.

Governance: attributes

entityIdtextrequired

The entity it is linked to

Becomes the column entity_id of entity_link.

Written at commons/data/models/proof/mod.ts:119

entityLinkIdidentifierrequired

What identifies the link: the source and the key of its record

Becomes the column entity_link_id of entity_link.

Written at commons/data/models/proof/mod.ts:118

rulecode of linkRulerequired

How it was found

Becomes the column rule of entity_link.

Written at commons/data/models/proof/mod.ts:122

scoretextrequired

How sure, as a number from 0 to 1

Becomes the column score of entity_link.

Written at commons/data/models/proof/mod.ts:123

sourcetextrequired

The source

Becomes the column source of entity_link.

Written at commons/data/models/proof/mod.ts:120

sourceKeytextrequired

The key of the record in the source

Becomes the column source_key of entity_link.

Written at commons/data/models/proof/mod.ts:121

Logical: the table

Projects to the table entity_link with the primary key entity_link_id.

ColumnTypeNullRoleFrom
entity_idtextfalseattributeentityLink.entityId
entity_link_idtextfalseattributeentityLink.entityLinkId
ruletextfalseattributeentityLink.rule
scoretextfalseattributeentityLink.score
sourcetextfalseattributeentityLink.source
source_keytextfalseattributeentityLink.sourceKey

Physical: SQL

CREATE TABLE IF NOT EXISTS "entity_link" (
    "entity_link_id" VARCHAR NOT NULL PRIMARY KEY,
    "entity_id" VARCHAR NOT NULL,
    "source" VARCHAR NOT NULL,
    "source_key" VARCHAR NOT NULL,
    "rule" VARCHAR NOT NULL,
    "score" VARCHAR NOT NULL,
    CONSTRAINT "entity_link_source_source_key_uq" UNIQUE ("source", "source_key"),
    CONSTRAINT "entity_link_rule_ck" CHECK ("rule" IN ('exact', 'normalized', 'similar', 'confirmed'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { entityLink } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/proof.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { entityLink } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(entityLink).select((s) => ({ entityLinkId: s.entityLink.entityLinkId, entityId: s.entityLink.entityId })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.