fixed relationship resolution in merger and queryer
This commit is contained in:
@ -622,7 +622,23 @@ pub(crate) fn resolve_relation<'a>(
|
||||
}
|
||||
}
|
||||
|
||||
if !resolved {
|
||||
// 1. If there's EXACTLY ONE relation with a null prefix, it's the base structural edge. Pick it.
|
||||
let mut null_prefix_ids = Vec::new();
|
||||
for (i, rel) in matching_rels.iter().enumerate() {
|
||||
if rel.prefix.is_none() {
|
||||
null_prefix_ids.push(i);
|
||||
}
|
||||
}
|
||||
if null_prefix_ids.len() == 1 {
|
||||
chosen_idx = null_prefix_ids[0];
|
||||
resolved = true;
|
||||
}
|
||||
}
|
||||
|
||||
if !resolved && relative_keys.is_some() {
|
||||
// 2. M:M Disambiguation: The child schema will explicitly define an outbound property
|
||||
// matching one of the relational prefixes (e.g. "target"). We use the OTHER one (e.g. "source").
|
||||
let keys = relative_keys.unwrap();
|
||||
let mut missing_prefix_ids = Vec::new();
|
||||
for (i, rel) in matching_rels.iter().enumerate() {
|
||||
@ -634,6 +650,7 @@ pub(crate) fn resolve_relation<'a>(
|
||||
}
|
||||
if missing_prefix_ids.len() == 1 {
|
||||
chosen_idx = missing_prefix_ids[0];
|
||||
// resolved = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user