Skip to content

Commit 20bf0f5

Browse files
committed
Refactor content fields to content_url and add metadata fields
Replaces 'content' with 'content_url' in Source and MappingSpecification classes and updates all related YAML and test files. Adds 'metadata_url' and 'metadata_type' fields to Source for improved metadata handling.
1 parent f2ccaa2 commit 20bf0f5

6 files changed

Lines changed: 62 additions & 24 deletions

File tree

src/fair_mappings_schema/datamodel/fair_mappings_schema.py

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Auto generated from fair_mappings_schema.yaml by pythongen.py version: 0.0.1
2-
# Generation date: 2025-10-06T23:07:21
2+
# Generation date: 2025-10-06T23:29:58
33
# Schema: fair-mappings-schema
44
#
55
# id: https://w3id.org/mapping-commons/fair-mappings-schema
@@ -218,8 +218,10 @@ class Source(YAMLRoot):
218218
version: Optional[str] = None
219219
type: Optional[Union[str, "SourceTypeEnum"]] = None
220220
documentation: Optional[str] = None
221-
content: Optional[str] = None
221+
content_url: Optional[str] = None
222222
content_type: Optional[str] = None
223+
metadata_url: Optional[str] = None
224+
metadata_type: Optional[str] = None
223225

224226
def __post_init__(self, *_: str, **kwargs: Any):
225227
if self.id is not None and not isinstance(self.id, str):
@@ -237,12 +239,18 @@ def __post_init__(self, *_: str, **kwargs: Any):
237239
if self.documentation is not None and not isinstance(self.documentation, str):
238240
self.documentation = str(self.documentation)
239241

240-
if self.content is not None and not isinstance(self.content, str):
241-
self.content = str(self.content)
242+
if self.content_url is not None and not isinstance(self.content_url, str):
243+
self.content_url = str(self.content_url)
242244

243245
if self.content_type is not None and not isinstance(self.content_type, str):
244246
self.content_type = str(self.content_type)
245247

248+
if self.metadata_url is not None and not isinstance(self.metadata_url, str):
249+
self.metadata_url = str(self.metadata_url)
250+
251+
if self.metadata_type is not None and not isinstance(self.metadata_type, str):
252+
self.metadata_type = str(self.metadata_type)
253+
246254
super().__post_init__(**kwargs)
247255

248256

@@ -271,7 +279,7 @@ class MappingSpecification(YAMLRoot):
271279
type: Optional[Union[str, "MappingSpecificationTypeEnum"]] = None
272280
mapping_method: Optional[str] = None
273281
documentation: Optional[str] = None
274-
content: Optional[str] = None
282+
content_url: Optional[str] = None
275283
subject_source: Optional[Union[dict, Source]] = None
276284
object_source: Optional[Union[dict, Source]] = None
277285

@@ -312,8 +320,8 @@ def __post_init__(self, *_: str, **kwargs: Any):
312320
if self.documentation is not None and not isinstance(self.documentation, str):
313321
self.documentation = str(self.documentation)
314322

315-
if self.content is not None and not isinstance(self.content, str):
316-
self.content = str(self.content)
323+
if self.content_url is not None and not isinstance(self.content_url, str):
324+
self.content_url = str(self.content_url)
317325

318326
if self.subject_source is not None and not isinstance(self.subject_source, Source):
319327
self.subject_source = Source(**as_dict(self.subject_source))
@@ -372,6 +380,12 @@ class MappingSpecificationTypeEnum(EnumDefinitionImpl):
372380
sparql = PermissibleValue(
373381
text="sparql",
374382
description="SPARQL-based mapping")
383+
yarrrml = PermissibleValue(
384+
text="yarrrml",
385+
description="YARRRML mapping file")
386+
xslt = PermissibleValue(
387+
text="xslt",
388+
description="XSLT-based mapping")
375389
other = PermissibleValue(
376390
text="other",
377391
description="Other type of mapping specification")
@@ -424,12 +438,18 @@ class slots:
424438
slots.documentation = Slot(uri=FAIR_MAPPINGS_SCHEMA.documentation, name="documentation", curie=FAIR_MAPPINGS_SCHEMA.curie('documentation'),
425439
model_uri=FAIR_MAPPINGS_SCHEMA.documentation, domain=None, range=Optional[str])
426440

427-
slots.content = Slot(uri=FAIR_MAPPINGS_SCHEMA.content, name="content", curie=FAIR_MAPPINGS_SCHEMA.curie('content'),
428-
model_uri=FAIR_MAPPINGS_SCHEMA.content, domain=None, range=Optional[str])
441+
slots.content_url = Slot(uri=FAIR_MAPPINGS_SCHEMA.content_url, name="content_url", curie=FAIR_MAPPINGS_SCHEMA.curie('content_url'),
442+
model_uri=FAIR_MAPPINGS_SCHEMA.content_url, domain=None, range=Optional[str])
429443

430444
slots.content_type = Slot(uri=FAIR_MAPPINGS_SCHEMA.content_type, name="content_type", curie=FAIR_MAPPINGS_SCHEMA.curie('content_type'),
431445
model_uri=FAIR_MAPPINGS_SCHEMA.content_type, domain=None, range=Optional[str])
432446

447+
slots.metadata_url = Slot(uri=FAIR_MAPPINGS_SCHEMA.metadata_url, name="metadata_url", curie=FAIR_MAPPINGS_SCHEMA.curie('metadata_url'),
448+
model_uri=FAIR_MAPPINGS_SCHEMA.metadata_url, domain=None, range=Optional[str])
449+
450+
slots.metadata_type = Slot(uri=FAIR_MAPPINGS_SCHEMA.metadata_type, name="metadata_type", curie=FAIR_MAPPINGS_SCHEMA.curie('metadata_type'),
451+
model_uri=FAIR_MAPPINGS_SCHEMA.metadata_type, domain=None, range=Optional[str])
452+
433453
slots.subject_source = Slot(uri=FAIR_MAPPINGS_SCHEMA.subject_source, name="subject_source", curie=FAIR_MAPPINGS_SCHEMA.curie('subject_source'),
434454
model_uri=FAIR_MAPPINGS_SCHEMA.subject_source, domain=None, range=Optional[Union[dict, Source]])
435455

src/fair_mappings_schema/datamodel/fair_mappings_schema_pydantic.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __contains__(self, key:str) -> bool:
8282
'prefix_reference': 'http://schema.org/'}},
8383
'see_also': ['https://mapping-commons.github.io/fair-mappings-schema'],
8484
'source_file': 'src/fair_mappings_schema/schema/fair_mappings_schema.yaml',
85-
'title': 'fair-mappings-schema'} )
85+
'title': 'FAIR Mappings Schema'} )
8686

8787
class SourceTypeEnum(str, Enum):
8888
"""
@@ -138,6 +138,14 @@ class MappingSpecificationTypeEnum(str, Enum):
138138
"""
139139
SPARQL-based mapping
140140
"""
141+
yarrrml = "yarrrml"
142+
"""
143+
YARRRML mapping file
144+
"""
145+
xslt = "xslt"
146+
"""
147+
XSLT-based mapping
148+
"""
141149
other = "other"
142150
"""
143151
Other type of mapping specification
@@ -221,8 +229,10 @@ class Source(ConfiguredBaseModel):
221229
'domain_of': ['Software', 'Source', 'MappingSpecification']} })
222230
type: Optional[SourceTypeEnum] = Field(default=None, description="""Type of the information entity""", json_schema_extra = { "linkml_meta": {'alias': 'type', 'domain_of': ['Agent', 'Source', 'MappingSpecification']} })
223231
documentation: Optional[str] = Field(default=None, description="""URL or reference to documentation for the mapping specification""", json_schema_extra = { "linkml_meta": {'alias': 'documentation', 'domain_of': ['Source', 'MappingSpecification']} })
224-
content: Optional[str] = Field(default=None, description="""Reference to the actual content of the digital object""", json_schema_extra = { "linkml_meta": {'alias': 'content', 'domain_of': ['Source', 'MappingSpecification']} })
232+
content_url: Optional[str] = Field(default=None, description="""Reference to the actual content of the digital object""", json_schema_extra = { "linkml_meta": {'alias': 'content_url', 'domain_of': ['Source', 'MappingSpecification']} })
225233
content_type: Optional[str] = Field(default=None, description="""The type of the content of the digital object""", json_schema_extra = { "linkml_meta": {'alias': 'content_type', 'domain_of': ['Source']} })
234+
metadata_url: Optional[str] = Field(default=None, description="""Reference to metadata about the digital object""", json_schema_extra = { "linkml_meta": {'alias': 'metadata_url', 'domain_of': ['Source']} })
235+
metadata_type: Optional[str] = Field(default=None, description="""The type of the metadata about the digital object""", json_schema_extra = { "linkml_meta": {'alias': 'metadata_type', 'domain_of': ['Source']} })
226236

227237

228238
class MappingSpecification(ConfiguredBaseModel):
@@ -247,7 +257,7 @@ class MappingSpecification(ConfiguredBaseModel):
247257
type: Optional[MappingSpecificationTypeEnum] = Field(default=None, description="""Type of the information entity""", json_schema_extra = { "linkml_meta": {'alias': 'type', 'domain_of': ['Agent', 'Source', 'MappingSpecification']} })
248258
mapping_method: Optional[str] = Field(default=None, description="""Method used to create the mapping specification""", json_schema_extra = { "linkml_meta": {'alias': 'mapping_method', 'domain_of': ['MappingSpecification']} })
249259
documentation: Optional[str] = Field(default=None, description="""URL or reference to documentation for the mapping specification""", json_schema_extra = { "linkml_meta": {'alias': 'documentation', 'domain_of': ['Source', 'MappingSpecification']} })
250-
content: Optional[str] = Field(default=None, description="""Reference to the actual content of the digital object""", json_schema_extra = { "linkml_meta": {'alias': 'content', 'domain_of': ['Source', 'MappingSpecification']} })
260+
content_url: Optional[str] = Field(default=None, description="""Reference to the actual content of the digital object""", json_schema_extra = { "linkml_meta": {'alias': 'content_url', 'domain_of': ['Source', 'MappingSpecification']} })
251261
subject_source: Optional[Source] = Field(default=None, description="""The source from which the subject entities are drawn""", json_schema_extra = { "linkml_meta": {'alias': 'subject_source', 'domain_of': ['MappingSpecification']} })
252262
object_source: Optional[Source] = Field(default=None, description="""The source from which the object entities are drawn""", json_schema_extra = { "linkml_meta": {'alias': 'object_source', 'domain_of': ['MappingSpecification']} })
253263

src/fair_mappings_schema/schema/fair_mappings_schema.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ classes:
102102
- version
103103
- type
104104
- documentation
105-
- content
105+
- content_url
106106
- content_type
107+
- metadata_url
108+
- metadata_type
107109
slot_usage:
108110
type:
109111
range: SourceTypeEnum
@@ -125,7 +127,7 @@ classes:
125127
- type
126128
- mapping_method
127129
- documentation
128-
- content
130+
- content_url
129131
- subject_source
130132
- object_source
131133
slot_usage:
@@ -176,12 +178,18 @@ slots:
176178
documentation:
177179
description: URL or reference to documentation for the mapping specification
178180
range: string
179-
content:
181+
content_url:
180182
description: Reference to the actual content of the digital object
181183
range: string
182184
content_type:
183185
description: The type of the content of the digital object
184186
range: string
187+
metadata_url:
188+
description: Reference to metadata about the digital object
189+
range: string
190+
metadata_type:
191+
description: The type of the metadata about the digital object
192+
range: string
185193
subject_source:
186194
description: The source from which the subject entities are drawn
187195
range: Source

tests/data/valid/MappingSpecification-001.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ description: Mappings between disease ontologies DO and MONDO
77
type: sssom
88
mapping_method: manual curation
99
documentation: https://example.org/do-mondo-mappings/docs
10-
content: https://example.org/mappings/do-mondo.sssom.tsv
10+
content_url: https://example.org/mappings/do-mondo.sssom.tsv
1111
subject_source:
1212
name: Disease Ontology
1313
version: "2024-01-01"
1414
type: owl_ontology
1515
documentation: https://disease-ontology.org/
16-
content: http://purl.obolibrary.org/obo/doid.owl
16+
content_url: http://purl.obolibrary.org/obo/doid.owl
1717
content_type: application/rdf+xml
1818
object_source:
1919
name: Mondo Disease Ontology
2020
version: "2024-01-10"
2121
type: owl_ontology
2222
documentation: https://mondo.monarchinitiative.org/
23-
content: http://purl.obolibrary.org/obo/mondo.owl
23+
content_url: http://purl.obolibrary.org/obo/mondo.owl
2424
content_type: application/rdf+xml

tests/data/valid/MappingSpecification-002.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ description: R2RML mapping from legacy patient database to FHIR RDF
88
type: r2rml
99
mapping_method: automated generation with manual review
1010
documentation: https://example.org/patient-fhir-mapping
11-
content: https://example.org/mappings/patient-db-to-fhir.r2rml.ttl
11+
content_url: https://example.org/mappings/patient-db-to-fhir.r2rml.ttl
1212
subject_source:
1313
name: Patient Database
1414
version: "v5.2"
1515
type: database
1616
documentation: https://example.org/db-schema
17-
content: postgresql://example.org:5432/patients
17+
content_url: postgresql://example.org:5432/patients
1818
content_type: application/sql
1919
object_source:
2020
name: FHIR RDF Ontology
2121
version: "4.0.1"
2222
type: rdf_vocabulary
2323
documentation: http://hl7.org/fhir/
24-
content: http://hl7.org/fhir/fhir.ttl
24+
content_url: http://hl7.org/fhir/fhir.ttl
2525
content_type: text/turtle
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Valid MappingSpecification example - minimal required fields only
22
---
3-
content: https://example.org/minimal-mapping.txt
3+
content_url: https://example.org/minimal-mapping.txt
44
subject_source:
55
name: Source A
6-
content: https://example.org/source-a
6+
content_url: https://example.org/source-a
77
content_type: text/plain
88
object_source:
99
name: Source B
10-
content: https://example.org/source-b
10+
content_url: https://example.org/source-b
1111
content_type: text/plain

0 commit comments

Comments
 (0)