Skip to content

Update to current linkml versions #165

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

Merged
merged 6 commits into from
May 19, 2025
Merged

Update to current linkml versions #165

merged 6 commits into from
May 19, 2025

Conversation

amc-corey-cox
Copy link
Contributor

Trying to update to current versions of linkml and linkml-runtime.

@amc-corey-cox amc-corey-cox requested a review from Copilot May 14, 2025 16:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates LinkML dependencies to their current versions while also making adjustments to test expectations and internal type annotations in the codebase. Key changes include:

  • Updating expected slot counts in the RDFS importer test.
  • Adjusting type annotations and adding duplicate slot handling in the RDFS import engine.
  • Extending slot inference tests in the CSV data generalizer and updating dependency versions in project configuration.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_importers/test_rdfs_importer.py Adjusted test expectations to account for new slots.
tests/test_generalizers/test_csv_data_generalizer.py Added new test cases for date and datetime inference.
schema_automator/importers/rdfs_import_engine.py Updated type annotations and added duplicate slot warning; introduced slot range normalization.
schema_automator/generalizers/csv_data_generalizer.py Refined inference logic for date versus datetime.
schema_automator/annotators/schema_annotator.py Updated imports to remove conflicts.
pyproject.toml Updated dependency versions.
.github/workflows/check-pull-request.yaml Upgraded the cache action to v3.

Comment on lines 648 to 650
if all(
not hasattr(parse(str(v)), 'hour') or
(parse(str(v)).hour == 0 and parse(str(v)).minute == 0 and parse(str(v)).second == 0)
Copy link
Preview

Copilot AI May 14, 2025

Choose a reason for hiding this comment

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

Consider caching the result of parse(str(v)) in the loop to avoid computing it multiple times for the same value, which may improve performance.

Suggested change
if all(
not hasattr(parse(str(v)), 'hour') or
(parse(str(v)).hour == 0 and parse(str(v)).minute == 0 and parse(str(v)).second == 0)
parsed_values = {str(v): parse(str(v)) for v in nn_vals}
if all(
not hasattr(parsed_values[str(v)], 'hour') or
(parsed_values[str(v)].hour == 0 and parsed_values[str(v)].minute == 0 and parsed_values[str(v)].second == 0)

Copilot uses AI. Check for mistakes.

@@ -130,7 +131,10 @@ def convert(
cls_slots = defaultdict(list)

for slot in self.generate_rdfs_properties(g, cls_slots):
sb.add_slot(slot)
if slot.name in sb.schema.slots:
Copy link
Preview

Copilot AI May 14, 2025

Choose a reason for hiding this comment

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

[nitpick] Add a comment clarifying why duplicate slots are skipped, to improve code readability and maintainability.

Copilot uses AI. Check for mistakes.

Test were failing while importing the HCA project after updating
linkml-runtime to 1.9.x because the schema for the file core ontology
was trying to import this file:

tests/outputs/hca/core/file/module/ontology/file_content_ontology.yaml

when it was trying to import this file:

tests/outputs/hca/module/ontology/file_content_ontology.yaml

This was happening because it was importing
"module/ontology/file_content_ontology.yaml" and expected to be
importing from the root of the project. This was the behavior of linkml
runtime before 1.9.x, but that changed in this PR, which was merged and
released with 1.9.1: <linkml/linkml-runtime#368>

The fix is to make this a relative path-- that is, the value
`../../module/ontology/file_content_ontology.yaml`. Luckily, the value
of the relative prefix was already in the code! It just wasn't being
appended to the module path. This might have been an oversight that
wasn't added since the code worked.
@ptgolden
Copy link
Contributor

Typo in my last commit. I wrote:

Test were failing while importing the HCA project after updating
linkml-runtime to 1.9.x because the schema for the file core ontology
was trying to import this file:

tests/outputs/hca/core/file/module/ontology/file_content_ontology.yaml

when it was trying to import this file:

tests/outputs/hca/module/ontology/file_content_ontology.yaml

I meant to write:

Test were failing while importing the HCA project after updating
linkml-runtime to 1.9.x because the schema for the file core ontology
was trying to import this file:

tests/outputs/hca/core/file/module/ontology/file_content_ontology.yaml

when it should have been trying to import this file:

tests/outputs/hca/module/ontology/file_content_ontology.yaml

If this were my own branch, I'd force push a typo fix, but it's not!

@amc-corey-cox amc-corey-cox merged commit 70fe4eb into main May 19, 2025
20 of 21 checks passed
@amc-corey-cox amc-corey-cox deleted the update_linkml_163 branch May 19, 2025 18:20
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.

2 participants