@Override
protected void configureValidationConstraints(ValidatorBuilder builder, Individual<?,?> individual, DataSet metadata) {
builder.withPropertyConstraint(ValidationConstraintFactory.mandatoryPropertyValues(individual.property(RDF.TYPE.as(URI.class))));
Multimap<URI,AttachedTemplate> attachmentMap=LinkedHashMultimap.create();
for(AttachedTemplate attachedTemplate:template().attachedTemplates()) {
URI propertyId = attachedTemplate.predicate().or(HAS_ATTACHMENT);
attachmentMap.put(propertyId, attachedTemplate);
}
for(Entry<URI, Collection<AttachedTemplate>> entry:attachmentMap.asMap().entrySet()) {
URI propertyId=entry.getKey();
Property property = individual.property(propertyId);
if(property!=null) {
configurePropertyValidationConstraints(builder,individual,metadata,property,entry.getValue());
} else {
builder.withPropertyConstraint(ValidationConstraintFactory.readOnlyProperty(individual.id(),propertyId));
}
}
}