Skip to content
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

Implement get_relationships_from_links #105

Closed
2 tasks done
evomimic opened this issue Jun 16, 2024 · 1 comment
Closed
2 tasks done

Implement get_relationships_from_links #105

evomimic opened this issue Jun 16, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@evomimic
Copy link
Owner

evomimic commented Jun 16, 2024

This enhancement retrieves and parses SmartLinks from the persistence tier and returns them via a RelationshipMap. Additionally, this enhancement simplifies the RelationshipMap data structures.

Current State

  • Some SmartLinks are being created.
    • SmartLinks are being created upon commit of a StagedHolon, but only in a limited way. Specifically,
      • Outbound SmartLinks are created for each relationship, but their inverse SmartLink is NOT being created. (We need RelationshipDescriptor support to know what the inverse relationship is). This limits navigation to a single direction.
    • Constraint-Based SmartLinks (e.g., for keys and access_paths) are NOT being created (due to the lack of support for Descriptors and HolonSpaces).
  • But none are currently being retrieved.
    • RelationshipTarget has a set of cursors intended to be populated from SmartLinks, but they are not.

Dependencies

Issue #110

Proposal

NOTE: I edited the body of this proposal rather significantly from each original description to take into account the unification of SmartCollection and StagedCollection into HolonCollection and the replacement of RelationshipTarget with HolonCollection.

Add get_relationships_from_links to SmartLinksManager

In the smart_link_manager.rs file:

  • Implement a get_relationships_from_links(source_address:HolonReference, relationship: Option<RelationshipName>)->Result<RelationshipMap, HolonError> function that uses SmartLinks retrieved from the persistence layer to build SmartReferences and aggregate them into one HolonCollection for each RelationshipName it discovers.
    • This function builds a GetLinksInput struct to pass to the hdk's get_links function.
      • base_address is set from source_address
      • link_type is always SmartLink
      • tag_prefix is set to None if no relationship_name is provided, otherwise, relationship_name is encoded in the link_tag in the same fashion as link_tags are encoded during SmartLink creation.
    • If links are being retrieved for a single relationship, the resulting RelationshipMap will contain a single entry. That entry's RelationshipTarget's existing HolonCollection will contain 1 SmartReference for each target of that relationship.
    • If links are being retrieved for all relationships, a different HolonCollection needs to be constructed for each RelationshipName and the resulting RelationshipMap should contain entries for all of the RelationshipNames discovered in the retrieved links.

Testing

No separate test cases will be defined. Full testing of this capability will be handled in #107 .

Definition of Done

  • Everything compiles, all tests pass and a visual examination of the test log demonstrates the function is working.
@evomimic
Copy link
Owner Author

@dauphin3 : I added a new issue #110 . If you work that issue first, then I think #105 becomes easier. Let me know if you have any questions.

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

No branches or pull requests

2 participants