added "inherit" relation, #3493

This commit is contained in:
zadam
2023-01-06 20:31:55 +01:00
parent a863da1dce
commit 8a641e1b4f
21 changed files with 49 additions and 41 deletions

View File

@@ -56,7 +56,7 @@ class SAttribute extends AbstractShacaEntity {
/** @returns {boolean} */
get isAffectingSubtree() {
return this.isInheritable
|| (this.type === 'relation' && this.name === 'template');
|| (this.type === 'relation' && ['template', 'inherit'].includes(this.name));
}
/** @returns {string} */

View File

@@ -167,7 +167,7 @@ class SNote extends AbstractShacaEntity {
const templateAttributes = [];
for (const ownedAttr of parentAttributes) { // parentAttributes so we process also inherited templates
if (ownedAttr.type === 'relation' && ownedAttr.name === 'template') {
if (ownedAttr.type === 'relation' && ['template', 'inherit'].includes(ownedAttr.name)) {
const templateNote = this.shaca.notes[ownedAttr.value];
if (templateNote) {
@@ -434,8 +434,8 @@ class SNote extends AbstractShacaEntity {
}
/** @returns {boolean} */
isTemplate() {
return !!this.targetRelations.find(rel => rel.name === 'template');
isInherited() {
return !!this.targetRelations.find(rel => rel.name === 'template' || rel.name === 'inherit');
}
/** @returns {SAttribute[]} */