Search in sources :

Example 1 with ShaclNotCompactException

use of org.apache.jena.shacl.compact.writer.ShaclNotCompactException in project jena by apache.

the class ShNot method printCompact.

@Override
public void printCompact(IndentedWriter out, NodeFormatter nodeFmt) {
    // "other" must be a node shape with no property shapes and one constraint.
    Constraint constraint = CompactWriter.getCompactPrintable(other);
    if (constraint == null)
        throw new ShaclNotCompactException("sh:not(" + other + ")");
    out.print("! ");
    constraint.printCompact(out, nodeFmt);
}
Also used : Constraint(org.apache.jena.shacl.parser.Constraint) ShaclNotCompactException(org.apache.jena.shacl.compact.writer.ShaclNotCompactException)

Example 2 with ShaclNotCompactException

use of org.apache.jena.shacl.compact.writer.ShaclNotCompactException in project jena by apache.

the class ShOr method printCompact.

@Override
public void printCompact(IndentedWriter out, NodeFormatter nodeFmt) {
    boolean first = true;
    for (Shape shape : others) {
        if (!first)
            out.print(" | ");
        first = false;
        Constraint c = CompactWriter.getCompactPrintable(shape);
        if (c == null)
            throw new ShaclNotCompactException("or");
        c.printCompact(out, nodeFmt);
    }
}
Also used : Shape(org.apache.jena.shacl.parser.Shape) Constraint(org.apache.jena.shacl.parser.Constraint) ShaclNotCompactException(org.apache.jena.shacl.compact.writer.ShaclNotCompactException)

Aggregations

ShaclNotCompactException (org.apache.jena.shacl.compact.writer.ShaclNotCompactException)2 Constraint (org.apache.jena.shacl.parser.Constraint)2 Shape (org.apache.jena.shacl.parser.Shape)1