id: https://concepts.datalad.org/s/types/v1
name: types-schema
# only the major version is reflected in the identifier, but this is the full version
version: 1.0.0
status: eunal:concept-status/CURRENT
title: Collection of common types and a type-designator
description: |
  This schema provides a collection of common types for use in other
  schemas. It can be imported directly into other linkml schemas, or
  any of its individual property definitions can be used by their
  URI as vocabulary components or definitions (e.g., `dltypes:EmailAddress`
  identified by this [URI](EmailAddress)).

  With the [`schema_type`](schema_type) slot and its `range` type
  [`NodeUriOrCurie`](NodeUriOrCurie), this schema provides an essential
  building block for other schemas. This slot can be used as a
  [type designator](https://linkml.io/linkml/schemas/type-designators.html),
  to enable precise validation of sub-types, with an adequate
  representation in an RDF data export.

  The schema definition is available as

  - [JSON-LD context](../v1.context.jsonld)
  - [LinkML YAML](../v1.yaml)
  - [LinkML YAML (static/resolved)](../v1.static.yaml)
  - [OWL TTL](../v1.owl.ttl)
  - [SHACL TTL](../v1.shacl.ttl)

  Upcoming changes to this schema may be available in an [(unreleased)
  development version](../../types/unreleased).

comments:
  - ALL CONTENT HERE IS UNRELEASED AND MAY CHANGE ANY TIME

license: MIT

prefixes:
  dcterms: http://purl.org/dc/terms/
  dlschemas: https://concepts.datalad.org/s/
  dltypes: https://concepts.datalad.org/s/types/v1/
  eunal: http://publications.europa.eu/resource/authority/
  linkml: https://w3id.org/linkml/
  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
  rdfs: http://www.w3.org/2000/01/rdf-schema#
  schema: http://schema.org/
  xsd: http://www.w3.org/2001/XMLSchema#

default_prefix: dltypes

emit_prefixes:
  - dltypes
  - rdf
  - rdfs
  - xsd

imports:
  - linkml:types

types:
  EmailAddress:
    uri: dltypes:EmailAddress
    base: str
    typeof: string
    description: RFC 5322 compliant email address
    pattern: '(?:[A-Za-z0-9!#$%&''*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&''*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[A-Za-z0-9-]*[A-Za-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])'
    notes:
      - The validation regex is taken from https://stackoverflow.com/a/201378
      - The regex is single-quoted for YAML encoding, hence all inner "'" have been doubled

  HexBinary:
    uri: xsd:hexBinary
    base: str
    typeof: string
    pattern: "^[a-fA-F0-9]+$"
    description: >-
      hex-encoded binary data.

  NodeUriOrCurie:
    typeof: uriorcurie
    description: >-
      A type referencing an graph node. This is like `uriorcurie`, but in
      an RDF export leads to the desirable `rdf.type` declaration, rather
      then an `rdf.literal` of the corresponding URI.
    base: str
    uri: rdfs:Resource

  NonNegativeInteger:
    uri: xsd:nonNegativeInteger
    base: int
    typeof: integer
    description: An integer
    notes:
      - >-
        Integer with minimum (inclusive) value of zero, i.e. the standard
        mathematical concept of the non-negative integers.
    broad_mappings:
      - schema:Integer


slots:
  schema_type:
    slot_uri: rdf:type
    designates_type: true
    description: >-
      State that the subject is an instance of a particular schema class.
      Typically, no explicit value needs to be assigned to this slot,
      because it matches the class type of a particular record.
      However, this slots can be used as a type designator of a schema
      element for validation and schema structure handling purposes.
      This is used to indicate specialized schema classes for properties
      that accept a hierarchy of classes as their range.
    range: NodeUriOrCurie
    exact_mappings:
      - dcterms:type
