Skip to content

Commit

Permalink
Merge pull request #6 from GenomicsStandardsConsortium/4-is-this-a-re…
Browse files Browse the repository at this point in the history
…asonable-place-for-determining-who-wins-when-there-is-a-conflict-in-a-slot-definitionusage-between-a-is_a-parent-and-a-mixin

ranges of requireds
  • Loading branch information
turbomam authored Sep 9, 2024
2 parents c09eda7 + 848af48 commit 2a2d4d3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/scripts/ranges_of_requireds_of_combination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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"

combination_class_name = f"{current_checklist}{current_extension}"

combination_class = schema_view.induced_class(combination_class_name)

combination_class_attributes = combination_class.attributes

for ak, av in combination_class_attributes.items():
if av.required:
print(f"Slot {ak} is required in {combination_class_name}")
print(f"{av.range}")
if av.structured_pattern:
print(f"{av.structured_pattern.syntax}")
if av.pattern:
print(f"{av.pattern}")
print("----")

0 comments on commit 2a2d4d3

Please sign in to comment.