Search in sources :

Example 6 with ReportItem

use of org.apache.jena.shacl.validation.ReportItem in project jena by apache.

the class ShAnd method validate.

@Override
public ReportItem validate(ValidationContext vCxt, Graph data, Node node) {
    for (Shape sh : others) {
        ValidationContext vCxt2 = ValidationContext.create(vCxt);
        ValidationProc.execValidateShape(vCxt2, data, sh, node);
        boolean innerConforms = vCxt2.generateReport().conforms();
        if (!innerConforms) {
            String msg = toString() + " at focusNode " + displayStr(node);
            return new ReportItem(msg, node);
        }
    }
    return null;
}
Also used : Shape(org.apache.jena.shacl.parser.Shape) ReportItem(org.apache.jena.shacl.validation.ReportItem) ValidationContext(org.apache.jena.shacl.engine.ValidationContext)

Example 7 with ReportItem

use of org.apache.jena.shacl.validation.ReportItem in project jena by apache.

the class ShNot method validate.

@Override
public ReportItem validate(ValidationContext vCxt, Graph data, Node node) {
    ValidationContext vCxt2 = ValidationContext.create(vCxt);
    ValidationProc.execValidateShape(vCxt2, data, other, node);
    boolean innerConforms = vCxt2.generateReport().conforms();
    if (!innerConforms)
        return null;
    String msg = "Not[" + other + "] at focusNode " + displayStr(node);
    return new ReportItem(msg, node);
}
Also used : ReportItem(org.apache.jena.shacl.validation.ReportItem) ValidationContext(org.apache.jena.shacl.engine.ValidationContext)

Example 8 with ReportItem

use of org.apache.jena.shacl.validation.ReportItem in project jena by apache.

the class ShXone method validate.

@Override
public ReportItem validate(ValidationContext vCxt, Graph data, Node node) {
    int c = 0;
    for (Shape sh : others) {
        ValidationContext vCxt2 = ValidationContext.create(vCxt);
        ValidationProc.execValidateShape(vCxt2, data, sh, node);
        boolean innerConforms = vCxt2.generateReport().conforms();
        if (innerConforms) {
            c++;
        // Choice: count all vs break as soon as error detected
        // if ( c > 1 )
        // break;
        }
    }
    if (c == 1)
        return null;
    String msg = toString() + " has " + c + " conforming shapes at focusNode " + displayStr(node);
    return new ReportItem(msg, node);
}
Also used : Shape(org.apache.jena.shacl.parser.Shape) ReportItem(org.apache.jena.shacl.validation.ReportItem) ValidationContext(org.apache.jena.shacl.engine.ValidationContext)

Example 9 with ReportItem

use of org.apache.jena.shacl.validation.ReportItem in project jena by apache.

the class ConstraintDataTerm method applyConstraintDataTerm.

private void applyConstraintDataTerm(ValidationContext vCxt, Shape shape, Graph data, Node focusNode, Path path, Node term) {
    ReportItem item = validate(vCxt, data, term);
    if (item == null)
        return;
    vCxt.reportEntry(item.getMessage(), shape, focusNode, path, item.getValue(), this);
}
Also used : ReportItem(org.apache.jena.shacl.validation.ReportItem)

Example 10 with ReportItem

use of org.apache.jena.shacl.validation.ReportItem in project jena by apache.

the class ConstraintTerm method applyConstraintTerm.

private void applyConstraintTerm(ValidationContext vCxt, Shape shape, Node focusNode, Path path, Node term) {
    ReportItem item = validate(vCxt, term);
    if (item == null)
        return;
    vCxt.reportEntry(item, shape, focusNode, path, this);
}
Also used : ReportItem(org.apache.jena.shacl.validation.ReportItem)

Aggregations

ReportItem (org.apache.jena.shacl.validation.ReportItem)11 ValidationContext (org.apache.jena.shacl.engine.ValidationContext)5 Shape (org.apache.jena.shacl.parser.Shape)3 Node (org.apache.jena.graph.Node)1 CompactOut.compactArrayString (org.apache.jena.shacl.compact.writer.CompactOut.compactArrayString)1 ExprNotComparableException (org.apache.jena.sparql.expr.ExprNotComparableException)1 NodeValue (org.apache.jena.sparql.expr.NodeValue)1 ValueSpaceClassification (org.apache.jena.sparql.expr.ValueSpaceClassification)1