public static void addConstraintViolationsRDF(List<ConstraintViolation> cvs,Model result,boolean createSource){
  for (  ConstraintViolation cv : cvs) {
    Resource r=result.createResource(SPIN.ConstraintViolation);
    String message=cv.getMessage();
    if (message != null && message.length() > 0) {
      r.addProperty(RDFS.label,message);
    }
    if (cv.getRoot() != null) {
      r.addProperty(SPIN.violationRoot,cv.getRoot());
    }
    r.addProperty(SPIN.violationLevel,cv.getLevel());
    for (    SimplePropertyPath path : cv.getPaths()) {
      if (path instanceof ObjectPropertyPath) {
        r.addProperty(SPIN.violationPath,path.getPredicate());
      }
 else {
        Resource p=result.createResource(SP.ReversePath);
        p.addProperty(SP.path,path.getPredicate());
        r.addProperty(SPIN.violationPath,p);
      }
    }
    if (createSource && cv.getSource() != null) {
      r.addProperty(SPIN.violationSource,cv.getSource());
    }
    if (cv.getValue() != null) {
      r.addProperty(SPIN.violationValue,cv.getValue());
    }
  }
}

public static void addConstraintViolationsRDF ( List < ConstraintViolation > cvs , Model result , boolean createSource ) { for ( ConstraintViolation cv : cvs ) { Resource r = result . createResource ( SPIN . ConstraintViolation ) ; String message = cv . getMessage ( ) ; if ( message != null && message . length ( ) > 0 ) { r . addProperty ( RDFS . label , message ) ; } if ( cv . getRoot ( ) != null ) { r . addProperty ( SPIN . violationRoot , cv . getRoot ( ) ) ; } r . addProperty ( SPIN . violationLevel , cv . getLevel ( ) ) ; for ( SimplePropertyPath path : cv . getPaths ( ) ) { if ( path instanceof ObjectPropertyPath ) { r . addProperty ( SPIN . violationPath , path . getPredicate ( ) ) ; } else { Resource p = result . createResource ( SP . ReversePath ) ; p . addProperty ( SP . path , path . getPredicate ( ) ) ; r . addProperty ( SPIN . violationPath , p ) ; } } if ( createSource && cv . getSource ( ) != null ) { r . addProperty ( SPIN . violationSource , cv . getSource ( ) ) ; } if ( cv . getValue ( ) != null ) { r . addProperty ( SPIN . violationValue , cv . getValue ( ) ) ; } } }
creates an rdf representation ( instances of spin : constraintviolation ) from a collection of constraintviolation java objects .
