diff --git a/src/mixs_missing_value_sandbox/schema/mixs_missing_value_sandbox.yaml b/src/mixs_missing_value_sandbox/schema/mixs_missing_value_sandbox.yaml index 0bb18f7..a2d925b 100644 --- a/src/mixs_missing_value_sandbox/schema/mixs_missing_value_sandbox.yaml +++ b/src/mixs_missing_value_sandbox/schema/mixs_missing_value_sandbox.yaml @@ -80,6 +80,7 @@ classes: is_a: Checklist mixin: true slots: + - conflicting - adapters - alt - annot @@ -127,6 +128,8 @@ classes: - tax_class - temp slot_usage: + conflicting: + pattern: ^[a-zA-Z]+$ adapters: recommended: true alt: @@ -193,6 +196,7 @@ classes: title: soil is_a: Extension slots: + - conflicting - agrochem_addition - al_sat - al_sat_meth @@ -251,6 +255,8 @@ classes: - water_cont_soil_meth - water_content slot_usage: + conflicting: + pattern: ^[0-9]+$ crop_rotation: string_serialization: '{boolean};{Rn/start_time/end_time/duration}' depth: @@ -306,6 +312,9 @@ slots: inlined: true inlined_as_list: true + conflicting: + description: intentionally set to incompatible states between a Checklist and an Extension + adapters: annotations: Expected_value: adapter A and B sequence diff --git a/src/scripts/__init__.py b/src/scripts/__init__.py new file mode 100644 index 0000000..d8e26a5 --- /dev/null +++ b/src/scripts/__init__.py @@ -0,0 +1,8 @@ +from pathlib import Path + +# from ..mixs_missing_value_sandbox import * + +THIS_PATH = Path(__file__).parent + +SCHEMA_DIRECTORY = THIS_PATH.parent / "mixs_missing_value_sandbox" / "schema" +MAIN_SCHEMA_PATH = SCHEMA_DIRECTORY / "mixs_missing_value_sandbox.yaml" diff --git a/src/scripts/mims_and_soil_slots.py b/src/scripts/mims_and_soil_slots.py new file mode 100644 index 0000000..f8fe6bf --- /dev/null +++ b/src/scripts/mims_and_soil_slots.py @@ -0,0 +1,50 @@ +import pprint +from pathlib import Path + +from linkml_runtime import SchemaView +from linkml_runtime.dumpers import yaml_dumper + +# from ..mixs_missing_value_sandbox import * + +THIS_PATH = Path(__file__).parent + +SCHEMA_DIRECTORY = THIS_PATH.parent / "mixs_missing_value_sandbox" / "schema" +MAIN_SCHEMA_PATH = SCHEMA_DIRECTORY / "mixs_missing_value_sandbox.yaml" + +schema_view = SchemaView(MAIN_SCHEMA_PATH) + +current_checklist = "Mims" +current_extension = "Soil" + +checklist_slots = schema_view.get_class(current_checklist).slots + +extension_slots = schema_view.get_class(current_extension).slots + +checklist_extension_slots = set(checklist_slots).intersection(set(extension_slots)) +checklist_extension_slots = list(checklist_extension_slots) +checklist_extension_slots.sort() + +checklist_usages = schema_view.get_class(current_checklist).slot_usage +extension_usages = schema_view.get_class(current_extension).slot_usage +for slot in checklist_extension_slots: + global_definition = schema_view.get_slot(slot) + checklist_modifies = slot in checklist_usages + extension_modifies = slot in extension_usages + if checklist_modifies or extension_modifies: + if checklist_modifies: + print(f"{slot} slot's usage in {current_checklist}:") + print(yaml_dumper.dumps(checklist_usages[slot])) + else: + print(f"{current_checklist} uses the global definition for {slot}") + # print(yaml_dumper.dumps(global_definition)) + if extension_modifies: + print(f"{slot} slot's usage in {current_extension}:") + print(yaml_dumper.dumps(extension_usages[slot])) + else: + print(f"{current_extension} uses the global definition for {slot}") + # print(yaml_dumper.dumps(global_definition)) + print(f"Induced slot {slot} in {current_checklist}{current_extension}\n") + print(yaml_dumper.dumps(schema_view.induced_slot(slot, f"{current_checklist}{current_extension}"))) + else: + print(f"{slot} not modified by {current_checklist} or {current_extension}\n") + print("----")