Skip to content

Commit

Permalink
bugfix and add more namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasprobst committed Mar 24, 2024
1 parent 2a3ea8a commit 59e6496
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ docs/colab/my_file.hdf
*.jsonld
docs/userguide/wrapper/test.hdf
docs/userguide/wrapper/test.json
gui/test.hdf5
10 changes: 9 additions & 1 deletion gui/fairify.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def __init__(self, grp: h5py.Group):

for name, ns in (('M4I', M4I), ('PIVMETA', PIVMETA), ('SCHEMA', SCHEMA), ('OBO', OBO),
('CODEMETA', CODEMETA), ('QUDT_UNIT', QUDT_UNIT), ('QUDT_KIND', QUDT_KIND), ('SSNO', SSNO),
('FOAF', rdflib.FOAF), ('RDFS', rdflib.RDFS), ('RDF', rdflib.RDF), ('OWL', rdflib.OWL)):
('FOAF', rdflib.FOAF), ('RDFS', rdflib.RDFS), ('RDF', rdflib.RDF), ('OWL', rdflib.OWL),
('SKOS', rdflib.SKOS), ('PROV', rdflib.PROV)):
self.namespacelib[name.lower()] = ns
self.comboBoxPrefix1.addItem(name.lower())
self.comboBoxPrefix2.addItem(name.lower())
Expand Down Expand Up @@ -218,10 +219,12 @@ def update_presuf2_from_text(self, pred=None):
pred = self.lineEditIRI2.text()
self.log_message(f'updating prefix and suffix from text: {pred}')
ns, key = split_URIRef(pred)
self.log_message(f'Try to update combo boxes with ns={ns} and key={key}')
if ns is not None:
if ns.startswith('http'):
for name, n in self.namespacelib.items():
if str(n._NS) == ns:
self.log_message(f'Found ns={ns} in {name}')
self.comboBoxPrefix2.setCurrentText(name)
self.comboBoxSuffix2.setCurrentText(key)
break
Expand Down Expand Up @@ -311,6 +314,11 @@ def on_selection_changed(self):
if pred != '':
self.update_presuf1_from_text(pred=pred)

rdf_object = obj.rdf.object.get(attr_name, '')
self.lineEditIRI2.setText(rdf_object)
if rdf_object != '':
self.update_presuf2_from_text(pred=rdf_object)

def populate_tree(self):
"""Populate the tree widget with data from the HDF5 file"""
self.log_message('Populating tree widget with data...')
Expand Down

0 comments on commit 59e6496

Please sign in to comment.