You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how-to-extend.md
+22-34Lines changed: 22 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,24 @@
1
-
---
2
-
title: How to Extend
3
-
description: Rules and patterns for extending CoreMeta4Cat with new methods, techniques, and properties
4
-
---
5
-
6
1
# How to Extend CoreMeta4Cat
7
2
8
-
This page explains how to add new entries to the CoreMeta4Cat schema — new preparation methods, characterisation techniques, reactor types, simulation methods, or shared slots. Each section follows the same general pattern, adapted to the specific pillar.
3
+
This page explains how to add new entries to the CoreMeta4Cat schema — new preparation methods, characterisation techniques, reactor types, simulation methods, or shared slots. Each section follows the same general pattern, adapted to the specific data class.
Read the [Design Patterns](design-patterns.md) page first if you are new to the schema. Understanding the Activity/Plan split and the mixin pattern will make the extension rules below straightforward.
7
+
!!! note "Not what you were looking for?"
8
+
This page is for developers who want to contribute new terms to the CoreMeta4Cat schema. If you are a researcher who wants to check or annotate your dataset, start with the [Getting Started](https://nfdi4cat.github.io/CoreMeta4Cat/latest/getting-started/) page instead.
9
+
10
+
!!! tip "Read Design Patterns first"
11
+
If you are new to the schema, read the [Design Patterns](https://nfdi4cat.github.io/CoreMeta4Cat/latest/design-patterns/) page first. Understanding the Activity/Plan split and the mixin pattern will make the extension rules below straightforward.
18
12
19
13
---
20
14
21
15
## General rules
22
16
23
17
These rules apply when extending any part of CoreMeta4Cat.
24
18
25
-
**Rule 1 — Extend, don't modify.**
26
-
Add new subclasses and slots. Do not rename or remove existing classes, slots, or enum values — this would break backward compatibility for any dataset already using them.
19
+
**Rule 1 — Extend, don't modify.** Add new subclasses and slots. Do not rename or remove existing classes, slots, or enum values — this would break backward compatibility for any dataset already using them.
27
20
28
-
**Rule 2 — Inherit from the right parent.**
29
-
Each extension type has a designated parent class (see the table below). Always use `is_a:` with that parent, not with a sibling class.
21
+
**Rule 2 — Inherit from the right parent.** Each extension type has a designated parent class (see the table below). Always use `is_a:` with that parent, not with a sibling class.
30
22
31
23
| What you are adding | Parent class | File |
32
24
|---|---|---|
@@ -38,17 +30,13 @@ Each extension type has a designated parent class (see the table below). Always
| New shared slot |*(no class — top-level slot)*|`catcore_common.yaml`|
40
32
41
-
**Rule 3 — Register an ontology term.**
42
-
Every new class should have a `class_uri:` pointing to a term in an established ontology (Voc4Cat, CHMO, OBI, NCIT, …). If no suitable term exists yet, use a provisional catcore-prefixed URI (`catcore:MyNewClass`) and open a Voc4Cat issue to request a proper term.
33
+
**Rule 3 — Register an ontology term.** Every new class should have a `class_uri:` pointing to a term in an established ontology (Voc4Cat, CHMO, OBI, NCIT, …). If no suitable term exists yet, use a provisional catcore-prefixed URI (`catcore:MyNewClass`) and open a Voc4Cat issue to request a proper term.
43
34
44
-
**Rule 4 — Declare slots in the right file.**
45
-
Slots used by exactly one class go in that class's subprofile file. Slots shared by two or more classes go in `catcore_common.yaml`.
35
+
**Rule 4 — Declare slots in the right file.** Slots used by exactly one class go in that class's subprofile file. Slots shared by two or more classes go in `catcore_common.yaml`.
46
36
47
-
**Rule 5 — Apply existing mixins before adding new slots.**
48
-
If your new class needs drying, calcination, precipitation, or thermal process parameters, apply the appropriate mixin rather than redeclaring those slots. Only add method-specific slots beyond what the mixin provides.
37
+
**Rule 5 — Apply existing mixins before adding new slots.** If your new class needs drying, calcination, precipitation, or thermal process parameters, apply the appropriate mixin rather than redeclaring those slots. Only add method-specific slots beyond what the mixin provides.
49
38
50
-
**Rule 6 — Mark obligation levels.**
51
-
Every slot in a new class should have either `required: true` (Mandatory), `recommended: true` (Recommended), or neither (Optional). Do not leave obligations implicit.
39
+
**Rule 6 — Mark obligation levels.** Every slot in a new class should have either `required: true` (Mandatory), `recommended: true` (Recommended), or neither (Optional). Do not leave obligations implicit.
52
40
53
41
---
54
42
@@ -78,9 +66,9 @@ MyNewMethod:
78
66
Slots already provided by mixins must not be redeclared. Only list slots that are unique to this method:
79
67
80
68
```yaml
81
-
slots:
82
-
- my_specific_parameter_a
83
-
- my_specific_parameter_b
69
+
slots:
70
+
- my_specific_parameter_a
71
+
- my_specific_parameter_b
84
72
```
85
73
86
74
**3. Declare the new slots in the slots section.**
@@ -217,7 +205,7 @@ slots:
217
205
slot_uri: catcore:neutron_wavelength
218
206
multivalued: true
219
207
unit:
220
-
ucum_code: Ao # Angstrom
208
+
ucum_code: Ao
221
209
222
210
moderator_type:
223
211
description: Type of neutron moderator (e.g. cold, thermal, hot source).
@@ -426,25 +414,25 @@ SomeConcreteClass:
426
414
- MyNewMixin
427
415
```
428
416
429
-
!!! warning "Mixin scope"
417
+
!!! tip "Mixin scope"
430
418
A mixin should cover a coherent, reusable process step — not an arbitrary collection of slots. If a set of slots is only needed by one class, declare the slots directly on that class rather than creating a mixin.
431
419
432
420
---
433
421
434
422
## 🔬 Deep dive: Extending the import hierarchy
435
423
436
-
!!! warning "Technical section"
437
-
This section is for schema developers who need to introduce a new chemistry-layer or intermediate module between CoreMeta4Cat and DCAT-AP-PLUS. Most users extending the four pillars do not need this.
424
+
??? warning "Technical section"
425
+
This section is for schema developers who need to introduce a new chemistry-layer or intermediate module between CoreMeta4Cat and DCAT-AP-PLUS. Most users extending the four data classes do not need this.
438
426
439
427
CoreMeta4Cat sits at the top of a layered import chain:
If you need to introduce a new intermediate chemistry layer (e.g. a `polymer_catalysis_ap` that adds polymer-specific base classes used across multiple pillars), add it between `catcore_common` and the first pillar that needs it. Import it in `catcore_common.yaml` via the `imports:` key, and document the new layer in the import hierarchy diagram in `catcore.yaml`.
433
+
If you need to introduce a new intermediate chemistry layer (e.g. a `polymer_catalysis_ap` that adds polymer-specific base classes used across multiple data classes), add it between `catcore_common` and the first data class module that needs it. Import it in `catcore_common.yaml` via the `imports:` key, and document the new layer in the import hierarchy diagram in `catcore.yaml`.
446
434
447
-
Do not import new intermediate layers directly in individual pillar files — this would create hidden import order dependencies and make the schema harder to reason about.
435
+
Do not import new intermediate layers directly in individual data class files — this would create hidden import order dependencies and make the schema harder to reason about.
0 commit comments