Skip to content

Conversation

@ialarmedalien
Copy link
Collaborator

@ialarmedalien ialarmedalien commented Oct 21, 2025

Note: this PR branches off #477, so that PR should ideally be approved and merged first.

Fairly simple function to find the type used for strings in a schema. I have some code in an upcoming PR that will call this repeatedly, so it's easier to create a dedicated method for it and have the result cached.

@ialarmedalien ialarmedalien self-assigned this Oct 21, 2025
@ialarmedalien ialarmedalien added the enhancement New feature or request label Oct 21, 2025
Comment on lines +2172 to +2176
(nullcontext("string"), "\ntypes:\n string:\n base: str\n"),
# retrieve the string using the type URI
(nullcontext("stringiformes"), "\ntypes:\n stringiformes:\n uri: xsd:string\n base: str\n"),
# retrieve the string from the imported linkml:types "string"
(nullcontext("string"), "\nimports:\n - linkml:types\n"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@codecov
Copy link

codecov bot commented Oct 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.19%. Comparing base (65cd85e) to head (27dbda8).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #478      +/-   ##
==========================================
+ Coverage   78.10%   78.19%   +0.09%     
==========================================
  Files          52       52              
  Lines        4512     4522      +10     
  Branches      983      985       +2     
==========================================
+ Hits         3524     3536      +12     
+ Misses        769      768       -1     
+ Partials      219      218       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Silvanoc
Copy link
Contributor

I wonder if we really need such a function in the public interface (that's for me what we document on the documentation webpage). Any potential future change might bring downstream breakage. We start so and we might end-up adding get_bool_type, get_integer_type, get_decimal_type,... If this function is only for internal consumption, I'd rather make it part of some internal utilities that are not part of the public interface.

Base automatically changed from schemaview_minor_file_reorg to main October 22, 2025 15:42
@amc-corey-cox
Copy link
Contributor

@ialarmedalien this PR looks pretty good to me but I think @Silvanoc has raised a valid concern. Can you please respond to that comment?

@ialarmedalien
Copy link
Collaborator Author

ialarmedalien commented Oct 22, 2025

This will be part of a larger function that works out what types are valid for a slot, and more specifically, it will be used to retrieve the type for a slot where the range is an enum.

I'm going to add the components of the larger function in a separate feature branch. The intention is for this larger function to be used by modules that convert a LinkML schema into a different format; it can be used to remap linkml and schema-specific types into the types used in the destination format. Originally the implementation had this code integrated into the body of the function, but enums are a common slot range, and having this value cached would be helpful as it's likely to be called numerous times when running over a schema. I am happy to make the function "private" (a.k.a. rename it to _get_string_type).

@Silvanoc
Copy link
Contributor

This will be part of a larger function that works out what types are valid for a slot, and more specifically, it will be used to retrieve the type for a slot where the range is an enum.

I'm going to add the components of the larger function in a separate feature branch. The intention is for this larger function to be used by modules that convert a LinkML schema into a different format; it can be used to remap linkml and schema-specific types into the types used in the destination format. Originally the implementation had this code integrated into the body of the function, but enums are a common slot range, and having this value cached would be helpful as it's likely to be called numerous times when running over a schema. I am happy to make the function "private" (a.k.a. rename it to _get_string_type).

I'm not 100% I grasp it all. But I don't think I need to 😄

I just wanted you to consider if the addition strictly needs to be public, otherwise I would make it private. If the larger function is going to become part of SchemaView, I would definitively make this function private.

@ialarmedalien
Copy link
Collaborator Author

I've made it private. It can go public later on if it has a taste for the limelight.

Copy link
Contributor

@Silvanoc Silvanoc left a comment

Choose a reason for hiding this comment

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

All concerns addressed

@ialarmedalien ialarmedalien merged commit 4c4bbc9 into main Oct 22, 2025
17 checks passed
@ialarmedalien ialarmedalien deleted the schemaview_get_string_type branch October 22, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants