@Override public String getMessage() { return getViolation().getShortMessage(); }
protected static void checkURI(XMLHandler forErrors, Taint taintMe, IRI rslt) throws SAXParseException { if (rslt.hasViolation(false)) { Iterator<Violation> it = rslt.violations(false); while (it.hasNext()) { Violation irie = it.next(); // if (irie.getViolationCode() == // ViolationCodes.REQUIRED_COMPONENT_MISSING) String msg = irie.getShortMessage(); if (irie.getViolationCode() == ViolationCodes.REQUIRED_COMPONENT_MISSING && irie.getComponent() == IRIComponents.SCHEME) { if (!forErrors.allowRelativeURIs()) forErrors.warning(taintMe, WARN_RELATIVE_URI, "Relative URIs are not permitted in RDF: specifically <"+rslt.toString()+">"); } else forErrors.warning(taintMe, WARN_MALFORMED_URI, "Bad URI: " + msg); } } }
private void check(String string) { IRI iri = factory.create(string); if (iri.hasViolation(true)) { System.out.println("n: " + string); Iterator<Violation> it = iri.violations(true); while (it.hasNext()) { Violation v = it.next(); System.out.println(v.getLongMessage()); } } else { System.out.println("y: " + string); } }
int code = v.getViolationCode() ; boolean isError = v.isError() ; String msg = v.getShortMessage() ; String iriStr = iri.toString() ;
String str = v.getShortMessage() ; if ( v.isError() ) errors.add(str) ; else
@Override public boolean hasNext() { if (next==null) { while (underlying.hasNext()) { next = underlying.next(); if (((1l << (next).getViolationCode()) & mask) != 0) return true; } next = null; return false; } return true; }
int code = v.getViolationCode() ; boolean isError = v.isError() ; String msg = v.getShortMessage(); String iriStr = iri.toString();
String str = v.getShortMessage() ; if ( v.isError() ) errors.add(str) ; else
@Override public boolean hasNext() { if (next==null) { while (underlying.hasNext()) { next = underlying.next(); if (((1l << (next).getViolationCode()) & mask) != 0) return true; } next = null; return false; } return true; }
@Override public String getMessage() { return getViolation().getShortMessage(); }
protected static void checkURI(XMLHandler forErrors, Taint taintMe, IRI rslt) throws SAXParseException { if (rslt.hasViolation(false)) { Iterator<Violation> it = rslt.violations(false); while (it.hasNext()) { Violation irie = it.next(); // if (irie.getViolationCode() == // ViolationCodes.REQUIRED_COMPONENT_MISSING) String msg = irie.getShortMessage(); if (irie.getViolationCode() == ViolationCodes.REQUIRED_COMPONENT_MISSING && irie.getComponent() == IRIComponents.SCHEME) { if (!forErrors.allowRelativeURIs()) forErrors.warning(taintMe, WARN_RELATIVE_URI, "Relative URIs are not permitted in RDF: specifically <"+rslt.toString()+">"); } else forErrors.warning(taintMe, WARN_MALFORMED_URI, "Bad URI: " + msg); } } }
@Override public boolean hasNext() { if (next==null) { while (underlying.hasNext()) { next = underlying.next(); if (((1l << (next).getViolationCode()) & mask) != 0) return true; } next = null; return false; } return true; }
private void check(String string) { IRI iri = factory.create(string); if (iri.hasViolation(true)) { System.out.println("n: " + string); Iterator<Violation> it = iri.violations(true); while (it.hasNext()) { Violation v = it.next(); System.out.println(v.getLongMessage()); } } else { System.out.println("y: " + string); } }
@Override public String getMessage() { return getViolation().getShortMessage(); }
protected static void checkURI(XMLHandler forErrors, Taint taintMe, IRI rslt) throws SAXParseException { if (rslt.hasViolation(false)) { Iterator<Violation> it = rslt.violations(false); while (it.hasNext()) { Violation irie = it.next(); // if (irie.getViolationCode() == // ViolationCodes.REQUIRED_COMPONENT_MISSING) String msg = irie.getShortMessage(); String uri = rslt.toString(); // if (msg.endsWith(uri)) { // msg = msg.substring(0, msg.length() - uri.length()) + "<" // + uri + ">"; // } else { // msg = "<" + uri + "> " + msg; // } if (irie.getViolationCode() == ViolationCodes.REQUIRED_COMPONENT_MISSING && irie.getComponent() == IRIComponents.SCHEME) { if (!forErrors.allowRelativeURIs()) forErrors.warning(taintMe, WARN_RELATIVE_URI, "Relative URIs are not permitted in RDF: specifically <" + rslt.toString() + ">"); } else forErrors.warning(taintMe, WARN_MALFORMED_URI, "Bad URI: " + msg); } } }
private void check(String string) { IRI iri = factory.create(string); if (iri.hasViolation(true)) { System.out.println("n: " + string); Iterator<Violation> it = iri.violations(true); while (it.hasNext()) { Violation v = it.next(); System.out.println(v.getLongMessage()); } } else { System.out.println("y: " + string); } }
private boolean checkURI( String uri ) { IRIFactory factory = IRIFactory.jenaImplementation(); IRI iri = factory.create( uri ); if (iri.hasViolation(false) ) { log.error("Bad URI: "+uri); log.error( "Only well-formed absolute URIrefs can be included in RDF/XML output: " + iri.violations(false).next().getShortMessage()); return true; } else { return false; } }
static private void show(IRI iri) { System.out.println("Scheme: " + iri.getScheme()); System.out.println("Authority: " + iri.getRawAuthority()); System.out.println("User: " + iri.getRawUserinfo()); System.out.println("Host: " + iri.getRawHost()); System.out.println("Port: " + iri.getPort()); System.out.println("Path: " + iri.getRawPath()); System.out.println("Query: " + iri.getRawQuery()); System.out.println("Fragment: " + iri.getRawFragment()); Iterator<Violation> it = ((AbsIRIImpl) iri).allViolations(); while (it.hasNext()) { System.out.println(it.next().getLongMessage()); } it = ((AbsIRIImpl) iri).violations(true); while (it.hasNext()) { System.out.println("+"+it.next().getLongMessage()); } it = ((AbsIRIImpl) iri).violations(false); while (it.hasNext()) { System.out.println("++"+it.next().getLongMessage()); } }
public static void main(String... args) { //IRIFactory iriFactory = IRIFactory.iriImplementation() ; IRIFactory iriFactory = IRIResolver.iriFactory() ; boolean first = true ; for ( String iriStr : args ) { if ( iriStr.startsWith("<") && iriStr.endsWith(">") ) iriStr = iriStr.substring(1, iriStr.length()-1) ; if ( ! first ) System.out.println() ; first = false ; IRI iri = iriFactory.create(iriStr) ; System.out.println(iriStr + " ==> "+iri) ; if ( iri.isRelative() ) System.out.println("Relative: "+iri.isRelative()) ; Iterator<Violation> vIter = iri.violations(true) ; for ( ; vIter.hasNext() ; ) { System.out.println(vIter.next().getShortMessage()) ; } } }
static private void show(IRI iri) { System.out.println("Scheme: " + iri.getScheme()); System.out.println("Authority: " + iri.getRawAuthority()); System.out.println("User: " + iri.getRawUserinfo()); System.out.println("Host: " + iri.getRawHost()); System.out.println("Port: " + iri.getPort()); System.out.println("Path: " + iri.getRawPath()); System.out.println("Query: " + iri.getRawQuery()); System.out.println("Fragment: " + iri.getRawFragment()); Iterator<Violation> it = ((AbsIRIImpl) iri).allViolations(); while (it.hasNext()) { System.out.println(it.next().getLongMessage()); } it = ((AbsIRIImpl) iri).violations(true); while (it.hasNext()) { System.out.println("+"+it.next().getLongMessage()); } it = ((AbsIRIImpl) iri).violations(false); while (it.hasNext()) { System.out.println("++"+it.next().getLongMessage()); } }