Skip to content

Comments

Export to rdf/xml#53

Merged
JosePizarro3 merged 15 commits intomainfrom
35-interface-with-webprotege
Feb 10, 2025
Merged

Export to rdf/xml#53
JosePizarro3 merged 15 commits intomainfrom
35-interface-with-webprotege

Conversation

@JosePizarro3
Copy link
Member

@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
Member 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
Member 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
Member 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
CagtayFabry pushed a commit to CagtayFabry/bam-masterdata that referenced this pull request Dec 17, 2025
* Added id as optional string to definitions

Added extraction of id after instantiation as the class name

Fix testing

* Added rdflib to dependencies

Added _base_attrs to BaseEntity property

Added entities_to_rdf cli

* Adding referenceTo and fixing properties of data type OBJECT

* Ignoring typing in to_rdf function

* Fix pydantic versioning problem for _base_attrs

Fix encoding in rdf file

* Added dataType and propertyLabel annotations

Using only rdfs and dc for annotations

Restricted pydantic version

* Fix descriptions of annotated properties

Deleted inheritance from ObjectType and other types

* Adding back the placeholders for object, collections and datasets

Changed OWL.Class to OWL.Thing

Added descriptions for relationships

* Renamed model_to_rdf for BaseEntity

* Fixed code_to_class_name when the code does not exist

* Added docstrings to entities_to_rdf.py

* Fix duplicated property problems

Added duplicated_property_types function in CLI

* Moved duplicated_property_types to utils and added tests

* Added testing for entities_to_rdf

* Fix imports
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