referencing a "definitions" + "data" file into another "data" file
Following the work started in #954 (closed), to complete our reference requirements we would like to have the possibility to reference into a ReferenceEditQuantity of our schema other files that may have different structures.
The last line of the following schema restricts to a list of files with the "Substance" structure.
Actually, we have cases in which we may want to reference into this composition more than one chemical compound, each of them belonging to Substance class or to other kind of classes.
definitions:
name: 'Electronic Lab Notebook schema fot MOVPE-STO'
sections:
Substance:
base_section: nomad.datamodel.data.EntryData
quantities:
comment:
type: str
m_annotations:
eln:
component: StringEditQuantity
chemical_name:
type: str
description: The name of the chemical that is typically used in literature
m_annotations:
eln:
component: StringEditQuantity
MovpeSto_schema:
base_section: nomad.datamodel.data.EntryData
m_annotations:
eln:
dict()
sub_sections:
materials:
repeats: true
section:
m_annotations:
eln:
dict()
sub_sections:
substrate:
repeats: true
section:
base_sections:
- nomad.datamodel.data.EntryData
m_annotations:
eln:
dict()
sub_sections:
composition:
repeats: true
section: Substance # I would like not to have only Substance here
data:
m_def: ../upload/raw/movpe_sto.schema.archive.yaml#MovpeSto_schema
materials:
substrate:
composition:
- "../upload/raw/Copper_II_Selenide.archive.json#data" # this file must be compliant solely to Substance class
- "../upload/raw/Zinc_Selenide.archive.yaml#data" # this file must be compliant solely to Substance class
Relaxing the "section: Substance" restriction we have several ways the user can act. The user can:
-
decide to leave this Substance class in the "sections" of his master schema file together to other needed classes and simply pick one and put it in the m_def line of his "data"
-
reference to a file having its own schema definition:
definitions:
name: 'Substance schema'
sections:
Substance:
quantities:
comment:
type: str
m_annotations:
eln:
component: StringEditQuantity
chemical_name:
type: str
m_annotations:
eln:
component: StringEditQuantity
data:
m_def: Substance
comment: "my chemical description"
chemical_name: "my chemical name"
- in a more clean way, split the schema portion avoiding to repeat the schema in each of the files to reference (feature already in place) and also not pollute the schema of a specific experiment with Substance class that is more general and used everywhere (at some point these classes shall be elevated to base classes in Nomad)
definitions:
name: 'Substance schema'
sections:
Substance:
quantities:
comment:
type: str
m_annotations:
eln:
component: StringEditQuantity
chemical_name:
type: str
m_annotations:
eln:
component: StringEditQuantity
data:
m_def: ../upload/raw/Substance.archive.yaml#Substance
comment: "my chemical description"
chemical_name: "my chemical name"
A further - nice - implementation could be:
section: Substance, Sample, WhatNot
So when creating a new reference the user has a drop down menu to choose which class the file he wants to create is referencing to (I guess this may be again a separate issue)