private OntModelSpec getRequiredOntModelSpecField( String name ) { OntModelSpec result = getOntModelSpecField( name ); if (result == null) throw new NotFoundException( name ); return result; }
public Object create(Resource type) { Object thing = null ; try { thing = AssemblerUtils.build(assemblerFile, type) ; } catch (ARQException ex) { throw ex; } catch (NotFoundException ex) { throw new CmdException("Not found: "+ex.getMessage()) ; } catch (JenaException ex) { throw ex ; } catch (Exception ex) { throw new CmdException("Error creating", ex) ; } return thing ; } }
/** Read a file and obtain an SSE item expression */ public static Item readFile(String filename, PrefixMapping pmap) { try { FileInputStream in = new FileInputStream(filename) ; long len = in.getChannel().size() ; if ( len == 0 ) return Item.nil ; return parse(in, pmap) ; } catch (FileNotFoundException ex) { throw new NotFoundException("Not found: "+filename) ; } catch (IOException ex) { throw new ARQException("IOExeption: "+filename, ex) ; } }
public Object create(Resource type) { Object thing = null ; try { thing = AssemblerUtils.build(assemblerFile, type) ; } catch (ARQException ex) { throw ex; } catch (NotFoundException ex) { throw new CmdException("Not found: "+ex.getMessage()) ; } catch (JenaException ex) { throw ex ; } catch (Exception ex) { throw new CmdException("Error creating", ex) ; } return thing ; } }
/** Slurp up a whole file: map filename as necessary */ public String readWholeFileAsUTF8(String filename) { InputStream in = open(filename) ; if ( in == null ) throw new NotFoundException("File not found: "+filename) ; return readWholeFileAsUTF8(in) ; }
@Override public Dataset createDataset() { if ( modAssembler.getAssemblerFile() == null ) return null ; try { dataset = (Dataset)modAssembler.create(DatasetAssemblerVocab.tDataset) ; if ( dataset == null ) throw new CmdException("No dataset description found in: "+modAssembler.getAssemblerFile()) ; } catch (CmdException ex) { throw ex ; } catch (ARQException ex) { throw ex; } catch (NotFoundException ex) { throw new CmdException("Not found: "+ex.getMessage()) ; } catch (JenaException ex) { throw ex ; } catch (Exception ex) { throw new CmdException("Error creating dataset", ex) ; } return dataset ; }
/** Read a file and obtain an SSE item expression */ public static Item readFile(String filename, PrefixMapping pmap) { FileInputStream in = null ; try { in = new FileInputStream(filename) ; long len = in.getChannel().size() ; if ( len == 0 ) return Item.nil ; return parse(in, pmap) ; } catch (FileNotFoundException ex) { throw new NotFoundException("Not found: "+filename) ; } catch (IOException ex) { throw new ARQException("IOExeption: "+filename, ex) ; } finally { IO.close(in) ; } }
@Override public Dataset createDataset() { if ( modAssembler.getAssemblerFile() == null ) return null ; try { dataset = (Dataset)modAssembler.create(DatasetAssemblerVocab.tDataset) ; if ( dataset == null ) throw new CmdException("No dataset description found in: "+modAssembler.getAssemblerFile()) ; } catch (CmdException ex) { throw ex ; } catch (ARQException ex) { throw ex; } catch (NotFoundException ex) { throw new CmdException("Not found: "+ex.getMessage()) ; } catch (JenaException ex) { throw ex ; } catch (Exception ex) { throw new CmdException("Error creating dataset", ex) ; } return dataset ; }
throw new NotFoundException("Not found: "+filenameOrURI) ;
/** * Load a result set from file or URL into a result set (memory backed). * * @param filenameOrURI * @param format * @return ResultSet */ public static ResultSet load(String filenameOrURI, ResultsFormat format) { if (format == null) format = ResultsFormat.guessSyntax(filenameOrURI); if (format == null) { Log.warn(ResultSet.class, "Null format - defaulting to XML"); format = ResultsFormat.FMT_RS_XML; } if (format.equals(ResultsFormat.FMT_TEXT)) { Log.fatal(ResultSet.class, "Can't read a text result set"); throw new ResultSetException("Can't read a text result set"); } InputStream in = FileManager.get().open(filenameOrURI); if (in == null) throw new NotFoundException("Not found: " + filenameOrURI); return load(in, format); }
/** Load a result set from file or URL into a result set (memory backed). * @param filenameOrURI * @param format * @return ResultSet */ public static ResultSet load(String filenameOrURI, ResultSetFormat format) { if ( format == null ) format = ResultSetFormat.guessSyntax(filenameOrURI) ; if ( format == null ) { Log.warn(ResultSet.class, "Null format - defaulting to XML") ; format = ResultSetFormat.syntaxXML ; } if ( format.equals(ResultSetFormat.syntaxText) ) { Log.fatal(ResultSet.class, "Can't read a text result set") ; throw new ResultSetException("Can't read a text result set") ; } InputStream in = FileManager.get().open(filenameOrURI) ; if ( in == null ) throw new NotFoundException("Not found: "+filenameOrURI) ; return load(in, format) ; }
private static Model readModel(String uri) { Graph g = Factory.createGraphMem(); // Use the mapped uri as the syntax hint. String syntax = null; { String altURI = FileManager.get().mapURI(uri); if (altURI != null) syntax = FileUtils.guessLang(uri); } // Temporary model wrapper Model m = ModelFactory.createModelForGraph(g); RDFReader r = m.getReader(syntax); InputStream in = FileManager.get().open(uri); if (in == null) // Not found. throw new NotFoundException("Not found: " + uri); r.read(m, in, uri); return m; }
throw new NotFoundException(url) ; String contentType = in.getContentType() ;
in = FileManager.get().open(filenameOrURI) ; if ( in == null ) throw new NotFoundException(filenameOrURI) ; catch (NotFoundException ex) { throw new NotFoundException("File not found: "+filenameOrURI) ; }
in = FileManager.get().open(filenameOrURI) ; if ( in == null ) throw new NotFoundException(filenameOrURI) ; catch (NotFoundException ex) { throw new NotFoundException("File not found: "+filenameOrURI) ; }
in = FileManager.get().open(filenameOrURI); if (in == null) throw new NotFoundException(filenameOrURI); } catch (NotFoundException ex) { throw new NotFoundException("File not found: " + filenameOrURI);
in = FileManager.get().open(filenameOrURI); if (in == null) throw new NotFoundException(filenameOrURI); } catch (NotFoundException ex) { throw new NotFoundException("File not found: " + filenameOrURI);