Search in sources :

Example 1 with TargetType

use of org.apache.jena.shacl.engine.TargetType in project jena by apache.

the class ShapesParser method accTarget.

private static void accTarget(Collection<Target> acc, Graph shapesGraph, Node shape, TargetType targetType) {
    ExtendedIterator<Triple> iter = shapesGraph.find(shape, targetType.predicate, null);
    Graph graph;
    switch(targetType) {
        // Java 14 has "->"
        case targetExtension:
            graph = shapesGraph;
            break;
        // These do not need access to the shapes graph so don't force holding on the the graph reference.
        case implicitClass:
        case targetClass:
        case targetNode:
        case targetObjectsOf:
        case targetSubjectsOf:
        default:
            graph = null;
            break;
    }
    try {
        iter.mapWith(triple -> Target.create(triple.getSubject(), targetType, triple.getObject(), graph)).forEachRemaining(target -> acc.add(target));
    } finally {
        iter.close();
    }
}
Also used : Triple(org.apache.jena.graph.Triple) java.util(java.util) Imports(org.apache.jena.shacl.Imports) JLogConstraint(org.apache.jena.shacl.engine.constraint.JLogConstraint) G(org.apache.jena.riot.other.G) Graph(org.apache.jena.graph.Graph) ShLib(org.apache.jena.shacl.lib.ShLib) RDFDataException(org.apache.jena.riot.other.RDFDataException) Severity(org.apache.jena.shacl.validation.Severity) Path(org.apache.jena.sparql.path.Path) ShLib.displayStr(org.apache.jena.shacl.lib.ShLib.displayStr) SHACL(org.apache.jena.shacl.vocabulary.SHACL) C.rdfsClass(org.apache.jena.shacl.sys.C.rdfsClass) Triple(org.apache.jena.graph.Triple) ShaclSystem(org.apache.jena.shacl.sys.ShaclSystem) Collectors(java.util.stream.Collectors) IndentedWriter(org.apache.jena.atlas.io.IndentedWriter) ShaclPaths(org.apache.jena.shacl.engine.ShaclPaths) NodeConst(org.apache.jena.sparql.graph.NodeConst) Node(org.apache.jena.graph.Node) ShaclPaths.pathToString(org.apache.jena.shacl.engine.ShaclPaths.pathToString) XSDDatatype(org.apache.jena.datatypes.xsd.XSDDatatype) Target(org.apache.jena.shacl.engine.Target) Targets(org.apache.jena.shacl.engine.Targets) Pair(org.apache.jena.atlas.lib.Pair) RDFDatatype(org.apache.jena.datatypes.RDFDatatype) TargetType(org.apache.jena.shacl.engine.TargetType) JenaException(org.apache.jena.shared.JenaException) ExtendedIterator(org.apache.jena.util.iterator.ExtendedIterator) Shapes(org.apache.jena.shacl.Shapes) Graph(org.apache.jena.graph.Graph)

Aggregations

java.util (java.util)1 Collectors (java.util.stream.Collectors)1 IndentedWriter (org.apache.jena.atlas.io.IndentedWriter)1 Pair (org.apache.jena.atlas.lib.Pair)1 RDFDatatype (org.apache.jena.datatypes.RDFDatatype)1 XSDDatatype (org.apache.jena.datatypes.xsd.XSDDatatype)1 Graph (org.apache.jena.graph.Graph)1 Node (org.apache.jena.graph.Node)1 Triple (org.apache.jena.graph.Triple)1 G (org.apache.jena.riot.other.G)1 RDFDataException (org.apache.jena.riot.other.RDFDataException)1 Imports (org.apache.jena.shacl.Imports)1 Shapes (org.apache.jena.shacl.Shapes)1 ShaclPaths (org.apache.jena.shacl.engine.ShaclPaths)1 ShaclPaths.pathToString (org.apache.jena.shacl.engine.ShaclPaths.pathToString)1 Target (org.apache.jena.shacl.engine.Target)1 TargetType (org.apache.jena.shacl.engine.TargetType)1 Targets (org.apache.jena.shacl.engine.Targets)1 JLogConstraint (org.apache.jena.shacl.engine.constraint.JLogConstraint)1 ShLib (org.apache.jena.shacl.lib.ShLib)1