Skip to content

Commit d028ff3

Browse files
authored
docs: Clarify documentation for unique_keys, key, and identifier. (#258)
fixes #3329.
1 parent 932e19b commit d028ff3

1 file changed

Lines changed: 36 additions & 14 deletions

File tree

linkml_model/model/schema/meta.yaml

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,15 +1309,25 @@ slots:
13091309
range: unique_key
13101310
multivalued: true
13111311
inlined: true
1312-
description: A collection of named unique keys for this class. Unique keys may be singular or compound.
1312+
description: >-
1313+
A collection of named unique keys for this class. Such unique keys may be spread over several slots, which is why there
1314+
are also called "compound keys". A unique key uniquely identifies instances of the class within a given container, meaning
1315+
there cannot be two (or more) instances of the class with the same values for all the slots that make up the unique key.
1316+
comments:
1317+
- >
1318+
Not to be confused with a "singular unique key", which is defined by means of the `key` slot, or with an "identifier",
1319+
which is defined by means of the "identifier" slot. Compound keys, singular unique keys, and identifiers all create a
1320+
unicity constraint, but singular unique keys and identifiers have additional effects that compound keys do not have.
13131321
exact_mappings:
13141322
- owl:hasKey
13151323
in_subset:
13161324
- SpecificationSubset
13171325
- BasicSubset
13181326
- RelationalModelProfile
13191327
see_also:
1320-
- https://linkml.io/linkml/schemas/constraints.html#unique-key
1328+
- https://linkml.io/linkml/schemas/constraints.html#unique-keys
1329+
- linkml:key
1330+
- linkml:identifier
13211331

13221332
unique_key_name:
13231333
domain: unique_key
@@ -1860,40 +1870,52 @@ slots:
18601870
range: boolean
18611871
inherited: true
18621872
description: >-
1863-
True means that the key slot(s) uniquely identify the elements within a single container
1873+
True means that the slot is the "singular unique key" (also known more simply as the "key slot") of its class. Such a slot
1874+
uniquely identifies instances of the class within a single container, meaning there cannot be two (or more) instances of
1875+
the class (or instances of any of its descendants) with the same value for the key slot within the container.
18641876
comments:
1865-
- key is inherited
1866-
- a given domain can have at most one key slot (restriction to be removed in the future)
1867-
- identifiers and keys are mutually exclusive. A given domain cannot have both
1868-
- a key slot is automatically required. Keys cannot be optional
1877+
- The key slot is inherited.
1878+
- A domain can have at most one key slot OR one identifier slot. However a domain can have both a key slot and any number
1879+
of compound keys.
1880+
- A key slot is automatically required. Singular unique keys cannot be optional.
1881+
- The presence of a key slot makes a class eligible for inlining as a dictionary.
18691882
in_subset:
18701883
- SpecificationSubset
18711884
- BasicSubset
18721885
- RelationalModelProfile
18731886
see_also:
1887+
- https://linkml.io/linkml/schemas/constraints.html#singular-unique-keys
1888+
- https://linkml.io/linkml/schemas/inlining.html
18741889
- linkml:unique_keys
1890+
- linkml:identifier
18751891

18761892
identifier:
18771893
rank: 5
18781894
domain: slot_definition
18791895
range: boolean
18801896
inherited: true
18811897
description: >-
1882-
True means that the key slot(s) uniquely identifies the elements. There can be at most one identifier or key per
1883-
container
1898+
True means that the slot is the identifier slot of its class. Such a slot uniquely identifies instances of the class
1899+
throughout an entire document, meaning there cannot be two (or more) instances of the class (or instances of any of its
1900+
descendants) with the same value for the identifier slot anywhere in the document.
1901+
comments:
1902+
- The identifier slot is inherited.
1903+
- A domain can have at most one identifier slot OR a key slot. However a domain can have both an identifier slot and any
1904+
number of compound keys.
1905+
- An identifier slot is automatically required. Identifiers cannot be optional.
1906+
- The presence of an identifier slot makes a class eligible for inlining as a dictionary.
1907+
- The presence of an identifier slot makes a class eligible for being referenced rather than inlined.
18841908
aliases:
18851909
- primary key
18861910
- ID
18871911
- UID
18881912
- code
18891913
see_also:
18901914
- https://en.wikipedia.org/wiki/Identifier
1915+
- https://linkml.io/linkml/schemas/constraints.html#unique-keys
1916+
- https://linkml.io/linkml/schemas/inlining.html
18911917
- linkml:unique_keys
1892-
comments:
1893-
- identifier is inherited
1894-
- a key slot is automatically required. Identifiers cannot be optional
1895-
- a given domain can have at most one identifier
1896-
- identifiers and keys are mutually exclusive. A given domain cannot have both
1918+
- linkml:key
18971919
in_subset:
18981920
- SpecificationSubset
18991921
- MinimalSubset

0 commit comments

Comments
 (0)