Skip to content

Commit cb7c549

Browse files
authored
Merge pull request #174 from linkml/adding-example-tests
Adding examples to test
2 parents dc1dd29 + 1f9ce58 commit cb7c549

File tree

3 files changed

+228
-3
lines changed

3 files changed

+228
-3
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,18 @@ gen-doc:
7474
rm -rf $(DOCDIR)/$(PYMODEL)/model/docs
7575
cp README.md $(DOCDIR)
7676

77-
test: test-schema test-python test-validate-schema
77+
test: test-schema test-python test-validate-schema test-examples
7878
test-schema:
7979
$(RUN) gen-project -d tmp $(SOURCE_SCHEMA_PATH)
8080

8181
test-python:
8282
$(RUN) python -m unittest discover
8383

8484
# TODO: switch to linkml-run-examples when normalize is implemented
85-
test-examples:
85+
test-examples: $(SOURCE_SCHEMA_PATH)
86+
$(RUN) linkml-validate -s $(SOURCE_SCHEMA_PATH) tests/input/examples/schema_definition-*.yaml
8687
# $(RUN) linkml-run-examples -s $(SOURCE_SCHEMA_PATH) -e tests/input/examples -d /tmp/
87-
find tests/input/examples | ./utils/run-examples.pl
88+
# find tests/input/examples | ./utils/run-examples.pl
8889

8990
test-validate-schema:
9091
$(RUN) linkml-normalize -s $(SOURCE_SCHEMA_PATH) $(SOURCE_SCHEMA_PATH) -o /tmp/schema
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
id: https://w3id.org/linkml/examples/enums
2+
title: Dynamic Enums Example
3+
name: dynamicenums-example
4+
description: This demonstrates the use of dynamic enums
5+
license: https://creativecommons.org/publicdomain/zero/1.0/
6+
7+
prefixes:
8+
linkml: https://w3id.org/linkml/
9+
ex: https://w3id.org/linkml/examples/enums/
10+
sh: https://w3id.org/shacl/
11+
bioregistry: https://bioregistry.io/registry/
12+
MONDO: http://purl.obolibrary.org/obo/MONDO_
13+
NCIT: http://purl.obolibrary.org/obo/NCIT_
14+
loinc: http://loinc.org/
15+
16+
default_prefix: ex
17+
default_range: string
18+
19+
default_curi_maps:
20+
- semweb_context
21+
22+
emit_prefixes:
23+
- linkml
24+
- rdf
25+
- rdfs
26+
- xsd
27+
- owl
28+
29+
imports:
30+
- linkml:types
31+
32+
33+
#==================================
34+
# Classes #
35+
#==================================
36+
37+
classes:
38+
HumanSample:
39+
slots:
40+
- name
41+
- disease
42+
43+
44+
#==================================
45+
# Slots #
46+
#==================================
47+
48+
slots:
49+
name:
50+
range: string
51+
disease:
52+
range: HumanDisease
53+
vital_status:
54+
enum_range:
55+
permissible_values:
56+
LIVING:
57+
DEAD:
58+
UNDEAD:
59+
60+
#==================================
61+
# Enums
62+
#==================================
63+
64+
enums:
65+
Disease:
66+
reachable_from:
67+
source_ontology: bioregistry:mondo
68+
source_nodes:
69+
- MONDO:0000001 ## disease or disorder
70+
is_direct: false
71+
relationship_types:
72+
- rdfs:subClassOf
73+
minus:
74+
- permissible_values:
75+
root_node:
76+
meaning: MONDO:0000001 ## disease or disorder
77+
78+
HumanDisease:
79+
description: Extends the Disease value set, including NCIT neoplasms, excluding non-human diseases
80+
inherits:
81+
- Disease
82+
include:
83+
- reachable_from:
84+
source_ontology: bioregistry:ncit
85+
source_nodes:
86+
- NCIT:C3262
87+
minus:
88+
- reachable_from:
89+
source_ontology: bioregistry:mondo
90+
source_nodes:
91+
- MONDO:0005583 ## non-human animal disease
92+
relationship_types:
93+
- rdfs:subClassOf
94+
- permissible_values:
95+
NOT_THIS_ONE:
96+
meaning: MONDO:9999
97+
description: Example of excluding a single node
98+
99+
LoincExample:
100+
enum_uri: http://hl7.org/fhir/ValueSet/example-intensional
101+
see_also:
102+
- https://build.fhir.org/valueset-example-intensional.json.html
103+
include:
104+
- reachable_from:
105+
source_ontology: "loinc:"
106+
source_nodes:
107+
- loinc:LP43571-6
108+
is_direct: true
109+
minus:
110+
- concepts:
111+
- LOINC:5932-9
112+
113+
HCAExample:
114+
see_also:
115+
- https://github.com/linkml/linkml/issues/274
116+
include:
117+
- reachable_from:
118+
source_ontology: bioregistry:go
119+
source_nodes:
120+
- GO:0007049
121+
- GO:0022403
122+
include_self: false
123+
relationship_types:
124+
- rdfs:subClassOf
125+
minus:
126+
- concepts:
127+
- LOINC:5932-9
128+
129+
BodyPartEnum:
130+
reachable_from:
131+
source_ontology: obo:cl
132+
source_nodes:
133+
- CL:0000540 ## neuron
134+
include_self: false
135+
relationship_types:
136+
- rdfs:subClassOf
137+
138+
Brand:
139+
enum_uri: wikidata:Q431289
140+
include:
141+
- reachable_from:
142+
source_ontology: bioregistry:wikidata
143+
source_nodes:
144+
- wikidata:Q431289
145+
include_self: false
146+
relationship_types:
147+
- wdp:P31
148+
- wdp:P279
149+
150+
SerumCholesterolExample:
151+
description: >
152+
This is an example value set that includes all the LOINC codes for serum/plasma cholesterol from v2.36.
153+
code_set: http://hl7.org/fhir/ValueSet/serum-cholesterol
154+
code_set_version: "1.0.0"
155+
pv_formula: CODE
156+
include:
157+
- concepts:
158+
- LP43571-6
159+
minus:
160+
- concepts:
161+
- 5932-9
162+
reachable_from:
163+
source_ontology: http://loinc.org
164+
source_nodes:
165+
- LP43571-6
166+
relationship_types: null
167+
is_direct: true
168+
include_self: true
169+
traverse_up: false
170+
concepts:
171+
- http://loinc.org/LP43571-6
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
id: https://w3id.org/linkml/examples/enums
2+
title: Dynamic Enums Example
3+
name: dynamicenums-example
4+
description: This demonstrates the use of dynamic enums
5+
license: https://creativecommons.org/publicdomain/zero/1.0/
6+
7+
prefixes:
8+
linkml: https://w3id.org/linkml/
9+
ex: https://w3id.org/linkml/examples/enums/
10+
mymetamodel: https://w3id.org/linkml/examples/mymetamodel/
11+
sh: https://w3id.org/shacl/
12+
bioregistry: https://bioregistry.io/registry/
13+
MONDO: http://purl.obolibrary.org/obo/MONDO_
14+
NCIT: http://purl.obolibrary.org/obo/NCIT_
15+
loinc: http://loinc.org/
16+
17+
default_prefix: ex
18+
default_range: string
19+
20+
default_curi_maps:
21+
- semweb_context
22+
23+
imports:
24+
- linkml:types
25+
26+
27+
#==================================
28+
# Classes #
29+
#==================================
30+
31+
classes:
32+
Person:
33+
instantiates:
34+
- mymetamodel:Reviewable
35+
annotations:
36+
review.desc: A very useful class that is well defined
37+
attributes:
38+
id:
39+
name:
40+
address:
41+
42+
Reviewable:
43+
class_uri: mymetamodel:Reviewable
44+
attributes:
45+
description: an expert review of a schema element
46+
review: Review
47+
48+
Review:
49+
class_uri: mymetamodel:Review
50+
attributes:
51+
desc:
52+
score:
53+
range: float

0 commit comments

Comments
 (0)