Skip to content
418 changes: 337 additions & 81 deletions src/fair_mappings_schema/datamodel/fair_mappings_schema.py

Large diffs are not rendered by default.

215 changes: 162 additions & 53 deletions src/fair_mappings_schema/datamodel/fair_mappings_schema_pydantic.py

Large diffs are not rendered by default.

194 changes: 193 additions & 1 deletion src/fair_mappings_schema/schema/fair_mappings_schema.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: https://w3id.org/mapping-commons/fair-mappings-schema
name: fair-mappings-schema
title: fair-mappings-schema
title: FAIR Mappings Schema
description: |-
A minimal metadata schema for FAIR mapping specifications
license: Apache-2.0
Expand All @@ -21,3 +21,195 @@ default_range: string
imports:
- linkml:types

enums:
SourceTypeEnum:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should either have specific definition languages (e.g. owl, skos etc) in all of the values or none of them. I would prefer this be a high level type i.e. ontology, database, vocabulary etc. We should another field for the specific definition language (or representation technique as ADMS puts it)

description: Types of data sources
permissible_values:
owl_ontology:
description: An ontology in OWL format
database:
description: A relational or other database
skos_vocabulary:
description: A SKOS vocabulary or terminology
rdf_vocabulary:
description: An RDF vocabulary or schema
schema:
description: A data schema or model
api:
description: An API or web service
other:
description: Other type of source

MappingSpecificationTypeEnum:
description: Types of mapping specifications
permissible_values:
Copy link

@jkesanie jkesanie Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add "shacl-rules" to the enum.

sssom:
description: Simple Standard for Sharing Ontological Mappings
r2rml:
description: RDB to RDF Mapping Language
rml:
description: RDF Mapping Language
sparql:
description: SPARQL-based mapping
yarrrml:
description: YARRRML mapping file
xslt:
description: XSLT-based mapping
other:
description: Other type of mapping specification

classes:

Agent:
description: An entity that can create or contribute to a digital object, such as an author or creator.
abstract: true
slots:
- id
- name
- type
slot_usage:
type:
designates_type: true
range: string

Person:
description: An individual person who contributes to a mapping specification
is_a: Agent
slots:
- orcid
- affiliation

Organization:
description: An organization or institution that contributes to a mapping specification
is_a: Agent
slots:
- ror_id
- url

Software:
description: A software tool or system used in creating mappings
is_a: Agent
slots:
- version
- repository_url

Source:
description: >-
A data source from which entities are drawn, such as a database, ontology, or vocabulary.
slots:
- id
- name
- version
- type
- documentation
- content_url
- content_type
- metadata_url
- metadata_type
slot_usage:
type:
range: SourceTypeEnum

MappingSpecification:
description: >-
A formal description of correspondences between entities in a source and a target, expressed as rules, functions, or mapping statements.
tree_root: true
slots:
- id
- name
- description
- author
- creator
- reviewer
- publication_date
- license
- version
- type
- mapping_method
- documentation
- content_url
- subject_source
- object_source
slot_usage:
type:
range: MappingSpecificationTypeEnum

slots:
id:
description: Identifier for the information entity
range: string
name:
description: Name of the information entity
range: string
creator:
description: Creator of the mapping specification
range: Agent
inlined: true
author:
description: Author of the mapping specification
range: Agent
inlined: true
reviewer:
description: Reviewer of the mapping specification
range: Agent
inlined: true
mapping_tool:
description: The tool used to create the mapping specification
range: Agent
inlined: true
publication_date:
description: Date of publication of the mapping specification
range: string
license:
description: License under which the mapping specification is released
range: string
version:
description: Version of the digital object
range: string
description:
description: A brief description of the mapping specification
range: string
type:
description: Type of the information entity
range: string
mapping_method:
description: Method used to create the mapping specification
range: string
documentation:
description: URL or reference to documentation for the mapping specification
range: string
content_url:
description: Reference to the actual content of the digital object
range: string
content_type:
description: The type of the content of the digital object
range: string
metadata_url:
description: Reference to metadata about the digital object
range: string
metadata_type:
description: The type of the metadata about the digital object
range: string
subject_source:
description: The source from which the subject entities are drawn
range: Source
inlined: true
object_source:
description: The source from which the object entities are drawn
range: Source
inlined: true
orcid:
description: ORCID identifier for a person
range: string
affiliation:
description: Institutional affiliation of a person
range: string
ror_id:
description: ROR (Research Organization Registry) identifier
range: string
url:
description: URL or web address
range: string
repository_url:
description: URL to a code repository
range: string
12 changes: 12 additions & 0 deletions tests/data/invalid/MappingSpecification-001.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Invalid MappingSpecification - author is a string instead of Agent object
---
author: "Jane Smith"
content: https://example.org/mappings/invalid.sssom.tsv
subject_source:
name: Source X
content: https://example.org/source-x
content_type: text/plain
object_source:
name: Source Y
content: https://example.org/source-y
content_type: text/plain
11 changes: 11 additions & 0 deletions tests/data/invalid/MappingSpecification-002.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Invalid MappingSpecification - subject_source is a string instead of Source object
---
author:
id: example:author456
name: Test Author
content: https://example.org/mapping.txt
subject_source: "Source A"
object_source:
name: Source B
content: https://example.org/source-b
content_type: text/plain
17 changes: 17 additions & 0 deletions tests/data/invalid/MappingSpecification-003.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Invalid MappingSpecification - creator is a list instead of Agent object
---
author:
id: example:author789
name: Another Author
creator:
- John Doe
- Jane Smith
content: https://example.org/mapping.txt
subject_source:
name: Valid Source
content: https://example.org/source-valid
content_type: text/plain
object_source:
name: Another Source
content: https://example.org/source-invalid
content_type: text/plain
24 changes: 24 additions & 0 deletions tests/data/valid/MappingSpecification-001.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Valid MappingSpecification example - SSSOM mapping between two ontologies
---
publication_date: "2024-01-15"
license: CC-BY-4.0
version: "1.0.0"
description: Mappings between disease ontologies DO and MONDO
type: sssom
mapping_method: manual curation
documentation: https://example.org/do-mondo-mappings/docs
content_url: https://example.org/mappings/do-mondo.sssom.tsv
subject_source:
name: Disease Ontology
version: "2024-01-01"
type: owl_ontology
documentation: https://disease-ontology.org/
content_url: http://purl.obolibrary.org/obo/doid.owl
content_type: application/rdf+xml
object_source:
name: Mondo Disease Ontology
version: "2024-01-10"
type: owl_ontology
documentation: https://mondo.monarchinitiative.org/
content_url: http://purl.obolibrary.org/obo/mondo.owl
content_type: application/rdf+xml
25 changes: 25 additions & 0 deletions tests/data/valid/MappingSpecification-002.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Valid MappingSpecification example - R2RML mapping between database and RDF
---

publication_date: "2023-11-20"
license: Apache-2.0
version: "2.1.0"
description: R2RML mapping from legacy patient database to FHIR RDF
type: r2rml
mapping_method: automated generation with manual review
documentation: https://example.org/patient-fhir-mapping
content_url: https://example.org/mappings/patient-db-to-fhir.r2rml.ttl
subject_source:
name: Patient Database
version: "v5.2"
type: database
documentation: https://example.org/db-schema
content_url: postgresql://example.org:5432/patients
content_type: application/sql
object_source:
name: FHIR RDF Ontology
version: "4.0.1"
type: rdf_vocabulary
documentation: http://hl7.org/fhir/
content_url: http://hl7.org/fhir/fhir.ttl
content_type: text/turtle
11 changes: 11 additions & 0 deletions tests/data/valid/MappingSpecification-003.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Valid MappingSpecification example - minimal required fields only
---
content_url: https://example.org/minimal-mapping.txt
subject_source:
name: Source A
content_url: https://example.org/source-a
content_type: text/plain
object_source:
name: Source B
content_url: https://example.org/source-b
content_type: text/plain