Skip to content

Instantly share code, notes, and snippets.

@turbomam
Last active February 7, 2024 19:29
Show Gist options
  • Save turbomam/56956b2d7761fc669d2e8ab15e5cb1f0 to your computer and use it in GitHub Desktop.
Save turbomam/56956b2d7761fc669d2e8ab15e5cb1f0 to your computer and use it in GitHub Desktop.
name: has-qualified-identifers-schema
see_also:
- https://turbomam.github.io/reactions-for-owl
- https://gist.githubusercontent.com/turbomam/56956b2d7761fc669d2e8ab15e5cb1f0/raw/64f40292b81d3e04f873e076ae66756059651654/has_qualified_identifers_schema.yaml
id: http://example.com/has_qualified_identifers_schema
prefixes:
has_qualified_identifers: http://example.com/has_qualified_identifers_schema/
linkml: https://w3id.org/linkml/
example: https://example.org/
PATO: http://purl.obolibrary.org/obo/PATO_
xsd: http://www.w3.org/2001/XMLSchema#
shex: http://www.w3.org/ns/shex#
schema: http://schema.org/
imports:
- linkml:types
default_prefix: has_qualified_identifers
default_range: string
enums:
PersonStatus:
permissible_values:
ALIVE:
description: the person is living
meaning: PATO:0001421
DEAD:
description: the person is deceased
meaning: PATO:0001422
UNKNOWN:
description: the vital status is not known
todos:
- map this to an ontology
slots:
external_identifier_value:
description: This is the value of the identifier used in some external system
comments:
- Using a uriorcurie range ensures that we can consistently and atomically assert
the source of the mapping and the local identifier (without requiring even more
classes).
- Using a uriorcurie range does require that we define prefixes for all external
systems that we might map to. Prefixes from an external system like are strongly
preferred. Ideally the CURIes expand to a resolvable URL, but this is not required.
- '{''using curie as the range leads to "WARNING:root:UNKNOWN'': ''Curie // <class
\''linkml_runtime.utils.yamlutils.extended_str\''>" when building the project...
maybe from gen-owl?''}'
range: uriorcurie
provenance:
description: comments about whether the mapping is 1:1 (from NMDC to the external
system), many:1, 1:many, or many:many. - would we ever assert a many:many mapping?
- use an enumeration and add some other comment-like string field?
range: string
assertion_date:
description: A string representation of an ISO-8601 data when the mapping was
asserted.
comments:
- provide a pattern? see if date/time objects work in LinkML now?
range: string
has_qualified_identifiers:
description: A link from any (NamedTing?) in the NMDC database to an external
identifier This would replace alternative identifiers, related identifiers,
etc.
multivalued: true
range: QualifiedIdentifier
id:
description: A unique identifier for a thing
slot_uri: schema:identifier
identifier: true
range: uriorcurie
name:
description: A human-readable name for a thing
slot_uri: schema:name
description:
description: A human-readable description for a thing
slot_uri: schema:description
primary_email:
description: The main email address of a person
slot_uri: schema:email
birth_date:
description: Date on which a person is born
slot_uri: schema:birthDate
range: date
age_in_years:
description: Number of years since birth
range: integer
vital_status:
description: living or dead status
range: PersonStatus
classes:
NamedThing:
description: A generic grouping for any identifiable entity
slots:
- id
- has_qualified_identifiers
- name
- description
class_uri: schema:Thing
Person:
description: Represents a Person
is_a: NamedThing
slots:
- primary_email
- birth_date
- age_in_years
- vital_status
slot_usage:
primary_email:
name: primary_email
pattern: ^\S+@[\S+\.]+\S+
Database:
attributes:
person_set:
name: person_set
from_schema: http://example.com/has_qualified_identifers_schema
multivalued: true
range: Person
inlined: true
inlined_as_list: true
tree_root: true
QualifiedIdentifier:
description: A non-NMDC identifier for something that is also present in the NMDC
database. Provides support for saying when the identifier was asserted and assessments
about the quality of the identifier.
slots:
- external_identifier_value
- provenance
- assertion_date
class_uri: linkml:QualifiedIdentifier
id: example:ck1
has_qualified_identifiers:
- external_identifier_value: example:superman1
provenance: related
assertion_date: '2021-01-01'
- external_identifier_value: example:kalel1
provenance: alternative
assertion_date: '2021-01-01'
name: Clark Kent
primary_email: clark.kent@example.com
age_in_years: 33
@turbomam
Copy link
Author

turbomam commented Feb 7, 2024

  • create a new directory
  • enter new directory
  • deactivate any virtual environments
  • python -m venv venv
  • source venv/bin/activate
  • curl both files
  • gen-linkml --format yaml --no-materialize-attributes has_qualified_identifers_schema.yaml
  • linkml-validate --schema has_qualified_identifers_schema.yaml --target-class Person person_with_qualified_identifers_data.yaml
  • linkml-convert --output person_with_qualified_identifers_data.yaml --schema has_qualified_identifers_schema.yaml --target-class Person person_with_qualified_identifers_data.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment