[Demo] Implement mapping sameness identifier - #658
Conversation
Well, your proposed design (i.e. a method on the For convenience, maybe the method could take an optional parameter to filter the rows of the dataframe, so that if the caller only wants the hash for one particular record (or a particular group of records), the method would only return the hash(es) for the selected record(s). Something like: def get_mapping_sameness_identifiers(self, selector=None) -> list[str]:
"""Get mapping sameness identifiers for all records (selector == None) or all selected records."""
if selector is not None:
df = self.df.loc[selector]
else:
df = self.df
expand = partial(self.converter.expand, strict=True)
return [
encode_uri_triple(
(expand(subject_curie), expand(predicate_curie), expand(object_curie)),
negate=predicate_modifier == "Not",
)
for subject_curie, predicate_curie, object_curie, predicate_modifier in df[
["subject_id", "predicate_id", "object_id", "predicate_modifier"]
].values
]If you want all the hashes, just call If you only want the hash for the second record, call If you only want the hash for the records whose subject ID is Etc. |
Part of #657
This demo PR shows how the mapping sameness identifier could be implemented.
However, it needs a design. How would someone using sssom-py use this, considering that the primary data structure is a dataframe, whose columns correspond to SSSOM fields?