diff --git a/toardb/utils/TOARII_ontology.py b/toardb/utils/TOARII_ontology.py index 8ab38cb14efe43afcee1bb019fc5f2ae57a42c8c..9cf8a04b512cdd8cbf2e06d969fccfa3903c5bf1 100644 --- a/toardb/utils/TOARII_ontology.py +++ b/toardb/utils/TOARII_ontology.py @@ -52,7 +52,7 @@ class TOAR_Ontology: """ self.filename = filename g = rdflib.Graph() - self.graph = g.parse("TOAR-II-Ontology_2020-11-24.owl",format='json-ld') + self.graph = g.parse(self.filename,format='json-ld') def get_class(self, title): """ @@ -60,7 +60,6 @@ class TOAR_Ontology: """ for s, p, o in self.graph.triples( (None, RDF.type, rdflib.URIRef("http://www.w3.org/2002/07/owl#Class") ) ): value = self.graph.value(subject=s,predicate=RDFS.label) - print(f"value: {value}, title: {title}") if value and value.strip() == title.strip(): ont_class = s return ont_class diff --git a/toardb/utils/onto_example.py b/toardb/utils/onto_example.py index 16247184e11b8dec8de3342453a909a3821d1bc2..7ba65bb97bc316a83e0a7fd141763d2108805d80 100644 --- a/toardb/utils/onto_example.py +++ b/toardb/utils/onto_example.py @@ -1,6 +1,6 @@ import TOARII_ontology help(TOARII_ontology) -onto=TOARII_ontology.TOAR_Ontology('TOAR-II-Ontology_2020-11-24.owl') +onto=TOARII_ontology.TOAR_Ontology('TOAR-Ontology-TimeZone-CountryCode.owl') help(onto) onto.print() onto.print(format="turtle") @@ -15,16 +15,18 @@ onto.show_class_definition(czclass) onto.show_entries(czclass) onto.check_entry('PolarMoist',czclass) onto.check_entry('PolarWet',czclass) -onto=TOARII_ontology.TOAR_Ontology('TOAR-Ontology-TimeZone-CountryCode.owl') -dlclass=onto.get_class('Station Dominant Landcover Type') -onto.show_class_definition(dlclass) -onto.show_entries(dlclass) ccclass=onto.get_class('Country Code') ccclass=onto.get_class('Country Code') onto.show_class_definition(ccclass) onto.show_entries(ccclass) +onto.check_entry('DE',ccclass) +onto.check_entry('BE',ccclass) #highest index of NamedInvidual is 194 #==> start counting from here -onto.add_entry(ccclass,195,"GB","United Kingdom of Great Britain and Northern Ireland") +onto.add_entry(ccclass,195,'TZ','United Republic of Tanzania') +onto.add_entry(ccclass,196,'SX', 'Sint Maarten (Dutch part)') +onto.add_entry(ccclass,197,'BE', 'Belgium') +onto.check_entry('BE',ccclass) onto.show_entries(ccclass) -onto.save('TOAR-II-Ontology_2021-01-26.owl') +#nun hier entsprechendes für Timezone +onto.save('TOAR-Ontology-TimeZone-CountryCode_20210128.owl')