Skip to content

Commit

Permalink
Updated excelparser and excel2onto (#336)
Browse files Browse the repository at this point in the history


* Added choice for sheetname for Concepts, Metadata and ImportedOntologies

* Moved definitinon of imported ontologies to separate sheet as input

* Added force option to excel2onto and excelparser so that errors are skipped and an ontology is made with the rest. 

* Better handling of errors in prefLabel, including strings with only spaces.

* Updated test, particularly to test that option force handles the errors correctly.
* Added test for validity of concept name before proceeding in loop in
excelparser
* Added som test for invalid parent
* Added test of concept whos parent is defined later

* Documentation updated

* Improved warnings and error messages

* Make sure that default base_iri is used if it is not provided by the excel file

* Made real microstructure as example for excelparser and
moved the test onto.xlsx which should include mistakes that
the parser should fix

* Excelparser now proceeds if force is true, diregarding concepts that
cannot be added due to errors in prefLabel: prefLabels with spaces,
concepts that already exist (These are diregarded - it might be good to
add an option for these in the future if it should be allowed to change
or add to concepts), concepts where prefLabel is completely missing.
Concepts missing elucidation OK.
Leading and trailing spaces are removed.

* If missing or wrong parents, concepts are defined directly under
owlready2.Thing

* If force: add elucidation as rdfs.comment, add altLAbel as rdfs.label,
add example as rdfs.comment

* Values converted to string 'nan' are not considered when adding literal

Co-authored-by: Jesper Friis <[email protected]>
Co-authored-by: Casper Welzel Andersen <[email protected]>
  • Loading branch information
3 people authored Jan 7, 2022
1 parent 8d22f1a commit 2964d0f
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 154 deletions.
2 changes: 1 addition & 1 deletion examples/ontology-from-excel/make_microstructure_onto.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from ontopy.excelparser import create_ontology_from_excel
from ontopy.utils import write_catalog

ontology, catalog = create_ontology_from_excel("tool/onto.xlsx")
ontology, catalog = create_ontology_from_excel("tool/microstructure.xlsx")

ontology.save("microstructure_ontology.ttl", format="turtle", overwrite=True)
write_catalog(catalog)
Binary file not shown.
Loading

0 comments on commit 2964d0f

Please sign in to comment.