forked from INCATools/ontology-development-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_dynamic_files.jinja2
351 lines (285 loc) · 11 KB
/
_dynamic_files.jinja2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
{#-
Jinja2 Template for multile dynamic files
See odk.py for how this is processed.
This is first expanded into a single text file;
Each entry starting with ^^^ denotes a single file
-#}
{#-
Ontology source file, e.g. src/ontology/foo-edit.owl
We seed this with basic info such as ontology IRI and
a fake root class (this can be customized).
Note that when running odk.py, you can pass in a --source
argument to substitute this with your own edit file
#}
^^^ src/ontology/{{ project.id }}-edit.{{ project.edit_format }}
{% if project.edit_format == "obo" %}
{% if project.import_group is defined -%}
{% for imp in project.import_group.products %}
import: http://purl.obolibrary.org/obo/{{ project.id }}/imports/{{ imp.id }}_import.owl
{% endfor %}
{% endif %}
{%- if project.use_dosdps %}
import: http://purl.obolibrary.org/obo/{{ project.id }}/patterns/definitions.owl
{%- if project.import_pattern_ontology %}
import: http://purl.obolibrary.org/obo/{{ project.id }}/patterns/pattern.owl
{% endif -%}
{% endif %}
ontology: {{project.id}}
property_value: http://purl.org/dc/elements/1.1/description "{{ project.description }}" xsd:string
property_value: http://purl.org/dc/elements/1.1/title "{{ project.title }}" xsd:string
property_value: http://purl.org/dc/terms/license {{ project.license }}
[Term]
id: {{ project.id | upper }}:00000000
name: root node
{% else %}
Prefix(:=<http://purl.obolibrary.org/obo/{{ project.id }}.owl#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Prefix(rdf:=<http://www.w3.org/1999/02/22-rdf-syntax-ns#>)
Prefix(xml:=<http://www.w3.org/XML/1998/namespace>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(rdfs:=<http://www.w3.org/2000/01/rdf-schema#>)
Prefix(dce:=<http://purl.org/dc/elements/1.1/>)
Prefix(dcterms:=<http://purl.org/dc/terms/>)
Ontology(<http://purl.obolibrary.org/obo/{{ project.id }}.owl>
{% if project.import_group is defined -%}
{% for imp in project.import_group.products %}
Import(<http://purl.obolibrary.org/obo/{{ project.id }}/imports/{{ imp.id }}_import.owl>)
{% endfor %}
{% endif %}
{%- if project.use_dosdps %}
Import(<http://purl.obolibrary.org/obo/{{ project.id }}/patterns/definitions.owl>)
{%- if project.import_pattern_ontology %}
Import(<http://purl.obolibrary.org/obo/{{ project.id }}/patterns/pattern.owl>)
{% endif -%}
{% endif %}
Annotation(dce:title "{{ project.title }}")
Annotation(dcterms:license <{{ project.license }}>)
Annotation(dce:description "{{ project.description }}")
Declaration(Class(<http://purl.obolibrary.org/obo/{{ project.id | upper }}_00000000>))
############################
# Classes
############################
# Class: <http://purl.obolibrary.org/obo/{{ project.id | upper }}_00000000>
AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/{{ project.id | upper }}_00000000> "root node"@en)
)
{% endif %}
{#-
ID ranges file
#}
^^^ src/ontology/{{ project.id }}-idranges.owl
## ID Ranges File
Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix: idsfor: <http://purl.obolibrary.org/obo/IAO_0000598>
Prefix: dc: <http://purl.org/dc/elements/1.1/>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Prefix: allocatedto: <http://purl.obolibrary.org/obo/IAO_0000597>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: idprefix: <http://purl.obolibrary.org/obo/IAO_0000599>
Prefix: iddigits: <http://purl.obolibrary.org/obo/IAO_0000596>
Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>
Prefix: idrange: <http://purl.obolibrary.org/obo/ro/idrange/>
Prefix: owl: <http://www.w3.org/2002/07/owl#>
Ontology: <http://purl.obolibrary.org/obo/{{ project.id }}/{{ project.id }}-idranges.owl>
Annotations:
idsfor: "{{ project.id | upper }}",
idprefix: "http://purl.obolibrary.org/obo/{{ project.id | upper }}_",
iddigits: 7
AnnotationProperty: idprefix:
AnnotationProperty: iddigits:
AnnotationProperty: idsfor:
AnnotationProperty: allocatedto:
Datatype: idrange:1
Annotations:
allocatedto: "ONTOLOGY-CREATOR"
EquivalentTo:
xsd:integer[>= 0 , <= 999999]
Datatype: idrange:2
Annotations:
allocatedto: "ADDITIONAL EDITOR"
EquivalentTo:
xsd:integer[>= 1000000 , <= 1999999]
Datatype: xsd:integer
Datatype: rdf:PlainLiteral
^^^ src/ontology/{{ project.id }}.Makefile
## Customize Makefile settings for {{project.id}}
##
## If you need to customize your Makefile, make
## changes here rather than in the main Makefile
{#-
Imports files, one per import
#}
{% for imp in project.import_group.products %}
^^^ src/ontology/imports/{{ imp.id }}_import.owl
<?xml version="1.0"?>
<rdf:RDF
xml:base="http://purl.obolibrary.org/obo/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:oboInOwl="http://www.geneontology.org/formats/oboInOwl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:obo="http://purl.obolibrary.org/obo/">
<owl:Ontology rdf:about="{{ project.uribase }}/{{ project.id }}/imports/{{ imp.id }}_import.owl"/>
<!-- This is a placeholder, it will be regenerated when makefile is first executed -->
</rdf:RDF>
{#-
Import Term files
We seed each of these with some random terms. This is a little unsatisfactory and fragile;
ROBOT extract will fail if it cannot find any of the terms. While this doesn't matter in the long term,
as the ontology maintainer will provide their own lists, but it is problematic for the initial seed.
TODO: Decide if we should either query ontobee for seed terms OR have the seed list provided in the project.yaml
#}
^^^ src/ontology/imports/{{ imp.id }}_terms.txt
{%- if imp.id == 'ro' %}
BFO:0000050
RO:0002202
{%- elif imp.id == 'bfo' %}
BFO:0000040
{%- elif imp.id == 'go' %}
GO:0008150
{%- elif imp.id == 'uberon' %}
UBERON:0001062
{%- elif imp.id == 'cl' %}
CL:0000000
{%- elif imp.id == 'pato' %}
PATO:0000001
{%- elif imp.id == 'mpath' %}
MPATH:0
{%- elif imp.id == 'doid' %}
DOID:4
{%- elif imp.id == 'ncbitaxon' %}
NCBITaxon:1
{%- elif imp.id == 'chebi' %}
CHEBI:24431
{%- elif imp.id == 'bco' %}
http://purl.obolibrary.org/obo/BCO_0000081
{%- elif imp.id == 'envo' %}
ENVO:00001998
{%- elif imp.id == 'iao' %}
IAO:0000577
{%- elif imp.id == 'uo' %}
UO:0010003
{%- elif imp.id == 'obi' %}
OBI:0000011
{%- elif imp.id == 'hsapdv' %}
http://purl.obolibrary.org/obo/HsapDv_0000000
{%- elif imp.id == 'nbo' %}
NBO:0000313
{%- else %}
{{ imp.id|upper }}:0000000
{{ imp.id|upper }}:0000001
{{ imp.id|upper }}:0000002
{%- endif %}
{% endfor %}
{#-
Metadata files.
These are convenient for submission to OBO. Note that OBO maintains two files, a .md and a .yml
TODO: include a script that makes it easy for maintainers to do this.
#}
^^^ src/metadata/{{ project.id }}.md
---
layout: ontology_detail
id: {{ project.id }}
title: {{ project.title }}
jobs:
- id: https://travis-ci.org/{{ project.github_org }}/{{ project.repo }}
type: travis-ci
build:
checkout: git clone https://github.com/{{ project.github_org }}/{{ project.repo }}.git
system: git
path: "."
contact:
email: {{ project.contact.email }}
label: {{ project.contact.name }}
github: {{ project.contact.github }}
description: {{ project.title }} is an ontology...
domain: stuff
homepage: https://github.com/{{ project.github_org }}/{{ project.repo }}
products:
- id: {{ project.id }}.owl
name: "{{ project.title }} main release in OWL format"
- id: {{ project.id }}.obo
name: "{{ project.title }} additional release in OBO format"
- id: {{ project.id }}.json
name: "{{ project.title }} additional release in OBOJSon format"
- id: {{ project.id }}/{{ project.id }}-base.owl
name: "{{ project.title }} main release in OWL format"
- id: {{ project.id }}/{{ project.id }}-base.obo
name: "{{ project.title }} additional release in OBO format"
- id: {{ project.id }}/{{ project.id }}-base.json
name: "{{ project.title }} additional release in OBOJSon format"
dependencies:
{% for imp in project.import_group.products -%}
- id: {{ imp.id }}
{% endfor %}
tracker: https://github.com/{{ project.github_org }}/{{ project.repo }}/issues
license:
url: http://creativecommons.org/licenses/by/3.0/
label: CC-BY
activity_status: active
---
Enter a detailed description of your ontology here. You can use arbitrary markdown and HTML.
You can also embed images too.
^^^ src/metadata/{{ project.id }}.yml
# PURL configuration for http://purl.obolibrary.org/obo/{{ project.id }}
idspace: {{ project.id|upper }}
base_url: /obo/{{ project.id }}
products:
- {{ project.id }}.owl: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/master/{{ project.id }}.owl
- {{ project.id }}.obo: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/master/{{ project.id }}.obo
term_browser: ontobee
example_terms:
- {{ project.id.upper() }}_0000000
entries:
- prefix: /releases/
replacement: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/v
- prefix: /tracker/
replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/issues
- prefix: /about/
replacement: http://www.ontobee.org/ontology/{{ project.id|upper }}?iri=http://purl.obolibrary.org/obo/
## generic fall-through, serve direct from github by default
- prefix: /
replacement: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/master/
{#-
Example pattern implementation TSV
#}
{%- if project.use_dosdps %}
^^^ src/patterns/data/default/README.md
Documentation of the Default DOSDP Pipeline
{%- if project.pattern_pipelines_group is defined %}
{%- for pipeline in project.pattern_pipelines_group.products %}
^^^ src/patterns/data/{{ pipeline.id }}/README.md
# Documentation of the {{ pipeline.id }} DOSDP Pipeline
{%- endfor %}
{%- endif %}
{%- endif %}
{#-
SPARQL QUERY to collect all terms that belong to an ontology
#}
^^^ src/sparql/{{ project.id }}_terms.sparql
SELECT DISTINCT ?term
WHERE {
{ ?s1 ?p1 ?term . }
UNION
{ ?term ?p2 ?o2 . }
FILTER(isIRI(?term) && (regex(str(?term), UCASE("{{ project.id }}_")){% if project.namespaces %}{% for ns in project.namespaces %} || regex(str(?term), "{{ ns }}"){% endfor %}{% endif %}))
}
{%- if project.components is defined %}
{%- for component in project.components.products %}
^^^ src/ontology/components/{{ component.filename }}
<?xml version="1.0"?>
<rdf:RDF
xml:base="http://purl.obolibrary.org/obo/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:oboInOwl="http://www.geneontology.org/formats/oboInOwl#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:obo="http://purl.obolibrary.org/obo/">
<owl:Ontology rdf:about="{{ project.uribase }}/{{ project.id }}/components/{{ component.filename }}"/>
<!-- This is a placeholder, it will be regenerated when makefile is first executed -->
</rdf:RDF>
{%- endfor %}
{%- endif %}