/** * Load a resource into the associated triple store and commit. * * @param resource * A resource to be loaded (required). * @param baseURL * The baseURL to use for that resource (required). * @param rdfFormat * The {@link RDFFormat} to use as a fall back for the resource * (required). * * @return Statistics about the load. * * @throws IOException */ final public LoadStats loadData(final String resource, final String baseURL, final RDFFormat rdfFormat) throws IOException { if (resource == null) throw new IllegalArgumentException(); if (baseURL == null) throw new IllegalArgumentException(); if (rdfFormat == null) throw new IllegalArgumentException(); return loadData(// new String[] { resource }, // new String[] { baseURL },// new RDFFormat[] { rdfFormat }// ); }
/** * Load a resource into the associated triple store and commit. * * @param resource * A resource to be loaded (required). * @param baseURL * The baseURL to use for that resource (required). * @param rdfFormat * The {@link RDFFormat} to use as a fall back for the resource * (required). * * @return Statistics about the load. * * @throws IOException */ final public LoadStats loadData(final String resource, final String baseURL, final RDFFormat rdfFormat) throws IOException { if (resource == null) throw new IllegalArgumentException(); if (baseURL == null) throw new IllegalArgumentException(); if (rdfFormat == null) throw new IllegalArgumentException(); return loadData(// new String[] { resource }, // new String[] { baseURL },// new RDFFormat[] { rdfFormat }// ); }
/** * Simple test of ability to load a resource (from the classpath). */ public void test_DataLoader_loadResource01() throws IOException { final AbstractTripleStore store = getStore(); try { final DataLoader dataLoader = new DataLoader(store); final String resource = "com/bigdata/rdf/store/sample-data.ttl"; final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); } finally { store.__tearDownUnitTest(); } }
/** * Simple test of ability to load a resource (from the classpath). */ public void test_DataLoader_loadResource01() throws IOException { final AbstractTripleStore store = getStore(); try { final DataLoader dataLoader = new DataLoader(store); final String resource = "com/bigdata/rdf/store/sample-data.ttl"; final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); } finally { store.__tearDownUnitTest(); } }
/** * Test where an error in a source file SHOULD be ignored because we have * specified {@link DataLoader.Options#IGNORE_INVALID_FILES}. * * @see BLZG-1531 (Add option to make the DataLoader robust to files that * cause rio to throw a fatal exception) */ public void test_DataLoader_ignoreFailures02() throws IOException { final AbstractTripleStore store = getStore(); try { final Properties properties = new Properties(store.getProperties()); properties.setProperty(DataLoader.Options.IGNORE_INVALID_FILES, "true"); final DataLoader dataLoader = new DataLoader(properties, store); final String resource = "com/bigdata/rdf/store/sample-data-bad.ttl"; final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); } finally { store.__tearDownUnitTest(); } }
/** * Test where an error in a source file SHOULD be ignored because we have * specified {@link DataLoader.Options#IGNORE_INVALID_FILES}. * * @see BLZG-1531 (Add option to make the DataLoader robust to files that * cause rio to throw a fatal exception) */ public void test_DataLoader_ignoreFailures02() throws IOException { final AbstractTripleStore store = getStore(); try { final Properties properties = new Properties(store.getProperties()); properties.setProperty(DataLoader.Options.IGNORE_INVALID_FILES, "true"); final DataLoader dataLoader = new DataLoader(properties, store); final String resource = "com/bigdata/rdf/store/sample-data-bad.ttl"; final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); } finally { store.__tearDownUnitTest(); } }
dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE });
dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE });
/** * Test where an error in a source file SHOULD NOT be ignored because we * have NOT specified {@link DataLoader.Options#IGNORE_INVALID_FILES}. * * @see BLZG-1531 (Add option to make the DataLoader robust to files that * cause rio to throw a fatal exception) */ public void test_DataLoader_ignoreFailures01() throws IOException { boolean ok = false; final String resource = "com/bigdata/rdf/store/sample-data-bad.ttl"; final AbstractTripleStore store = getStore(); try { final DataLoader dataLoader = new DataLoader(store); final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); ok = true; } catch (Throwable t) { if (!InnerCause.isInnerCause(t, RDFParseException.class)) { fail("Expected inner cause " + RDFParseException.class + " not found in " + t, t); } } finally { store.__tearDownUnitTest(); } if (ok) fail("Error should have been reported for " + resource); }
/** * Test where an error in a source file SHOULD NOT be ignored because we * have NOT specified {@link DataLoader.Options#IGNORE_INVALID_FILES}. * * @see BLZG-1531 (Add option to make the DataLoader robust to files that * cause rio to throw a fatal exception) */ public void test_DataLoader_ignoreFailures01() throws IOException { boolean ok = false; final String resource = "com/bigdata/rdf/store/sample-data-bad.ttl"; final AbstractTripleStore store = getStore(); try { final DataLoader dataLoader = new DataLoader(store); final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); ok = true; } catch (Throwable t) { if (!InnerCause.isInnerCause(t, RDFParseException.class)) { fail("Expected inner cause " + RDFParseException.class + " not found in " + t, t); } } finally { store.__tearDownUnitTest(); } if (ok) fail("Error should have been reported for " + resource); }
/** * Simple test of ability to load a resource (from the classpath). */ public void test_DataLoader_loadResource01() throws IOException { final AbstractTripleStore store = getStore(); try { final DataLoader dataLoader = new DataLoader(store); final String resource = "com/bigdata/rdf/store/sample-data.ttl"; final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); } finally { store.__tearDownUnitTest(); } }
/** * Test where an error in a source file SHOULD be ignored because we have * specified {@link DataLoader.Options#IGNORE_INVALID_FILES}. * * @see BLZG-1531 (Add option to make the DataLoader robust to files that * cause rio to throw a fatal exception) */ public void test_DataLoader_ignoreFailures02() throws IOException { final AbstractTripleStore store = getStore(); try { final Properties properties = new Properties(store.getProperties()); properties.setProperty(DataLoader.Options.IGNORE_INVALID_FILES, "true"); final DataLoader dataLoader = new DataLoader(properties, store); final String resource = "com/bigdata/rdf/store/sample-data-bad.ttl"; final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); } finally { store.__tearDownUnitTest(); } }
dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE });
/** * Test where an error in a source file SHOULD NOT be ignored because we * have NOT specified {@link DataLoader.Options#IGNORE_INVALID_FILES}. * * @see BLZG-1531 (Add option to make the DataLoader robust to files that * cause rio to throw a fatal exception) */ public void test_DataLoader_ignoreFailures01() throws IOException { boolean ok = false; final String resource = "com/bigdata/rdf/store/sample-data-bad.ttl"; final AbstractTripleStore store = getStore(); try { final DataLoader dataLoader = new DataLoader(store); final String baseURL = new File(resource).toURI().toString(); dataLoader.loadData(new String[] { resource }, new String[] { baseURL }, new RDFFormat[] { RDFFormat.TURTLE }); ok = true; } catch (Throwable t) { if (!InnerCause.isInnerCause(t, RDFParseException.class)) { fail("Expected inner cause " + RDFParseException.class + " not found in " + t, t); } } finally { store.__tearDownUnitTest(); } if (ok) fail("Error should have been reported for " + resource); }
final LoadStats loadStats = dataLoader.loadData(new StringReader(