/** * {@inheritDoc} */ @Override protected void parseFile(final String file) { _manager.readModel(_model, file, _inputFormat); }
/** * {@inheritDoc} */ @Override protected void parseFile(final String file) { _manager.readModel(_model, file, _inputFormat); }
/** * {@inheritDoc} */ @Override protected void parseFile(final String file) { _manager.readModel(_model, file, _inputFormat); }
/** * Read a file of RDF into a model. Guesses the syntax of the file based on filename extension, * defaulting to RDF/XML. * @param model * @param filenameOrURI * @return The model or null, if there was an error. * @exception JenaException if there is syntax error in file. */ public Model readModel(Model model, String filenameOrURI) { if ( log.isDebugEnabled() ) log.debug("readModel(model,"+filenameOrURI+")") ; return readModel(model, filenameOrURI, null); }
private void initData(Model model) { if ( loadFiles != null ) { for ( String s : loadFiles ) FileManager.get().readModel(model, s) ; } loadFiles = null ; }
public static void load(Store store, String filename) { Model model = SDBFactory.connectDefaultModel(store) ; FileManager.get().readModel(model, filename) ; }
public static void load(Store store, String graphIRI, String filename) { Model model = SDBFactory.connectNamedModel(store, graphIRI) ; FileManager.get().readModel(model, filename) ; }
private static void load(Model model, String file) { FileManager.get().readModel(model, file) ; }
@Override public Model readModel(Model model, String uri) { String mappedURI = mapURI(uri); if (mappedURI.startsWith("http") || mappedURI.startsWith("https")) return model.add(LinkedDataClient.create(getEndpoint(URI.create(uri)), getMediaTypes()).get()); return super.readModel(model, uri); }
private static void load(Model model, String fn) { FileManager.get().readModel(model, fn) ; }
private static void load(Model model, String fn) { FileManager.get().readModel(model, fn) ; }
private static void load(Model model, String fn) { FileManager.get().readModel(model, fn) ; }
private void execPut(StoreConfig conf, String tag, List<String> positionalArgs) { if ( positionalArgs.size() == 0 ) throw new CmdException("No file to load") ; Model model = conf.getModel(tag) ; if ( model == null ) model = ModelFactory.createDefaultModel() ; for ( String filename : positionalArgs) FileManager.get().readModel(model, filename) ; conf.setModel(tag, model) ; }
/** Identify the URL that is to be read in and translated to a vocabulary file, and load the source into the source model */ protected void selectInput() { if (!m_options.hasInputOption()) { usage(); } String input = SchemagenUtils.urlCheck( m_options.getInputOption().getURI() ); String syntax = m_options.getEncodingOption(); try { FileManager.get().readModel( m_source, input, syntax ); } catch (JenaException e) { abort( "Failed to read input source " + input, e ); } }
@Test(expected = NotFoundException.class) public void testFileManagerNoFile2() { FileManager fileManager = new FileManager() ; fileManager.addLocatorFile() ; fileManager.readModel(ModelFactory.createDefaultModel(), filenameNonExistent); }
/** Identify the URL that is to be read in and translated to a vocabulary file, and load the source into the source model */ protected void selectInput() { if (!m_options.hasInputOption()) { usage(); } String input = SchemagenUtils.urlCheck( m_options.getInputOption().getURI() ); String syntax = m_options.getEncodingOption(); try { FileManager.get().readModel( m_source, input, syntax ); } catch (JenaException e) { abort( "Failed to read input source " + input, e ); } }
private static void loadGraph(Graph graph, ItemList list) { BuilderLib.checkLength(2, list, Tags.tagLoad); Item item = list.get(1); if ( !item.isNode() ) BuilderLib.broken(item, "Expected: ("+Tags.tagLoad+" 'filename')"); String s = NodeUtils.stringLiteral(item.getNode()); if ( s == null ) BuilderLib.broken(item, "Expected: ("+Tags.tagLoad+" 'filename')"); Model model = ModelFactory.createModelForGraph(graph); FileManager.get().readModel(model, s); }
@Override protected void ontTest( OntModel m ) { OntModel m0 = ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF, null ); FileManager.get().readModel( m0, "file:testing/ontology/testImport9/a.ttl" ); OntProperty p0 = m0.getOntProperty( "http://incubator.apache.org/jena/2011/10/testont/b#propB" ); TestUtil.assertIteratorLength( p0.listDomain(), 3 ); // repeat test - thus using previously cached model for import OntModel m1 = ModelFactory.createOntologyModel( OntModelSpec.OWL_DL_MEM_RULE_INF, null ); FileManager.get().readModel( m1, "file:testing/ontology/testImport9/a.ttl" ); OntProperty p1 = m1.getOntProperty( "http://incubator.apache.org/jena/2011/10/testont/b#propB" ); TestUtil.assertIteratorLength( p1.listDomain(), 3 ); } }
@Test(expected = NotFoundException.class) public void testFileManagerNoFile3() { FileManager fileManager = new AdapterFileManager(new StreamManager(), new org.apache.jena.riot.system.stream.LocationMapper()) ; fileManager.addLocatorFile() ; fileManager.readModel(ModelFactory.createDefaultModel(), filenameNonExistent); }
@Test public void testFileManagerReadOntModel() { OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM) ; FileManager.get().readModel(model, testingDir+"/data.ttl") ; // Check Individual ind = model.getIndividual("http://example.com/individual") ; String t = ind.getOntClass().getURI() ; assertEquals("http://example.com/T", t) ; long c1 = model.size() ; model.loadImports(); long c2 = model.size() ; assertEquals(c1,c2) ; }