@Override public void add(String prefix, String iriString) { prefix = canonicalPrefix(prefix); IRI iri = IRIFactory.iriImplementation().create(iriString); prefixes.put(prefix, iri); uriToPrefix.put(iriString, prefix) ; }
/** * Asserts that a resource identifier is a valid internationalized resource * identifier (IRI). An IRI is a sequence of characters from the Universal * Character Set (Unicode/ISO 10646). * * @param id * A String representing a resource identifier. * * @see <a href="http://tools.ietf.org/html/rfc3987" target="_blank">RFC * 3987: Internationalized Resource Identifiers (IRIs)</a> */ void assertValidIRI(String id) { try { @SuppressWarnings("unused") IRI iri = IRIFactory.iriImplementation().construct(id); } catch (IRIException e) { throw new AssertionError("Not a valid IRI reference:" + id); } } }
@Override public void add(String prefix, String iriString) { this.add(prefix, IRIFactory.iriImplementation().create(iriString)); }
static public void main(String args[]) throws IOException { LineNumberReader in = new LineNumberReader(new InputStreamReader( System.in)); IRIImpl last = null; DEBUG = true; IRIFactory factory = IRIFactory.iriImplementation(); while (true) { String s = in.readLine().trim(); if (s.equals("quit")) return; IRIImpl iri = (IRIImpl) factory.create(s); show(iri); if (last != null) { IRI r = last.create(iri); System.out.println("Resolved: " + r.toString()); show(r); } last = iri; } }
/** * Asserts that a resource identifier is a valid internationalized resource * identifier (IRI). An IRI is a sequence of characters from the Universal * Character Set (Unicode/ISO 10646). * * @param id * A String representing a resource identifier. * * @see <a href="http://tools.ietf.org/html/rfc3987" target="_blank">RFC * 3987: Internationalized Resource Identifiers (IRIs)</a> */ public static void assertValidIRI(String id) { try { @SuppressWarnings("unused") IRI iri = IRIFactory.iriImplementation().construct(id); } catch (IRIException e) { throw new AssertionError(ErrorMessage.format( ErrorMessageKeys.INVALID_IRI, id)); } }
static public void main(String args[]) throws IOException { LineNumberReader in = new LineNumberReader(new InputStreamReader( System.in)); IRIImpl last = null; DEBUG = true; IRIFactory factory = IRIFactory.iriImplementation(); while (true) { String s = in.readLine().trim(); if (s.equals("quit")) return; IRIImpl iri = (IRIImpl) factory.create(s); show(iri); if (last != null) { IRI r = last.create(iri); System.out.println("Resolved: " + r.toString()); show(r); } last = iri; } }
static public void main(String args[]) throws IOException { LineNumberReader in = new LineNumberReader(new InputStreamReader( System.in)); IRIImpl last = null; DEBUG = true; IRIFactory factory = IRIFactory.iriImplementation(); while (true) { String s = in.readLine().trim(); if (s.equals("quit")) return; IRIImpl iri = (IRIImpl) factory.create(s); show(iri); if (last != null) { IRI r = last.create(iri); System.out.println("Resolved: " + r.toString()); show(r); } last = iri; } }
public static void main(String[] args) { IRIFactory iriFactory = IRIFactory.iriImplementation() ; iriFactory = IRIResolver.iriFactory ; boolean first = true ; for ( String iriStr : args ) { 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()) ; } } }
else if ( v.equals("IRI") ) { options.setIRIFactory(IRIFactory.iriImplementation()) ; } else if ( v.equals("LAX") ) { options.setIRIFactory(IRIFactory.jenaImplementation()) ; } else
else if ( v.equals("IRI") ) { options.setIRIFactory(IRIFactory.iriImplementation()) ; } else if ( v.equals("LAX") ) { options.setIRIFactory(IRIFactory.jenaImplementation()) ; } else
else if ( v.equals("IRI") ) { options.setIRIFactory(IRIFactory.iriImplementation()) ; } else if ( v.equals("LAX") ) { options.setIRIFactory(IRIFactory.jenaImplementation()) ; } else
Test(Resource r) { super( WGTestSuite .this .testDir .relativize(IRIFactory.iriImplementation().create(r.getURI()), IRI.CHILD) .toString()); testID = r; } String create(Property p) {
Test(Resource r) { super( WGTestSuite .this .testDir .relativize(IRIFactory.iriImplementation().create(r.getURI()), IRI.CHILD) .toString()); testID = r; } String create(Property p) {
public void testIRIRules_2() { Model model = ModelFactory.createDefaultModel() ; IRIFactory f = ARPOptions.getIRIFactoryGlobal() ; try { ARPOptions.setIRIFactoryGlobal(IRIFactory.iriImplementation()) ; RDFReader r = model.getReader("RDF/XML") ; expected = new int[] { WARN_MALFORMED_URI , WARN_MALFORMED_URI }; r.setErrorHandler(this); r.read(model, new StringReader(RDF_TEXT), "http://example/") ; } finally { ARPOptions.setIRIFactoryGlobal(f) ; } checkExpected() ; }
public void testIRIRules_2() { Model model = ModelFactory.createDefaultModel() ; IRIFactory f = ARPOptions.getIRIFactoryGlobal() ; try { ARPOptions.setIRIFactoryGlobal(IRIFactory.iriImplementation()) ; RDFReader r = model.getReader("RDF/XML") ; expected = new int[] { WARN_MALFORMED_URI , WARN_MALFORMED_URI }; r.setErrorHandler(this); r.read(model, new StringReader(RDF_TEXT), "http://example/") ; } finally { ARPOptions.setIRIFactoryGlobal(f) ; } checkExpected() ; }
public TurtleParserBase() { /* **** temporary **** */ setPrologue(new Prologue()); IRIFactory iriFactory = new IRIFactory(IRIFactory.iriImplementation()); // // These two are from IRIFactory.iriImplementation() ... // iriFactory.useSpecificationIRI(true); // iriFactory.useSchemeSpecificRules("*", true); // // // Allow relative references for file: URLs. // iriFactory.setSameSchemeRelativeReferences("file"); // // DOUBLE_WHITESPACE is misnamed - it applies to last character being a space as well (IRI bug?) //setErrorWarning(iriFactory, ViolationCodes.DOUBLE_WHITESPACE, true, true); setErrorWarning(iriFactory, ViolationCodes.UNWISE_CHARACTER, true, true); setErrorWarning(iriFactory, ViolationCodes.WHITESPACE, true, true); setErrorWarning(iriFactory, ViolationCodes.UNREGISTERED_IANA_SCHEME, false, false); setErrorWarning(iriFactory, ViolationCodes.UNDEFINED_UNICODE_CHARACTER, false, false); IRI iri = iriFactory.create(IRIResolver.chooseBaseURI()); IRIResolver resolver = IRIResolver.create(iri); getPrologue().setResolver(IRIResolver.create(iri)); }
/** * Tests that the various set methods of {@link JenaPreparedStatement} * function correctly * * @throws SQLException */ @Test public void prepared_statement_setters_15() throws SQLException { JenaConnection conn = this.getConnection(); JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }"); stmt.setObject(1, IRIFactory.iriImplementation().create("http://example.org"), Types.NVARCHAR); ParameterizedSparqlString pss = stmt.getParameterizedString(); Assert.assertTrue(pss.toString().contains("\"http://example.org\"")); stmt.close(); conn.close(); }
/** * Tests that the various set methods of {@link JenaPreparedStatement} * function correctly * * @throws SQLException */ @Test public void prepared_statement_setters_14() throws SQLException { JenaConnection conn = this.getConnection(); JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }"); stmt.setObject(1, IRIFactory.iriImplementation().create("http://example.org")); ParameterizedSparqlString pss = stmt.getParameterizedString(); Assert.assertTrue(pss.toString().contains("<http://example.org>")); stmt.close(); conn.close(); }
/** * Tests that the various set methods of {@link JenaPreparedStatement} * function correctly * * @throws SQLException */ @Test public void prepared_statement_setters_16() throws SQLException { JenaConnection conn = this.getConnection(); JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }"); stmt.setObject(1, IRIFactory.iriImplementation().create("http://example.org"), Types.JAVA_OBJECT); ParameterizedSparqlString pss = stmt.getParameterizedString(); Assert.assertTrue(pss.toString().contains("<http://example.org>")); stmt.close(); conn.close(); }
new InputStreamFactoryTests( IRIFactory .iriImplementation() .create( "http://www.w3.org/2000/10/rdf-tests/rdfcore/"), new InputStreamFactoryTests(IRIFactory.iriImplementation().create("http://jcarroll.hpl.hp.com/arp-tests/"), "arp"), "ARP Tests", false) ; new InputStreamFactoryTests( IRIFactory .iriImplementation() .create( "http://www.w3.org/2000/10/rdf-tests/rdfcore/"),