Skip to content
Snippets Groups Projects
Commit d08ec2b5 authored by Sabine Schröder's avatar Sabine Schröder
Browse files

onthologies: forgot to delete debug statement

parent 0a6067cf
No related branches found
No related tags found
No related merge requests found
Pipeline #58404 passed
...@@ -52,7 +52,7 @@ class TOAR_Ontology: ...@@ -52,7 +52,7 @@ class TOAR_Ontology:
""" """
self.filename = filename self.filename = filename
g = rdflib.Graph() 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): def get_class(self, title):
""" """
...@@ -60,7 +60,6 @@ class TOAR_Ontology: ...@@ -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") ) ): 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) value = self.graph.value(subject=s,predicate=RDFS.label)
print(f"value: {value}, title: {title}")
if value and value.strip() == title.strip(): if value and value.strip() == title.strip():
ont_class = s ont_class = s
return ont_class return ont_class
......
import TOARII_ontology import TOARII_ontology
help(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) help(onto)
onto.print() onto.print()
onto.print(format="turtle") onto.print(format="turtle")
...@@ -15,16 +15,18 @@ onto.show_class_definition(czclass) ...@@ -15,16 +15,18 @@ onto.show_class_definition(czclass)
onto.show_entries(czclass) onto.show_entries(czclass)
onto.check_entry('PolarMoist',czclass) onto.check_entry('PolarMoist',czclass)
onto.check_entry('PolarWet',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')
ccclass=onto.get_class('Country Code') ccclass=onto.get_class('Country Code')
onto.show_class_definition(ccclass) onto.show_class_definition(ccclass)
onto.show_entries(ccclass) onto.show_entries(ccclass)
onto.check_entry('DE',ccclass)
onto.check_entry('BE',ccclass)
#highest index of NamedInvidual is 194 #highest index of NamedInvidual is 194
#==> start counting from here #==> 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.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')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment