Closed evomimic closed 3 months ago
@evomimic for create_link_tag() how are the smart_property_values concatenated into a String?
https://github.com/evomimic/map-holons/wiki/SmartLink-Manager says "Null-separated values (serialized into a String) for each of the properties listed in the access_path for this SmartLink. These values allow the Query Engine to filter/sort SmartLinks without having to fetch the target holon."
so I know that we are doing away with access paths and now just passing through the property values themselves, but my question is twofold:
bytes.extend_from_slice(UNICODE_NUL_STR.as_bytes());
after each value?@evomimic should we be passing smart_property_values into get_relationship_links() ? or is that unnecessary as it is not a filter that will be used in this function? if so, should that feature also be added to load_relationship_map() ?
@evomimic should we be passing smart_property_values into get_relationship_links() ? or is that unnecessary as it is not a filter that will be used in this function? if so, should that feature also be added to load_relationship_map() ?
No. Under the current design, we always load all links for a relationship into the Shared Objects Layer. Filtering is only applied in the Query Layer.
@evomimic for create_link_tag() how are the smart_property_values concatenated into a String? I know that we are doing away with access paths and now just passing through the property values themselves, but my question is twofold:
- when creating the bytes, am I pushing
bytes.extend_from_slice(UNICODE_NUL_STR.as_bytes());
after each value?- does the property name get included in the String, and if so, how should that look?
I have updated SmartLink Manager wiki with answers to both questions. We ARE storing both property_names and property_values in the SmartLink. See the wiki page for delimiters used.
@evomimic when parsing the link tag to build the PropertyMap, there is currently no way to identify the PropertyValue as the corresponding BaseValue type. A potential solution is to add another separator symbol after Ⓥ. We would need one for each: StringValue, IntegerValue, BooleanValue, EnumValue
@dauphin3 : Yea... more problems arising due to lack of descriptors.
For the short term, the only value I need in the SmartLink is the key
value (if defined) and that is a MapString. Here's the short-term workaround:
holon_reference.get_key
to retrieve the holon's key
. If not None, add a property to the SmartLink, use "key" as the property_name and the results of the get_key call as the value.Instead of getting the key from the referenced holon (which forces retrieval of the holon), we should get the key from the SmartLink itself.
get_key->Result<Option<MapString>, HolonError>
method. For now, the implementation of this method should get the MapString value for the "key" property. If no value found, return None. Otherwise return the key value.Change signature of
create_link_tag
tocreate_link_tag(input: SmartLink)->LinkTag
- Encode relationship_name and smart_property_values (if supplied) in the tag
@evomimic I am using this fn to build a link_tag from the possible parameters it could contain, and so for example in get_relationship_links() I don't have all of the necessary info to pass an entire Smartlink but still need to create a link_tag for filtering reasons and therefore some options could be: 1) keep unchanged 2) have 2 fns create_link_tag_from_smartlink and create_link_tag_xx ie create_link_tag_from_parameters etc 3) keep as is in this issue and then determine some other logic for get_relationship_links 4) construct a different, all encompassing function -- or alternative set of fns
Change signature of
create_link_tag
tocreate_link_tag(input: SmartLink)->LinkTag
- Encode relationship_name and smart_property_values (if supplied) in the tag
@evomimic I am using this fn to build a link_tag from the possible parameters it could contain, and so for example in get_relationship_links() I don't have all of the necessary info to pass an entire Smartlink but still need to create a link_tag for filtering reasons and therefore some options could be:
- keep unchanged
- have 2 fns create_link_tag_from_smartlink and create_link_tag_xx ie create_link_tag_from_parameters etc
- keep as is in this issue and then determine some other logic for get_relationship_links
- construct a different, all encompassing function -- or alternative set of fns
Change signature of
create_link_tag
tocreate_link_tag(input: SmartLink)->LinkTag
- Encode relationship_name and smart_property_values (if supplied) in the tag
@evomimic I am using this fn to build a link_tag from the possible parameters it could contain, and so for example in get_relationship_links() I don't have all of the necessary info to pass an entire Smartlink but still need to create a link_tag for filtering reasons and therefore some options could be:
- keep unchanged
- have 2 fns create_link_tag_from_smartlink and create_link_tag_xx ie create_link_tag_from_parameters etc
- keep as is in this issue and then determine some other logic for get_relationship_links
- construct a different, all encompassing function -- or alternative set of fns
You're right. SmartLink is overkill as input parameter to create_link_tag
. Let's use keep what we have for now (option 1).
As we gear up to add MAP Descriptors and the Query Engine to the architecture, we need to flesh out and simplify more of the SmartLinks model.
Dependencies
None
Current State
smartlink_manager.rs
definesSmartLinkInput
struct andcreate_smart_link()
,create_link_tag()
functionssmartlink.rs
definesAddSmartLinkInput
,RemoveSmartLinkInput
structs andsmartlink_tag_header_length()
,add_smartlink()
,get_smartlinks_for_holon_node()
,remove_smartlink()
,get_relationship_name_from_smartlink()
functionsholon_collection.rs
hassave_smartlinks_for_collection()
functionsrelationship.rs
definesSmartLinkHolder
struct andbuild_relationship_map_from_smartlinks()
andget_relationship_links()
functionsProposal
Consolidate SmartLink related functionality into the
smartlink.rs file
. This file should define all of the SmartLink related data structures and behaviors.In the smartlink.rs file
[x] Replace
AddSmartlinkInput
withSmartLink
. A single data structure used as the transfer object to/from holochain links[x] Move
create_link_tag
andcreate_smart_link
from _smart_linkmanager.rs to smartlink.rs[x] Rename
create_smart_link
assave_smart_link(input: SmartLink)->Result<(),HolonError>
[x] Replace
get_relationship_name_from_smartlink
withpub fn get_smartlink_from_link(link:Link)->Result<SmartLink, HolonError>
[x] Comment out the
get_smartlinks_for_holon_node
function. It was generated by the scaffolding tool and in addition to getting the links, it also gets the target holons. We don't want/need that behavior.[x] Comment out the
add_smartlink()
function (it is being replaced by the save_smartlink function)In the holon.rs file
get_relationship_links
function and thebuild_relationship_map_from_smartlinks()
function from relationship.rs to holon.rsbuild_relationship_map_from_smartlinks()
to:get_relationship_links
.entry(name).or_insert_with(Vec::new).push(reference)
;relationship_map
from thereference_map
In the holon_collection.rs file
save_smartlinks_for_collection
to build a SmartLink object for each collection member and then call thesave_smart_link
function provided by the smartlink.rs fileDelete the smart_link_manager.rs file
In the relationship.rs file
get_relationship_links
(moved to holon.rs)Testing
There is still no code that invokes the
load_realationship_map
function, so there is no real way to test if that function works, but we can ensure nothing else breaks.Definition of Done
There is still no code that invokes the
load_realationship_map
function, so there is no real way to test if that function works, but we can ensure nothing else breaks.