/** Check an IRI string (does not resolve it) */ public static boolean checkIRI(String iriStr) { IRI iri = parseIRI(iriStr); return iri.hasViolation(false); }
/** Check an IRI string (does not resolve it) */ public static boolean checkIRI(String iriStr) { IRI iri = parseIRI(iriStr) ; return iri.hasViolation(false) ; }
/** * Validates a URI is indeed valid * @param uri * @return */ public static boolean isValidUri(String uri) { return !iriFactory.create(uri).hasViolation(false); }
/** * Validates a URI is indeed valid * @param uri * @return */ public static boolean isValidUri(String uri) { return !iriFactory.create(uri).hasViolation(false); }
final public boolean checkIRI(IRI iri, long line, long col) { iriViolations(iri, handler, allowRelativeIRIs, true, line, col) ; return ! iri.hasViolation(true) ; }
final public boolean checkIRI(IRI iri, long line, long col) { iriViolations(iri, handler, allowRelativeIRIs, true, line, col) ; return !iri.hasViolation(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); } }
protected IRI throwAnyErrors(IRI rslt) throws IRIException { if (rslt.hasViolation(false)) { throw new IRIImplException(rslt.violations(false).next()); // Iterator it = rslt.exceptions(); // while (it.hasNext()){ // Violation v = (Violation)it.next(); // if (v.isError()) // throw new IRIImplException(v); // } } return rslt; }
protected IRI throwAnyErrors(IRI rslt) throws IRIException { if (rslt.hasViolation(false)) { throw new IRIImplException(rslt.violations(false).next()); // Iterator it = rslt.exceptions(); // while (it.hasNext()){ // Violation v = (Violation)it.next(); // if (v.isError()) // throw new IRIImplException(v); // } } return rslt; }
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; } }
private static String iri(String localname) { String uri = NS+localname; IRI iri = IRIResolver.parseIRI(uri); if ( iri.hasViolation(true) ) throw new FusekiException("Bad IRI: "+iri); if ( ! iri.isAbsolute() ) throw new FusekiException("Bad IRI: "+iri); return uri; } }
private static String iri(String localname) { String uri = NS+localname; IRI iri = IRIResolver.parseIRI(uri); if ( iri.hasViolation(true) ) throw new FusekiException("Bad IRI: "+iri); if ( ! iri.isAbsolute() ) throw new FusekiException("Bad IRI: "+iri); return uri; } }
public void testURI(String uri, boolean ok) { IRI ref = factory.create(uri); if (ok && ref.hasViolation(false)) { Violation v = ref.violations(false).next(); fail("<" + uri + "> is expected to be a URI, but: "+v.getLongMessage()); } assertEquals("<" + uri + "> is"+(ok?" ":" not ")+"a URI", ok, !ref.hasViolation(false)); } public void testNoDomain() {
public void testURI(String uri, boolean ok) { IRI ref = factory.create(uri); if (ok && ref.hasViolation(false)) { Violation v = ref.violations(false).next(); fail("<" + uri + "> is expected to be a URI, but: "+v.getLongMessage()); } assertEquals("<" + uri + "> is"+(ok?" ":" not ")+"a URI", ok, !ref.hasViolation(false)); } public void testNoDomain() {
@Override public AbsXMLContext withBase(XMLHandler forErrors, String b) throws SAXParseException { TaintImpl taintB = new TaintImpl(); IRI newB = resolveAsURI(forErrors, taintB, b, false); if (newB.isRelative() ) return new XMLBaselessContext(forErrors,errno,newB.create("")); if (newB.hasViolation(false)) return new XMLBaselessContext(forErrors,ERR_RESOLVING_AGAINST_MALFORMED_BASE,newB); return new XMLContext(keepDocument(forErrors), document, newB .create(""), taintB, lang, langTaint); }
public AbsXMLContext withBase(XMLHandler forErrors, String b) throws SAXParseException { TaintImpl taintB = new TaintImpl(); IRI newB = resolveAsURI(forErrors, taintB, b, false); if (newB.isRelative()) return new XMLBaselessContext(forErrors,ERR_RESOLVING_AGAINST_RELATIVE_BASE, newB.create("")); if (newB.hasViolation(false)) return new XMLBaselessContext(forErrors, ERR_RESOLVING_AGAINST_MALFORMED_BASE, newB); return new XMLContext(keepDocument(forErrors), document, newB .create(""), taintB, lang, langTaint); }
@Override public AbsXMLContext withBase(XMLHandler forErrors, String b) throws SAXParseException { TaintImpl taintB = new TaintImpl(); IRI newB = resolveAsURI(forErrors, taintB, b, false); if (newB.isRelative() ) return new XMLBaselessContext(forErrors,errno,newB.create("")); if (newB.hasViolation(false)) return new XMLBaselessContext(forErrors,ERR_RESOLVING_AGAINST_MALFORMED_BASE,newB); return new XMLContext(keepDocument(forErrors), document, newB .create(""), taintB, lang, langTaint); }
public AbsXMLContext withBase(XMLHandler forErrors, String b) throws SAXParseException { TaintImpl taintB = new TaintImpl(); IRI newB = resolveAsURI(forErrors, taintB, b, false); if (newB.isRelative()) return new XMLBaselessContext(forErrors,ERR_RESOLVING_AGAINST_RELATIVE_BASE, newB.create("")); if (newB.hasViolation(false)) return new XMLBaselessContext(forErrors, ERR_RESOLVING_AGAINST_MALFORMED_BASE, newB); return new XMLContext(keepDocument(forErrors), document, newB .create(""), taintB, lang, langTaint); }
@Override public AbsXMLContext withBase(XMLHandler forErrors, String b) throws SAXParseException { TaintImpl taintB = new TaintImpl(); IRI newB = resolveAsURI(forErrors, taintB, b, false); if (newB.isRelative() ) return new XMLBaselessContext(forErrors,errno,newB.create("")); if (newB.hasViolation(false)) return new XMLBaselessContext(forErrors,ERR_RESOLVING_AGAINST_MALFORMED_BASE,newB); return new XMLContext(keepDocument(forErrors), document, newB .create(""), taintB, lang, langTaint); }
public AbsXMLContext withBase(XMLHandler forErrors, String b) throws SAXParseException { TaintImpl taintB = new TaintImpl(); IRI newB = resolveAsURI(forErrors, taintB, b, false); if (newB.isRelative()) return new XMLBaselessContext(forErrors,ERR_RESOLVING_AGAINST_RELATIVE_BASE, newB.create("")); if (newB.hasViolation(false)) return new XMLBaselessContext(forErrors, ERR_RESOLVING_AGAINST_MALFORMED_BASE, newB); return new XMLContext(keepDocument(forErrors), document, newB .create(""), taintB, lang, langTaint); }