Where it goes
Contoso keeps SupplierIsOrganization in domains/party/objects.yaml. The loader reads every YAML file under the package root, so folders are a convention you can change. Name it in PascalCase. The name must be unique within its domain across all type kinds.
Fields
The keys under spec. Nested shapes follow LinkTypeSpec in the GOL JSON Schema.
| Field | Presence | Shape |
|---|---|---|
semantics | Optional | enum: association, aggregation, composition |
from | Required | linkEnd |
to | Required | linkEnd |
backing | Required | object |
properties | Optional | propertyMap |
traits | Optional | object |
onDelete | Optional | object |
Syntax and rules
The examples are fragments. Put them in a package next to the resources they reference. A ... stands for a CEL expression you write yourself.
6. LinkType
kind: LinkType
metadata: { name: SupplierHoldsContract }
spec:
semantics: association # association | aggregation | composition
from: { type: party.Supplier, role: supplier, multiplicity: "1" }
to: { type: Contract, role: contracts, multiplicity: "0..*" }
backing: { kind: foreignKey, holder: to, property: supplierId }
onDelete: { from: restrict } # restrict | cascade | detach
role is the name under which that end is reached from the other end: contract.supplier, supplier.contracts. Multiplicities use UML notation: 1, 0..1, 0..*, 1..*, n..m.
Backing kinds:
backing.kind | Use | Extra keys |
|---|---|---|
foreignKey | one side holds the other's key | holder, property, references |
joinTable | many to many from a dataset | source, table, fromKey, toKey |
object | association entity with identity of its own (DDD: the relationship is a concept) | type, fromRole, toRole |
derived | computed, read only | expr or function |
inferred | mined "hidden relationship" | minConfidence, evidenceRequired |
# polymorphic end, edge properties, inferred backing, traits
kind: LinkType
metadata: { name: Explains, status: proposed }
spec:
from: { type: comms.Message, role: explainedBy, multiplicity: "0..*" }
to: { anyOf: [Contract, finance.Invoice, core.Agreement], role: explains, multiplicity: "0..*" }
backing: { kind: inferred, minConfidence: 0.8, evidenceRequired: true }
properties:
confidence: { type: double, required: true }
authority: { type: EvidenceAuthority } # approved-policy | discussion | rumour
validFrom: date
validTo: date
traits:
{
temporal: { from: validFrom, to: validTo },
symmetric: false,
transitive: false,
acyclic: false,
}
An end may be an ObjectType, an Interface or anyOf. Self links are legal; traits.acyclic: true makes cycles a data-quality alert at runtime.
Check your package
gluon validate examples/contoso
gluon test examples/contoso
validate reports each problem with a GLN code and its place in the file. test runs the package's Test resources. See the language guide and the diagnostics.
