/// <summary> /// Validates the given data graph against the given SHACL shape /// </summary> internal static RDFValidationReport ValidateShape(RDFShapesGraph shapesGraph, RDFGraph dataGraph, RDFShape shape, List <RDFPatternMember> focusNodes = null) { RDFValidationReport report = new RDFValidationReport(new RDFResource()); if (!shape.Deactivated) { //Resolve focus nodes if (focusNodes == null) { focusNodes = dataGraph.GetFocusNodesOf(shape); } foreach (RDFPatternMember focusNode in focusNodes) { //Resolve value nodes List <RDFPatternMember> valueNodes = dataGraph.GetValueNodesOf(shape, focusNode); //Evaluate constraints foreach (RDFConstraint constraint in shape) { report.MergeResults(constraint.ValidateConstraint(shapesGraph, dataGraph, shape, focusNode, valueNodes)); } } } return(report); }