fix inverse relation detection in relation maps

This commit is contained in:
zadam
2020-09-12 22:21:44 +02:00
parent 847766b434
commit 63ebb46049
4 changed files with 69 additions and 6 deletions

View File

@@ -380,15 +380,15 @@ class Note extends Entity {
return firstDefinitionIndex === index;
}
else {
const definitionAttr = attributes.find(el => el.type === attr.type + '-definition' && el.name === attr.name);
const definitionAttr = attributes.find(el => el.type === 'label' && el.name === attr.type + ':' + attr.name);
if (!definitionAttr) {
return true;
}
const definition = definitionAttr.value;
const definition = definitionAttr.getDefinition();
if (definition.multiplicityType === 'multi') {
if (definition.multiplicity === 'multi') {
return true;
}
else {
@@ -868,6 +868,16 @@ class Note extends Entity {
return notePaths;
}
getRelationDefinitions() {
return this.getLabels()
.filter(l => l.name.startsWith("relation:"));
}
getLabelDefinitions() {
return this.getLabels()
.filter(l => l.name.startsWith("relation:"));
}
/**
* @param ancestorNoteId
* @return {boolean} - true if ancestorNoteId occurs in at least one of the note's paths