-
Notifications
You must be signed in to change notification settings - Fork 35
schemaview.py: adding induced_slot_range
function to retrieve the possible ranges for a slot
#471
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
base: main
Are you sure you want to change the base?
Conversation
…et of possible ranges for a slot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #471 +/- ##
==========================================
+ Coverage 77.65% 77.77% +0.11%
==========================================
Files 52 52
Lines 4480 4499 +19
Branches 973 979 +6
==========================================
+ Hits 3479 3499 +20
Misses 779 779
+ Partials 222 221 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
"induced_slot_range", | ||
"induced_range_strict", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two new elements here -- testing the induced_slot_range
function and induced_slot_range
with the strict
kwarg set
(sv_range, range_tuple) = sv_range_riid_gen | ||
|
||
slots_by_name = {s.name: s for s in sv_range.class_induced_slots("ClassWithRanges")} | ||
slot_object = sv_range.induced_slot(slot_name, "ClassWithRanges") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was
slots_by_name = {s.name: s for s in sv_range.class_induced_slots("ClassWithRanges")}
No real need to generate induced slots for all the slots in ClassWithRanges -- just generate the induced slot for the slot under investigation.
if slot_range: | ||
return {slot_range} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike slot_range_as_union
, if the slot range is None
, this function does not return [None]
; it returns an empty set. If the slot range is defined, it returns a set containing that range.
Similar in function to
slot_range_as_union
but performs a number of checks and removeslinkml:Any
orNone
from the results.I am not particularly stuck on the name so if anyone has a better one, go ahead and suggest it!