Skip to content

Conversation

mpsonntag
Copy link
Contributor

@mpsonntag mpsonntag commented Nov 11, 2019

This PR generally cleans up the rdf_converter file to reduce method complexity and improve PEP-8 compliancy. It also includes these major improvements:

  • info.py now provides an INSTALL_PATH variable. Since the rdf_converter depends on the non-python subclasses file resources/subclasses.yml, it should now be easier to provide the file path to this file independent of installation type.
  • The rdf_converter now features a new load_rdf_subclasses function, that either provides the content of the resources/subclasses.yml file or, if it cannot be accessed, deals with it without breaking the RDFWriter.
  • Fixes calling the deprecated odml.Property.value attribute.
  • The RDFWriter will now call every odml documents finalize method to ensure that all links and includes are resolved before exporting to RDF.
  • The OWL odml ontology file is moved from doc/root-ontology.ttl to odml/resources/odml-ontology.ttl and included in Manifest.in.

@coveralls
Copy link

coveralls commented Nov 11, 2019

Coverage Status

Coverage increased (+0.2%) to 75.122% when pulling 3ad35b4 on mpsonntag:rdfcleanup into 6c9294e on G-Node:master.

Call `finalize` for every document to make sure
all `links` and `includes` are resolved before
exporting an odml document to rdf.
Moving the root-ontology.ttl file from doc/odml_ontology
to odml/resources/odml-ontology.ttl and include it in
packaging via Manifest.in.
:param node: An RDF node that is used to append the current odml element
to the RDF graph. If None, a new node will be created and
added to the 'Hub' node of the RDF graph.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is a monster ;) Might be cool to split is up to functions that handle the different subtype separately. Something for the future, maybe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, the method is still too big and the suggestion to split it up into subtype handling intrigues me. Lets see what I can do about it...

To reduce complexity, the RDFWriter.save_elem method
is removed and its usage replaced by the new methods
RDFWriter.save_document, .save_section and .save_property.
Changed the signature of RDFWriter.save_odml_list so it is
identical to the signature of similar methods in the same
class.
@jgrewe jgrewe merged commit 1a2f22c into G-Node:master Nov 14, 2019
@mpsonntag mpsonntag deleted the rdfcleanup branch November 14, 2019 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants