Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ontology in a thread-safe way #216

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions nb2workflow/nbadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ def get_datatype_restriction(self, param_uri):
def is_ontology_available(self):
# TODO will be developed properly in the ontology_helper
return self._is_ontology_available

def is_optional(self, uri):
self.lock.acquire()
res = super().is_optional(uri)
self.lock.release()
return res

def parse_extra_triples(self, extra_triples, format='n3', parse_oda_annotations = True):
self.lock.acquire()
super().parse_extra_triples(
extra_triples,
format=format,
parse_oda_annotations=parse_oda_annotations)
self.lock.release()

def get_parameter_hierarchy(self, param_uri):
self.lock.acquire()
res = super().get_parameter_hierarchy(param_uri)
self.lock.release()
return res


ontology = ModOntology(oda_ontology_path)
oda_prefix = str([x[1] for x in ontology.g.namespaces() if x[0] == 'oda'][0])
Expand Down