id: https://concepts.datalad.org/s/demo-research-assets/unreleased
name: demo-research-assets-schema
version: UNRELEASED
status: eunal:concept-status/DRAFT
title: Data models for an organization's research assets
description: |
  This schema is using the FLAT approach (Flexible Low-complexity
  Annotation Technique) and is geared toward metadata entry and
  submission for pooling information across consortium sites and
  partners.

  It is to be taken as a demonstrator rather than a schema
  building block.

  More information may be available on the schema's [about page](about).

  The schema definition is available as

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

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

license: MIT

prefixes:
  ADMS: http://www.w3.org/ns/adms#
  ISSN: http://identifiers.org/issn/
  ODRL: http://www.w3.org/ns/odrl/2/
  bibo: http://purl.org/ontology/bibo/
  # TODO preliminary definition, pointing to a future resolver
  datalad: https://pid.datalad.org/datasets/
  dash: http://datashapes.org/dash#
  dcterms: http://purl.org/dc/terms/
  dlcommonmx: https://concepts.datalad.org/s/common-mixin/unreleased/
  # TODO preliminary definition, pointing to a future resolver
  dldi: https://pid.datalad.org/distributions/
  # TODO preliminary definition, just to have something short
  dlcdi: https://concepts.datalad.org/ns/content-defined-identifiers/
  dlfilesmx: https://concepts.datalad.org/s/files-mixin/unreleased/
  dlflat: https://concepts.datalad.org/s/flat/unreleased/
  dlflatfiles: https://concepts.datalad.org/s/flat-files/unreleased/
  dlflatpublications: https://concepts.datalad.org/s/flat-publications/unreleased/
  dlflatres: https://concepts.datalad.org/s/flat-resources/unreleased/
  dlflatsocial: https://concepts.datalad.org/s/flat-social/unreleased/
  dlflatstudy: https://concepts.datalad.org/s/flat-study/unreleased/
  dlidentifiers: https://concepts.datalad.org/s/identifiers/unreleased/
  dlprovmx: https://concepts.datalad.org/s/prov-mixin/unreleased/
  dlpublicationsmx: https://concepts.datalad.org/s/publications-mixin/unreleased/
  dlquantmx: https://concepts.datalad.org/s/quantities-mixin/unreleased/
  dlrelationsmx: https://concepts.datalad.org/s/relations-mixin/unreleased/
  dlresmx: https://concepts.datalad.org/s/resources-mixin/unreleased/
  dlschemas: https://concepts.datalad.org/s/
  dlsocialmx: https://concepts.datalad.org/s/social-mixin/unreleased/
  dlspatialmx: https://concepts.datalad.org/s/spatial-mixin/unreleased/
  dlstudymx: https://concepts.datalad.org/s/study-mixin/unreleased/
  dltemporalmx: https://concepts.datalad.org/s/temporal-mixin/unreleased/
  dlthings: https://concepts.datalad.org/s/things/v1/
  dltypes: https://concepts.datalad.org/s/types/v1/
  dlvocab: https://concepts.datalad.org/vocab/
  doi: https://doi.org/
  eunal: http://publications.europa.eu/resource/authority/
  geodata: http://sws.geonames.org/
  linkml: https://w3id.org/linkml/
  marcrel: http://id.loc.gov/vocabulary/relators/
  nfo: http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#
  obo: http://purl.obolibrary.org/obo/
  orcid: https://orcid.org/
  owl: http://www.w3.org/2002/07/owl#
  prov: http://www.w3.org/ns/prov#
  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
  rdfs: http://www.w3.org/2000/01/rdf-schema#
  ror: https://ror.org/
  rrid: "https://scicrunch.org/resolver/RRID:"
  schema: http://schema.org/
  sh: http://www.w3.org/ns/shacl#
  sio: http://semanticscience.org/resource/
  skos: http://www.w3.org/2004/02/skos/core#
  spdx: http://spdx.org/rdf/terms#
  vcard: http://www.w3.org/2006/vcard/ns#
  w3ctr: https://www.w3.org/TR/
  xsd: http://www.w3.org/2001/XMLSchema#
  xyzra: https://concepts.datalad.org/s/demo-research-assets/unreleased/
  xyzrans: https://concepts.datalad.org/s/demo-research-assets/ns/

default_prefix: xyzra

emit_prefixes:
  - dlcommonmx
  - dlfilesmx
  - dlflat
  - dlflatfiles
  - dlflatres
  - dlflatpublications
  - dlflatsocial
  - dlflatstudy
  - dlidentifiers
  - dlprovmx
  - dlpublicationsmx
  - dlquantmx
  - dlrelationsmx
  - dlresmx
  - dlspatialmx
  - dlsocialmx
  - dlstudymx
  - dltemporalmx
  - dlthings
  - dltypes
  - rdf
  - rdfs
  - skos
  - w3ctr
  - xsd
  # a bunch more that are not needed for the structural aspects
  # of the schema, but for records using the schema
  - ISSN
  - bibo
  - datalad
  - dcterms
  - dldi
  - doi
  - geodata
  - obo
  - orcid
  - ror
  - rrid
  - schema
  - xyzrans


imports:
  - dlschemas:flat-files/unreleased
  - dlschemas:flat-publications/unreleased
  - dlschemas:flat-resources/unreleased
  - dlschemas:flat-social/unreleased
  - dlschemas:flat-study/unreleased
  - dlschemas:prov-mixin/unreleased


types:
  flexdate:
    # gen-shacl doesn't work without this
    uri: xyzra:flexdate
    base: str
    typeof: string
    description:
      W3C variant/subset of IS08601 for specifying date(times).
      Supported are
      - YYYY (eg 1997)
      - YYYY-MM (eg 1997-07)
      - YYYY-MM-DD (eg 1997-07-16)
    pattern: '^([-+]\d+)|(\d{4})|(\d{4}-[01]\d)|(\d{4}-[01]\d-[0-3]\d)$'


enums:
  YesNoUnknownClassifcation:
    description: >-
      Boolean classification with a third option indicating that
      the true value is not known.
    permissible_values:
      "yes":
        description: >-
          Consent given
      "no":
        description: >-
          No consent given
      "unknown":
        description:
          The true value is not known (yet)


slots:
  orcid:
    title: ORCID
    description: >-
      ORCID identifier of a person (see https://orcid.org).
    range: string
    pattern: '^\d{4}-\d{4}-\d{4}-\d{3}[0-9X]{1}$'

  # TODO: this better becomes an access method (through landing page)
  landing_page:
    title: Landing page
    description: >-
      A Web page that can be navigated to in a Web browser to gain access to
      a resource.
    range: uri
    exact_mappings:
      - dcat:landingPage

  target:
    title: Target
    description: >-
      An objective that is the focus of an activity.
    range: XYZObjective
    related_mappings:
      - obo:BFO_0000055
    #exact_mappings:
    #  - http://purl.allotrope.org/ontologies/property#AFX_0002750)
    #close_mappings:
    #  - sct:363702006

classes:
  XYZAccolade:
    is_a: FlatThing
    mixins:
      - EntityMixin
    title: Accolade
    description: >-
      An award, prize, or other honor received in recognition of an achievement.
    slots:
      - title
      - at_time
    slot_usage:
      title:
        required: true
      at_time:
        title: Received on
        range: flexdate
        close_mappings:
          - schema:dateReceived

  XYZDataItem:
    is_a: DataItem
    mixins:
      - EntityMixin
    title: Data item
    description: >-
      An information content entity that is intended to be a truthful statement about
      something (modulo, e.g., measurement precision or other systematic errors) and
      is constructed/acquired by a method which reliably tends to produce
      (approximately) truthful statements.

      This is a conceptual entity. A single data item might be available in more than
      one representation, with differing formats, and serializations.
    slot_usage:
      part_of:
        range: XYZDataset
        multivalued: true
      same_as:
        title: Qualitative value
        description: >-
          The value of a qualitative assessment.
      quantitative_value:
        title: Quantitative value
        description: >-
          The value of a quantitative assessment.
      kind:
        range: XYZDataType
      generated_by:
        range: XYZGeneration
      derived_from:
        range: XYZDerivation
        # TODO bring back somehow
        # any_of:
        #  - range: XYZDataItem
        #  - range: XYZSubject
      attributed_to:
        range: XYZAttribution

  XYZDataType:
    is_a: FlatThing
    title: Data type or format
    description: >-
      Type of an data item.
    slots:
      - version_of
    slot_usage:
      version_of:
        title: Variant of
        range: XYZDataType
    broad_mappings:
      - dcterms:format
    narrow_mappings:
      # Electronic File Format
      - obo:NCIT_C171252
      # Data Type
      - obo:NCIT_C42645
      # Electronic File Content Type
      - obo:NCIT_C172272

  XYZConvention:
    is_a: Convention
    title: Convention
    description: >-
      A set of agreed, stipulated, or generally accepted standards, norms,
      social norms, or criteria, often taking the form of a custom.

  XYZDataset:
    is_a: Dataset
    title: Dataset
    description: >-
      A collection of data, published or curated by a single agent. This is a conceptual entity. A single dataset might be available in more than one representation, with differing schematic layouts, formats, and serializations.
    slots:
      - about
      - attributed_to
      - generated_by
      - landing_page
      - rules
      - same_as
    slot_usage:
      about:
        title: Topic(s)
        description: >-
          Topics covered associated with this dataset.
        range: XYZTopic
        multivalued: true
      attributed_to:
        multivalued: true
        inlined_as_list: true
        inlined: true
        range: Attribution
      generated_by:
        range: XYZGeneration
        # TODO description explaining that this is about the dataset
        # as a whole (curation, compilation), not about individual
        # items
      part_of:
        range: XYZDataset
        multivalued: true
      rules:
        range: XYZRule
      same_as:
        range: XYZDataset
        multivalued: true

  XYZDistribution:
    is_a: Distribution
    title: Distribution
    description: >-
      A specific representation of a data item, which may come in the form of an electronic file, or an archive or directory of many files.
    slots:
      - conforms_to
      - rules
    slot_usage:
      kind:
        range: XYZDataType
      distribution_of:
        # XXX this should be a superfluous reannotation of the `Distribution.distribution_of`
        # slot as being multivalued (which it is in `Distribution`). But with linkml 1.9.4
        # this information is not inherited
        multivalued: true
      parts:
        range: XYZNamedDistributionPart
        inlined: true
      rules:
        range: XYZRule
      conforms_to:
        range: XYZConvention
        multivalued: true

  XYZNamedDistributionPart:
    is_a: NamedDistributionPart
    description: >-
      An association class for attaching a `locator` as additional information to a
      `hasPart` relationship.
    slot_usage:
      roles:
        range: XYZDistributionPartType

  XYZDistributionPartType:
    is_a: FlatThing
    title: Distribution part type/role
    description: >-
      Type or role of a part of a distribution.
      For example, a part could be an item in an archive,
      or a file that is an executable.

  XYZDocument:
    is_a: Document
    title: Document
    description: >-
      A conceptual entity representing things which a, broadly conceived, "documents. This includes non-textual things like images. A conceputal document is to be distinguished from its physical, or electronic distributions.
    slots:
      - about
      - attributed_to
      - rules
    slot_usage:
      kind:
        title: Document type
        description: >-
          The type of this document, e.g. journal article, book, webpage
        range: XYZBibliographicType
      attributed_to:
        title: Contributors
        multivalued: true
        inlined_as_list: true
        inlined: true
        range: XYZPersonAttribution
      part_of:
        multivalued: true
      rules:
        range: XYZRule
      about:
        title: Topic(s)
        description: >-
          Topics covered in this document.
        range: XYZTopic
        multivalued: true

  XYZConcept:
    is_a: FlatThing
    title: Concept
    description: >-
      An idea or notion; a unit of thought.

      In the context of a study, this can be a tag associated with a
      categorical, independent variable in a study design, an
      investigative role (e.g., treatments), or an organizational
      nature (e.g., site labels), or a dependent or outcome variable.

      `Concept` is related to `Topic`. However a concept is more focused
      and more clearly delineated in comparison.
    comments:
      - The relationship of a focused concept with the broader concept
        can be described via `broader_mappings`.
    slots:
      - title

  XYZGenesis:
    is_a: FlatThing
    title: Genesis
    description: >-
      A process in which an entity comes into being as a result of the process.
    slots:
      - conforms_to
      - kind
      - name
      - part_of
      - target
      - used
    slot_usage:
      kind:
        range: XYZGenesis
      conforms_to:
        range: XYZConvention
        multivalued: true
      used:
        multivalued: true
        any_of:
          # target a concrete form, not a concept
          - range: XYZDistribution
          # think "tool"
          - range: XYZInstrument
      part_of:
        any_of:
          - range: XYZStudy
          - range: XYZGenesis
        multivalued: true
      target:
        multivalued: true
    broad_mappings:
      - obo:BFO_0000015
      - prov:Activity
    exact_mappings:
      - obo:NCIT_C48151
      - obo:IDO_0000607
    comments:
      - This class is intended to cover generative processes and activities,
        while `Study` covers investigational (scientific) activities, and
        `Project` covers organizational activities.

  XYZGrant:
    is_a: Grant
    mixins:
      - EntityMixin
    title: Grant
    description: >-
      A grant, typically financial or otherwise quantifiable, resources.
    slots:
      - rules
    slot_usage:
      part_of:
        range: XYZGrant
        multivalued: true
      rules:
        range: XYZRule

  XYZInstrument:
    is_a: Instrument
    title: Instrument
    description: >-
      A thing that enables an agent to perform an action. This is typically a device (e.g., a machine to perform a particular type of measurement), but it can also be a questionnaire that is used to perform a particular kind of assessment. An instrument is typically not a "reagent".
    slots:
      - attributed_to
      - rules
    slot_usage:
      kind:
        title: Instrument type
        description: >-
          The type of this instrument, e.g. microscope, software, chainsaw
        range: XYZInstrumentType
      attributed_to:
        multivalued: true
        inlined_as_list: true
        inlined: true
        range: XYZPersonAttribution
      rules:
        range: XYZRule

  XYZOrganization:
    is_a: Organization
    title: Organization
    description: >-
      A social or legal institution such as a company, a society, or a university.
    slot_usage:
      part_of:
        description: >-
          An organization that the subject is part of.
        range: XYZOrganization
        multivalued: true

  XYZPerson:
    is_a: Person
    title: Person
    description: >-
      Person agents are people, alive, dead, or fictional.
    slots:
      - part_of
    slot_usage:
      part_of:
        title: Member of
        range: XYZOrganization
        multivalued: true

  XYZProject:
    is_a: Project
    title: Project
    description: >-
      A collective endeavour of some kind. Typically it is a planned process that is undertaken or attempted to meet some requirement, or to achieve a particular goal.
    slots:
      - attributed_to
      - part_of
      - target
    slot_usage:
      attributed_to:
        multivalued: true
        inlined_as_list: true
        inlined: true
        range: XYZPersonAttribution
      part_of:
        range: XYZProject
        multivalued: true
      target:
        multivalued: true

  XYZPublication:
    is_a: Publication
    title: Publication
    description: >-
      A resource that is the output of a publishing process.
    slots:
      - attributed_to
      - derived_from
      - doi
      - generated_by
      - rules
    slot_usage:
      doi:
        recommended: true
        title: DOI
      title:
        description: >-
          The full title of the publication.
        required: false
      attributed_to:
        multivalued: true
        inlined_as_list: true
        inlined: true
        title: Contributors
        range: XYZPersonAttribution
      published_at:
        range: XYZPublicationVenue
      locator:
        title: Location within publication venue
        description: >-
          A descriptive identifier that the publication within the
          venue it was published at. For a journal article, this would
          be a volume and/or page range. Format according to the conventions
          of the publication venue.
      kind:
        title: Publication type
        description: >-
          The type of this publication, e.g. journal article, book, webpage
        range: XYZBibliographicType
      about:
        recommended: true
        title: Topic(s)
        description: >-
          Topics covered by this publication.
        range: XYZTopic
        multivalued: true
      date_published:
        range: flexdate
        description: >-
          The date when a publication became available at the publication venue.
      generated_by:
        recommended: true
        title: Contributing project(s)
        description: >-
          Any project that contributed to the outcomes described in the publication.
        range: XYZProject
        multivalued: true
      derived_from:
        recommended: true
        title: Associated dataset(s)
        description: >-
          Any dataset that informed the outcomes described in the publication.
        range: XYZDataset
        multivalued: true
      rules:
        range: XYZRule

  XYZBibliographicType:
    is_a: FlatThing
    title: Bibliographic type
    description: >-
      Type of a publication or document, e.g., journal article, book, or webpage.

  XYZInstrumentType:
    is_a: FlatThing
    title: Instrument type
    description: >-
      Type of an instrument.

  XYZPublicationVenue:
    is_a: FlatThing
    title: Publication venue
    description: >-
      "Place" of a publication, e.g., a journal, a website, an edited collection.
    slots:
      - title
      - kind
    slot_usage:
      title:
        description: >-
          The full title of the publication.
        required: false
      kind:
        title: Publication venue type
        description: >-
          The type of this publication venue, e.g. journal article, book, webpage
        range: XYZBibliographicType

  XYZStudy:
    is_a: Study
    title: Study
    description: >-
      A planned process that consists of parts: planning, study design execution, documentation and which produce conclusion(s).
    slots:
      - attributed_to
      - target
    slot_usage:
      factors:
        multivalued: true
        range: XYZConcept
      instruments:
        multivalued: true
        range: XYZInstrument
      dimensions:
        multivalued: true
        range: XYZConcept
      attributed_to:
        multivalued: true
        inlined_as_list: true
        inlined: true
        title: Contributors
        range: XYZPersonAttribution
      part_of:
        range: XYZStudy
        multivalued: true
      associated_with:
        # TODO this is a bug. Association is with an agent, not an activity
        range: XYZProject
        multivalued: true
      target:
        multivalued: true


  XYZSubject:
    is_a: Subject
    title: Subject
    description: >-
      A subject is an entity being investigated in a study. This is a contextual entity. One and the same entity can be different subjects in two different studies.
    slots:
      - same_as
    slot_usage:
      study:
        range: XYZStudy
      kind:
        range: XYZSubjectType
      derived_from:
        range: XYZSubject
      same_as:
        range: XYZSubject

  XYZSubjectType:
    is_a: FlatThing
    title: Subject type
    description: >-
      Type of a subject.

  XYZTopic:
    is_a: FlatThing
    title: Topic
    description: >-
      Topic a subject is about, e.g., a particular research question or domain
    slots:
      - part_of
    slot_usage:
      part_of:
        range: XYZTopic
        multivalued: true

  XYZRule:
    is_a: FlatThing
    title: Rule
    description: >-
      Permissions, prohibitions, obligatations or other rights/policies.
      This can be a standard license, a custom usage agreement, or a
      codified policy.
    slots:
      # title because MIH thinks of these as documents
      - title
      # licenses often have them
      - short_name

  XYZAgentRole:
    is_a: FlatThing
    title: Agent role
    description: >-
      A role is the function of an agent with respect to a subject,
      in the context of an attribution.
    slots:
      - name
    broad_mappings:
      - prov:Role
      - dcat:Role

  XYZPersonAttribution:
    description: >-
      An association class for attributing a subject to a person and
      qualifying the relationship with particular roles.
    slots:
      - roles
      - object
      - display_label
    slot_usage:
      object:
        title: Person
        range: XYZPerson
      roles:
        description: >-
          Roles a person had with respect to the subject
        range: XYZAgentRole
        multivalued: true
    close_mappings:
      - prov:Attribution

  XYZObjective:
    is_a: FlatThing
    title: Objective
    description: >-
      A proposition that indicates a planned or anticipated outcome.
    slots:
      - attributed_to
      - title
      - part_of
      - depends_on
    slot_usage:
      part_of:
        range: XYZProject
        multivalued: true
      depends_on:
        range: XYZObjective
        multivalued: true
      attributed_to:
        multivalued: true
        inlined_as_list: true
        inlined: true
        title: Contributors
        range: XYZPersonAttribution

  #
  # PROV association classes
  #
  XYZAttribution:
    is_a: Attribution
    description: >-
      Attribution is the ascribing of an entity to an agent. When an entity
      e is attributed to agent ag, entity e was generated by some unspecified
      activity that in turn was associated to agent ag. Thus, this relation
      is useful when the activity is not known, or irrelevant.

  XYZDerivation:
    is_a: Derivation
    description: >-
      A derivation is a transformation of an entity into another, an
      update of an entity resulting in a new one, or the construction
      of a new entity based on a pre-existing entity.
    slot_usage:
      used:
        range: XYZUsage
      generated_by:
        range: XYZGeneration

  XYZGeneration:
    is_a: Generation
    description: >-
      Generation is the completion of production of a new entity by an
      activity. This entity did not exist before generation and becomes
      available for usage after this generation.
    slots:
      - used
    slot_usage:
      object:
        range: XYZGenesis
      roles:
        # TODO ActivityRoles
        #range:
      used:
        range: XYZUsage
    comments:
      - >-
        The `used` slot is added to be able to express something like a sample
        generation using a generic activity and combine them with a target entity
        (like a subject) with an appropriate role declaration. PROV-O's approach
        is to have a dedicated activity (which has `used`) instance for each
        generation. Adding `used` here appears to be less effortful.

  XYZUsage:
    is_a: Usage
    description: >-
      Usage is the beginning of utilizing an entity by an activity.
      Before usage, the activity had not begun to utilize this entity
      and could not have been affected by the entity.
    slot_usage:
      roles:
        # TODO EntityRoles
        #range:
