Skip to content

Conversation

@apdavison
Copy link
Member

@apdavison apdavison commented Jul 18, 2025

(i.e., to online instances outside the local Collection)

  • Link objects are now properly serialized in JSON-LD
  • Links can now be annotated with a list of types that they may be pointing to - this allows collections that contain Links to validate
  • The Link class is now directly available in the top-level openminds module.

Example:

from openminds import Link
from openminds.v4.controlled_terms import Species
from openminds.v4.core import DatasetVersion

mouse = Link(
    "https://openminds.om-i.org/instances/species/musMusculus",
    allowed_types=[Species]
)

my_dsv = DatasetVersion(
    ...,
    study_targets=[mouse]
)

(this is perhaps a bad example, since all instances in the openMINDS instances library are anyway directly available (e.g. mouse = Species.mus_musculus, but it serves to illustrate the idea)

…the local Collection)

- Link objects are now properly serialized in JSON-LD
- Links can now be annotated with a list of types that they may be pointing to - this allows collections that contain Links to validate
- Link is now directly available in the top-level openminds module.
@apdavison apdavison marked this pull request as draft July 18, 2025 15:04
@apdavison apdavison added the enhancement New feature or request label Jul 18, 2025
@apdavison apdavison marked this pull request as ready for review July 30, 2025 20:00
@apdavison
Copy link
Member Author

I'm unsure whether allowed_types or expected_types is the most appropriate name.

Comment on lines +80 to +88
from openminds.v4.controlled_terms import Species
from openminds.v4.core import DatasetVersion

maybe_mouse = Link("https://openminds.om-i.org/instances/species/musMusculus")

definitely_mouse = Link(
"https://openminds.om-i.org/instances/species/musMusculus",
allowed_types=[Species],
)
Copy link
Member

@Raphael-Gazzotti Raphael-Gazzotti Jul 31, 2025

Choose a reason for hiding this comment

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

It would be better to avoid hardcoding the version and namespace of the instances.

I would also move:
"definitely_mouse = Link(
"https://openminds.om-i.org/instances/species/musMusculus",
allowed_types=[Species],
)"

just on top of "my_dsv2 = DatasetVersion(study_targets=[definitely_mouse])"

Copy link
Member Author

@apdavison apdavison Jul 31, 2025

Choose a reason for hiding this comment

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

"better to avoid hardcoding" - do you mean the test should iterate over all versions, and introspect the namespace from the version?

"would also move" - I think this is a matter of taste. I think that by grouping the Link creation on consecutive lines it makes the test easier to understand.

Copy link
Member

Choose a reason for hiding this comment

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

Yes to the first option, because it will require to be adjusted for each new version (v5.0 and above).
The second point seems fair.

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't need to be adjusted for new versions, the test would work with any openminds version, I chose v4 for no particular reason.

@Raphael-Gazzotti Raphael-Gazzotti merged commit 63e827d into pipeline Aug 1, 2025
1 check passed
@Raphael-Gazzotti Raphael-Gazzotti deleted the improved-external-links branch August 1, 2025 06:41
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.

3 participants