Search in sources :

Example 1 with IndividualPropertySpec

use of won.shacl2java.sourcegen.typegen.support.IndividualPropertySpec in project webofneeds by researchstudio-sat.

the class MainTypesPostprocessor method checkShapeForIndividuals.

private Set<IndividualPropertySpec> checkShapeForIndividuals(Shape shape) {
    Set<IndividualPropertySpec> individualPropertySpecs = new HashSet<>();
    shape.getShapeGraph().find(shape.getShapeNode(), null, null).forEach(triple -> {
        Node pred = triple.getPredicate();
        Node obj = triple.getObject();
        if (!(pred.isURI() && obj.isURI())) {
            return;
        }
        if (pred.getURI().startsWith(SHACL.getURI())) {
            return;
        }
        if (obj.getURI().startsWith(SHACL.getURI())) {
            return;
        }
        Optional<ClassName> type = individualClassNames.get(obj);
        if (!type.isPresent()) {
            return;
        }
        // we found a static property, add to property spec:
        IndividualPropertySpec spec = new IndividualPropertySpec(pred, type.get());
        spec.addObject(obj);
        individualPropertySpecs.add(spec);
    });
    return individualPropertySpecs;
}
Also used : IndividualPropertySpec(won.shacl2java.sourcegen.typegen.support.IndividualPropertySpec)

Aggregations

IndividualPropertySpec (won.shacl2java.sourcegen.typegen.support.IndividualPropertySpec)1