From e54627f3a6524eaea6d01b5673e85005ab233d1a Mon Sep 17 00:00:00 2001 From: Thomas Francart Date: Sun, 29 Sep 2024 15:17:01 +0200 Subject: [PATCH] Fix #634 --- .../spec-providers/shacl/SHACLSpecificationEntity.ts | 2 +- .../spec-providers/shacl/SHACLSpecificationProvider.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sparnatural/spec-providers/shacl/SHACLSpecificationEntity.ts b/src/sparnatural/spec-providers/shacl/SHACLSpecificationEntity.ts index 29db15d7..fd05c5ee 100644 --- a/src/sparnatural/spec-providers/shacl/SHACLSpecificationEntity.ts +++ b/src/sparnatural/spec-providers/shacl/SHACLSpecificationEntity.ts @@ -223,7 +223,7 @@ export class SHACLSpecificationEntity extends SHACLSpecificationEntry implements } /** - * @returns all properties available on this node shape, including inherited properties from superclasses + * @returns all (non-deactivated) properties available on this node shape, including inherited properties from superclasses */ getProperties(): string[] { var items: string[] = []; diff --git a/src/sparnatural/spec-providers/shacl/SHACLSpecificationProvider.ts b/src/sparnatural/spec-providers/shacl/SHACLSpecificationProvider.ts index 815a5e1d..96b03ae6 100644 --- a/src/sparnatural/spec-providers/shacl/SHACLSpecificationProvider.ts +++ b/src/sparnatural/spec-providers/shacl/SHACLSpecificationProvider.ts @@ -389,6 +389,12 @@ export class SHACLSpecificationProvider extends BaseRDFReader implements ISparna return !that.graph.hasTriple(node, SH.DEACTIVATED, factory.literal("true", XSD.BOOLEAN)) }); + // remove from the initial list the NodeShapes that are connected to only deactivated properties + // by checking the lenght of the list of properties we can make sure of that + dedupNodeShapes = dedupNodeShapes.filter(node => { + return (this.getEntity(node.value) as SHACLSpecificationEntity).getProperties().length > 0; + }); + var items: SHACLSpecificationEntity[] = []; for (const aNode of dedupNodeShapes) { items.push((this.getEntity(aNode.value) as SHACLSpecificationEntity));