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

Export to rdf/xml #53

Merged
merged 15 commits into from
Feb 10, 2025
Merged

Export to rdf/xml #53

merged 15 commits into from
Feb 10, 2025

Conversation

JosePizarro3
Copy link
Contributor

@JosePizarro3 JosePizarro3 commented Jan 21, 2025

This pull request introduces several new features and improvements to the bam_masterdata project, including the addition of RDF export functionality, enhanced validation for property types, and updates to the metadata definitions and entities. The most important changes are summarized below:

New Features:

  • Added RDF export functionality to convert entities to RDF/XML format (bam_masterdata/cli/cli.py, bam_masterdata/cli/entities_to_rdf.py). [1] [2]

Validation Enhancements:

  • Implemented checks for duplicated property types before exporting to JSON, Excel, and RDF/XML (bam_masterdata/cli/cli.py). [1] [2]

Metadata Updates:

  • Added id field to EntityDef class and updated model validation to generate id from code (bam_masterdata/metadata/definitions.py). [1] [2]
  • Introduced new properties and methods to BaseEntity class to enhance entity handling (bam_masterdata/metadata/entities.py).

Bug Fixes:

  • Fixed duplicated variable names in property_types.py by renaming them (bam_masterdata/datamodel/property_types.py). [1] [2]

Minor Improvements:

  • Added logger argument to various functions for better logging and debugging (bam_masterdata/cli/fill_masterdata.py). [1] [2] [3]

@JosePizarro3 JosePizarro3 linked an issue Jan 21, 2025 that may be closed by this pull request
5 tasks
@coveralls
Copy link

coveralls commented Jan 22, 2025

Pull Request Test Coverage Report for Build 13182082025

Details

  • 128 of 186 (68.82%) changed or added relevant lines in 7 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.3%) to 95.946%

Changes Missing Coverage Covered Lines Changed/Added Lines %
bam_masterdata/cli/fill_masterdata.py 0 1 0.0%
bam_masterdata/metadata/entities.py 42 44 95.45%
bam_masterdata/cli/cli.py 6 31 19.35%
bam_masterdata/cli/entities_to_rdf.py 45 75 60.0%
Files with Coverage Reduction New Missed Lines %
bam_masterdata/cli/cli.py 1 35.78%
Totals Coverage Status
Change from base Build 13158539734: -0.3%
Covered Lines: 16543
Relevant Lines: 17242

💛 - Coveralls



def entities_to_rdf(
graph: "Graph", module_path: str, logger: "BoundLoggerLazyProxy"
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does the "Graph" class work? Does it inserts everything inside the file already nested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Graph is the class to describe the triples in notologies, and hence when printing to RDF/XML already has the format looked for

"triples" are normally 2 nodes connected via a relationship. Something like: (node_1, relationship, node_2), which you can see some examples when using Graph.add(). Basically it is a way of defining DAGs.

Here the complication is not printing to RDF/XML, or to create the Graph, but actually mapping the openBIS info into the triples.

@JosePizarro3 JosePizarro3 force-pushed the 35-interface-with-webprotege branch 2 times, most recently from 77be8a7 to f020504 Compare January 24, 2025 09:03
@JosePizarro3 JosePizarro3 changed the title Interface with webprotege Export to rdf/xml Jan 29, 2025
@JosePizarro3 JosePizarro3 mentioned this pull request Jan 29, 2025
5 tasks
@JosePizarro3 JosePizarro3 force-pushed the 35-interface-with-webprotege branch 2 times, most recently from 70fa399 to bf100a8 Compare January 30, 2025 12:21
@JosePizarro3
Copy link
Contributor Author

JosePizarro3 commented Jan 30, 2025

TODO:

  • Add testing for rdf_graph_init() in cli/entities_to_rdf.py
  • Add testing for entities_to_rdf() in cli/entities_to_rdf.py
  • Add testing for duplicated_property_types() in cli/duplicated_property_types.py

Added extraction of id after instantiation as the class name

Fix testing
Added _base_attrs to BaseEntity property

Added entities_to_rdf cli
Using only rdfs and dc for annotations

Restricted pydantic version
Deleted inheritance from ObjectType and other types
Changed OWL.Class to OWL.Thing

Added descriptions for relationships
Added duplicated_property_types function in CLI
@JosePizarro3 JosePizarro3 force-pushed the 35-interface-with-webprotege branch from 73fc526 to c6f078d Compare February 6, 2025 07:38
@JosePizarro3
Copy link
Contributor Author

JosePizarro3 commented Feb 6, 2025

@carlosmada22 this is ready. I am not sure if you want to do a review of this, it got really big as I was fixing a few things...

The summary by Copilot worked nicely, better than what I could have written

@JosePizarro3 JosePizarro3 merged commit 9b59a37 into main Feb 10, 2025
8 checks passed
@JosePizarro3 JosePizarro3 deleted the 35-interface-with-webprotege branch February 10, 2025 10:47
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.

Interface with WebProtege
3 participants