/** Parse an IRI (does not resolve it) */ public static IRI parseIRI(String iriStr) { return iriFactory().create(iriStr); }
public CheckerIRI() { this(ErrorHandlerFactory.getDefaultErrorHandler(), IRIResolver.iriFactory()) ; }
/** Parse an IRI (does not resolve it) - throws exception on a bad IRI */ public static IRI parseIRIex(String iriStr) throws IRIException { return iriFactory().construct(iriStr); }
@Override public void add(String prefix, String iriString) { prefix = canonicalPrefix(prefix); IRI iri = IRIResolver.iriFactory().create(iriString); prefixes.put(prefix, iri); uriToPrefix.put(iriString, prefix) ; }
public NodeFormatterTTL(String baseIRI, PrefixMap prefixMap, NodeToLabel nodeToLabel) { super(CharSpace.UTF8) ; this.nodeToLabel = nodeToLabel ; if ( prefixMap == null ) prefixMap = PrefixMapFactory.create() ; this.prefixMap = prefixMap ; this.baseIRI = baseIRI ; this.iriResolver = baseIRI != null ? IRIResolver.iriFactory().construct(baseIRI) : null ; }
@Override public void add(String prefix, String iriString) { this.add(prefix, IRIResolver.iriFactory().create(iriString)); }
private IRI resolveSilentNoCache(String uriStr) { IRI x = IRIResolver.iriFactory().create(uriStr); if ( SysRIOT.AbsURINoNormalization ) { // Always process "file:", even in strict mode. // file: is widely used in irregular forms. if ( x.isAbsolute() && ! uriStr.startsWith("file:") ) return x; } return base.create(x); }
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()) ; } } }
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 IRI resolveIRI(String relStr, String baseStr) { IRI i = iriFactory().create(relStr); if (i.isAbsolute()) // removes excess . segments return globalResolver.getBaseIRI().create(i); IRI base = iriFactory().create(baseStr); return base.create(i); }
static public String abbrevByBase(String uri, String base) { if ( hasScheme(uri) ) return uri ; IRI baseIRI = IRIResolver.iriFactory().construct(base) ; IRI rel = baseIRI.relativize(uri, relFlags) ; String r = rel.toString() ; return r ; }
static public String abbrevByBase(String uri, String base) { if ( base == null ) return null ; IRI baseIRI = IRIResolver.iriFactory().construct(base) ; IRI rel = baseIRI.relativize(uri, relFlags) ; String r = null ; try { r = rel.toASCIIString() ; } catch (MalformedURLException ex) { r = rel.toString() ; } return r ; } }
public Checker(ErrorHandler handler) { if ( handler == null ) handler = ErrorHandlerFactory.getDefaultErrorHandler() ; this.handler = handler ; checkLiterals = new CheckerLiterals(handler) ; checkURIs = new CheckerIRI(handler, IRIResolver.iriFactory()) ; checkBlankNodes = new CheckerBlankNodes(handler) ; checkVars = new CheckerVar(handler) ; }
@Test(expected=UnsupportedOperationException.class) public void other_11() { PrefixMap pmap = PrefixMapFactory.emptyPrefixMap() ; pmap.getMapping().put("ex", IRIResolver.iriFactory().construct("http://example/")) ; }
@Test(expected=UnsupportedOperationException.class) public void other_02() { PrefixMap pmap = PrefixMapFactory.create() ; pmap = PrefixMapFactory.unmodifiablePrefixMap(pmap) ; pmap.getMapping().put("ex", IRIResolver.iriFactory().construct("http://example/")) ; }
@Test public void test_param_string_append_iri_2() { // Test appending text ParameterizedSparqlString query = new ParameterizedSparqlString(); query.append("SELECT *"); query.append('\n'); query.append("WHERE { ?s "); query.appendIri(IRIResolver.iriFactory().construct("http://example.org")); query.append(" ?o }"); test(query, new String[] { "SELECT", "*", "\n", "WHERE", "?s", "<http://example.org>", "?o" }, new String[] {}); testAsQuery(query); }
arp.getOptions().setIRIFactory(IRIResolver.iriFactory());