Skip to content

Commit

Permalink
Tune up things schema
Browse files Browse the repository at this point in the history
Now with examples for all key features.

Also started to use expressions for slot definitions (see conditional
requirement of `value` for `Property` when `is_defined_by` is not
given).
  • Loading branch information
mih committed Apr 10, 2024
1 parent 7657a93 commit 4d1265c
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 30 deletions.
59 changes: 33 additions & 26 deletions src/thing/unreleased.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,26 @@ prefixes:
ADMS: http://www.w3.org/ns/adms#
bibo: http://purl.org/ontology/bibo/
dcterms: http://purl.org/dc/terms/
DCTYPES: http://purl.org/dc/dcmitype/
dlco: https://concepts.datalad.org/
dlthing: https://concepts.datalad.org/s/thing/unreleased/
foaf: http://xmlns.com/foaf/0.1/
linkml: https://w3id.org/linkml/
obo: http://purl.obolibrary.org/obo/
owl: http://www.w3.org/2002/07/owl#
pav: http://purl.org/pav/
RDF: http://www.w3.org/1999/02/22-rdf-syntax-ns#
RDFS: http://www.w3.org/2000/01/rdf-schema#
schema: http://schema.org/
sio: http://semanticscience.org/resource/
skos: http://www.w3.org/2004/02/skos/core#
# example convenience namespaces that make it possible to not think about
# Example convenience namespace that makes it possible to not think about
# a dedicated distribution/dataset/dataset-version-unqiue namespace.
# the prefix can be materialized ala
# The prefix can be materialized ala
# linkml-convert -s ... -t rdf -P exthisds=http://example.com/ --infer ...
#
# the three following prefixes are examples. a use case specific derived
# schema needs to define its own, differently named and defined namespaces.
# The following prefix is an example, a use case specific derived
# schema needs to define its own, differently named and defined namespace(s).
#
# a custom umbrella namespace (e.g. for a project, a consortium, a domain)
# A custom umbrella namespace (e.g. for a project, a consortium, a domain)
# to keep vocabulary and entities local to this scope
exthisns: https://example.org/ns/
# a custom namespace that is unique to a particular dataset, but common
# across all versions of it. It could be nested inside the `thisns` namespace
exthisds: https://example.org/ns/dataset/
# a custom namespace that is unique to apparticular version of a single
# dataset. It could be nested inside the `thisds` namespace
exthisdsver: https://example.org/ns/datasetversion/

default_prefix: dlthing

Expand All @@ -64,7 +54,7 @@ imports:
slots:
description:
slot_uri: dlthing:description
description: A free-text account of the resource.
description: A free-text account of the thing.
exact_mappings:
- dcterms:description
- RDFS:comment
Expand Down Expand Up @@ -102,7 +92,7 @@ slots:
is_about:
slot_uri: dlthing:is_about
description: >-
A relation of an information artifact to an entity.
A relation of an information artifact to a thing.
For example, the subject matter of the content.
range: uriorcurie
exact_mappings:
Expand All @@ -112,14 +102,14 @@ slots:
is_defined_by:
slot_uri: dlthing:is_defined_by
description: >-
The definition of the subject resource.
The definition of the subject thing.
range: uriorcurie
exact_mappings:
- RDFS:isDefinedBy

name:
slot_uri: dlthing:name
description: Name of an item or entity.
description: Name of a thing.
exact_mappings:
- RDFS:label
- schema:name
Expand Down Expand Up @@ -166,7 +156,7 @@ slots:
title:
slot_uri: dlthing:title
description: >-
A summarily description of a item or entity. It is closely related to
A summarily description of a thing. It is closely related to
a name, but often less compact and more descriptive. Typically used for
documents.
exact_mappings:
Expand Down Expand Up @@ -206,13 +196,8 @@ slots:
value:
slot_uri: RDFS:value
description: >-
Value of a resource.
range: string
Value of a thing.
relational_role: OBJECT
notes:
- We would really want to be able to leave the range undefined and permit
any type. However, linkml requires a range specification. A workaround
via linkml:Any does not produce a satisfactory solution.


classes:
Expand All @@ -238,6 +223,8 @@ classes:
is_about:
multivalued: true
has_property:
inlined: true
inlined_as_list: true
multivalued: true
same_as:
multivalued: true
Expand Down Expand Up @@ -278,6 +265,26 @@ classes:
is_defined_by:
description:
The property value is defined by this term.
name:
# if we know no type, we require a name to have at least something
required: false if type else true
type:
# best to have a precise type
recommended: true
range:
# unless we have a defined value, best to know a range class for
# a value
recommended: false if is_defined_by else true
value:
range: string
# unless we have a defined value given, we require a value
# specification -- no purpose in having a property without
# any value assigned
required: false if is_defined_by else true
notes:
- We would really want to be able to leave the range undefined and permit
any type. However, linkml requires a range specification. A workaround
via linkml:Any does not produce a satisfactory solution.
exact_mappings:
- sio:SIO_000614

Expand Down
2 changes: 1 addition & 1 deletion src/thing/unreleased/examples/Thing-customproperty.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "exthisdsver:#",
"id": "exthisns:mything",
"meta_type": "dlthing:Thing",
"has_property": [
{
Expand Down
5 changes: 2 additions & 3 deletions src/thing/unreleased/examples/Thing-customproperty.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# arbitrary well-defined properties can be attached to any
# Thing (e.g., Agent, Activity, or Entity)
# Arbitrary (well-defined) properties can be attached to any Thing.
#
# Example: something heavy from Canada
id: exthisdsver:#
id: exthisns:mything
has_property:
- type: obo:HSO_0000360
name: origin country
Expand Down
32 changes: 32 additions & 0 deletions src/thing/unreleased/examples/Thing-identifiers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"id": "https://ror.org/02nv7yv05",
"identifier": [
{
"notation": "02nv7yv05",
"schema_agency": "https://ror.org"
},
{
"notation": "5008462-8",
"schema_agency": "https://d-nb.info"
},
{
"notation": "n83199611",
"schema_agency": "https://lccn.loc.gov"
},
{
"notation": "148696642",
"schema_agency": "https://viaf.org"
},
{
"notation": "DE 122624631",
"schema_agency": "https://www.bzst.de"
}
],
"meta_type": "dlthing:Thing",
"same_as": [
"https://en.wikipedia.org/wiki/Forschungszentrum_J%C3%BClich",
"https://www.fz-juelich.de",
"https://www.wikidata.org/wiki/Q697111"
],
"@type": "Thing"
}
29 changes: 29 additions & 0 deletions src/thing/unreleased/examples/Thing-identifiers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Identification options for a thing.
#
# `id` is the identifier of the metadata record. In practice it can
# by any of the identifiers below. In a particular context, it is often
# useful to agree on a particular type of identifier to simplify knowledge
# aggregation for individual things. Arbitrary other identifiers
# can be recorded in addition.
id: https://ror.org/02nv7yv05
identifier:
# Research Organization Registry
- notation: 02nv7yv05
schema_agency: https://ror.org
# German National Library
- notation: 5008462-8
schema_agency: https://d-nb.info
# Library of Congress Control Number
- notation: n83199611
schema_agency: https://lccn.loc.gov
# Virtual International Authority File
- notation: "148696642"
schema_agency: https://viaf.org
# VAT number
- notation: "DE 122624631"
schema_agency: https://www.bzst.de
# Use `same_as` to point to other sources talking about the same thing
same_as:
- https://en.wikipedia.org/wiki/Forschungszentrum_J%C3%BClich
- https://www.fz-juelich.de
- https://www.wikidata.org/wiki/Q697111
5 changes: 5 additions & 0 deletions src/thing/unreleased/examples/Thing-minimal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "exthisns:mything",
"meta_type": "dlthing:Thing",
"@type": "Thing"
}
3 changes: 3 additions & 0 deletions src/thing/unreleased/examples/Thing-minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Any document on a Thing requires a identifier.
# Beyond that, no property is required.
id: exthisns:mything
8 changes: 8 additions & 0 deletions src/thing/unreleased/examples/Thing-topic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "https://doi.org/10.21105/joss.03262",
"is_about": [
"https://www.scicrunch.org/resolver/SCR_003931"
],
"meta_type": "dlthing:Thing",
"@type": "Thing"
}
5 changes: 5 additions & 0 deletions src/thing/unreleased/examples/Thing-topic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Relate a thing to topic/subjects
id: https://doi.org/10.21105/joss.03262
is_about:
# DataLad software
- https://www.scicrunch.org/resolver/SCR_003931
3 changes: 3 additions & 0 deletions src/thing/unreleased/validation/Thing.valid.cfg.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
schema: src/thing/unreleased.yaml
target_class: Thing
data_sources:
- src/thing/unreleased/examples/Thing-minimal.yaml
- src/thing/unreleased/examples/Thing-identifiers.yaml
- src/thing/unreleased/examples/Thing-topic.yaml
- src/thing/unreleased/examples/Thing-customproperty.yaml
plugins:
JsonschemaValidationPlugin:
Expand Down

0 comments on commit 4d1265c

Please sign in to comment.