Skip to content

Commit c6bc94f

Browse files
authored
How-to-extend text updated
| # | Type | Location in page | Description | |---|---|---|---| | 1 | Added | Top of page, after opening sentence | Audience routing notice (`!!! note`) for non-developer visitors | | 2 | Edited | "Before you start" block | Converted from plain indented block to `!!! tip` admonition | | 3 | Edited | Throughout | "pillars" → "data classes" for terminology consistency | | 4 | Added | All YAML code blocks | Language tags added for syntax highlighting | | 5 | Edited | Mixin scope callout | Converted from plain block to `!!! tip` admonition |
1 parent d94b0d7 commit c6bc94f

1 file changed

Lines changed: 22 additions & 34 deletions

File tree

docs/how-to-extend.md

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff 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-
61
# How to Extend CoreMeta4Cat
72

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.
94

10-
<div style="text-align: center;">
11-
<a>
12-
<img src="../images/CoreMeta4Cat_Picture.png" alt="CoreMeta4Cat logo" style="width: 40%;">
13-
</a>
14-
</div>
5+
![CoreMeta4Cat logo](images/CoreMeta4Cat_Picture.png)
156

16-
!!! tip "Before you start"
17-
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.
1812

1913
---
2014

2115
## General rules
2216

2317
These rules apply when extending any part of CoreMeta4Cat.
2418

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.
2720

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.
3022

3123
| What you are adding | Parent class | File |
3224
|---|---|---|
@@ -38,17 +30,13 @@ Each extension type has a designated parent class (see the table below). Always
3830
| New mixin (slot group) | *(no parent — mixin: true)* | Appropriate subprofile |
3931
| New shared slot | *(no class — top-level slot)* | `catcore_common.yaml` |
4032

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.
4334

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`.
4636

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.
4938

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.
5240

5341
---
5442

@@ -78,9 +66,9 @@ MyNewMethod:
7866
Slots already provided by mixins must not be redeclared. Only list slots that are unique to this method:
7967
8068
```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
8472
```
8573
8674
**3. Declare the new slots in the slots section.**
@@ -217,7 +205,7 @@ slots:
217205
slot_uri: catcore:neutron_wavelength
218206
multivalued: true
219207
unit:
220-
ucum_code: Ao # Angstrom
208+
ucum_code: Ao
221209
222210
moderator_type:
223211
description: Type of neutron moderator (e.g. cold, thermal, hot source).
@@ -426,25 +414,25 @@ SomeConcreteClass:
426414
- MyNewMixin
427415
```
428416

429-
!!! warning "Mixin scope"
417+
!!! tip "Mixin scope"
430418
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.
431419

432420
---
433421

434422
## 🔬 Deep dive: Extending the import hierarchy
435423

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.
438426

439427
CoreMeta4Cat sits at the top of a layered import chain:
440428

441429
```
442430
catcore.yaml → catcore_common.yaml → chem_dcat_ap → … → dcat_ap_plus
443431
```
444432

445-
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`.
446434

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.
448436

449437
---
450438

0 commit comments

Comments
 (0)