forked from wmo-registers/code-manuals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
defgrib1.py
64 lines (57 loc) · 2.95 KB
/
defgrib1.py
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
from collections import namedtuple
from collections import OrderedDict
import glob
import os
import re
import shutil
from StringIO import StringIO
import urllib2
from zipfile import ZipFile
import cleanttl
from helpers import unit_of_measure
from ttlhead import ttlhead
#def writettl(codeflags):
def writettl():
if not os.path.exists('ttl/def'):
os.mkdir('ttl/def')
# os.mkdir('ttl/def/grib')
with open('ttl/def/bulk_gribe1.ttl', 'w') as fhandle:
fhandle.write(ttlhead)
fhandle.write('<grib1> a reg:Register, owl:Ontology, ldp:Container ;\n')
fhandle.write('rdfs:label "WMO No. 306 FM 92 GRIB (edition1) schemata" ;\n')
fhandle.write('\tdct:description "Schemata required to support WMO No. 306 FM 92 GRIB (edition1) - Manual on Codes; including definitions of structure and domain-specific metadata required to describe terms from WMO No. 306 FM 92 GRIB (edition1)."@en ;\n')
fhandle.write('\treg:owner <http://codes.wmo.int/system/organization/wmo> ;\n')
fhandle.write('\tdct:publisher <http://codes.wmo.int/system/organization/wmo> ;\n')
fhandle.write('\treg:manager <http://codes.wmo.int/system/organization/www-dm> ;\n')
fhandle.write('\trdfs:member <grib1/table2version>, '
'<grib1/indicatorOfParameter> ;\n'
'<grib1/parameterId> ;\n')
fhandle.write('\t.\n')
fhandle.write('<grib1/table2version> a owl:ObjectProperty ;\n'
'\trdfs:label "table 2 version"@en ;\n'
'\trdfs:comment "Object property describing the table 2 version used by a GRIB (edition 1) message."@en ;\n'
'\trdfs:range rdf:Literal ;\n'
'\trdfs:subClassOf skos:Concept ;\n'
'\tskos:notation "table2version" ;\n'
'\trdfs:isDefinedBy <grib1>\n'
'\t.\n\n')
fhandle.write('<grib1/indicatorOfParameter> a owl:ObjectProperty ;\n'
'\trdfs:label "parameter indicator"@en ;\n'
'\trdfs:comment "Object property describing the indicator of parameter for a GRIB (edition 1) message."@en ;\n'
'\trdfs:subClassOf skos:Concept ;\n'
'\tskos:notation "indicatorOfParameter" ;\n'
'\trdfs:isDefinedBy <grib1>\n'
'\t.\n\n')
fhandle.write('<grib1/parameterId> a owl:ObjectProperty ;\n'
'\trdfs:label "parameter identifier"@en ;\n'
'\trdfs:comment "Object property identifying the parameter for a GRIB (edition 1) message rdf representation."@en ;\n'
'\trdfs:subClassOf skos:Concept ;\n'
'\tskos:notation "grib1_parameter" ;\n'
'\trdfs:isDefinedBy <grib1>\n'
'\t.\n\n')
def main():
#codeflags = readfile()
writettl()
if __name__ == '__main__':
cleanttl.clean()
main()