public static LoadException create(Exception e){ return new LoadException(e); }
private Document parsing(InputSource stream) throws LoadException { DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance(); fac.setNamespaceAware(true); DocumentBuilder builder; try { builder = fac.newDocumentBuilder(); Document doc = builder.parse(stream); return doc; } catch (ParserConfigurationException e) { throw LoadException.create(e); } catch (SAXException e) { throw LoadException.create(e); } catch (IOException e) { throw LoadException.create(e); } }
@Override public String toString(){ if (ex == null) return super.toString(); String str = ex.getClass().getName() + " "; if (ex.getMessage()!=null){ str += ex.getMessage(); } else { str += ex.toString(); } if (getObject() != null){ str += "\n" + getObject(); } if (getPath() != null) { str += "\n" + getPath(); } else { str += "\n" + "unknown location"; } return str; }
public static LoadException create(Exception e, String p){ LoadException ee = new LoadException(e); ee.setPath(p); return ee; }
public void loadRule(String fichier) { try { myCorese.load(fichier); appendMsg(myCapturer.getContent() + "\ndone.\n\n"); } catch (EngineException e) { appendMsg(e.toString()); e.printStackTrace(); } catch (LoadException e) { appendMsg(e.toString()); e.printStackTrace(); } }
public void load(InputStream rdf, String source) throws EngineException { try { loader().load(rdf, source); } catch (LoadException e) { throw new EngineException(e.toString()); } }
/** * Corese format */ public void loadCorese(String file) { Document doc; try { doc = parsing(file); NodeList list = doc.getElementsByTagNameNS(COS, RULE); loadCorese(list); } catch (LoadException e) { e.printStackTrace(); } }
public String readWE(String name) throws LoadException { String query = "", str = ""; Reader fr; try { if (isURL(name)) { URL url = new URL(name); fr = new InputStreamReader(url.openStream()); } else { fr = new FileReader(name); } query = read(fr); } catch (IOException ex) { throw LoadException.create(ex).setPath(name); } if (query == "") { return null; } return query; }
public LoadException(Exception ee){ this.set(ee); }
String getFormatURI(String uri){ if (uri.startsWith(NSManager.STL_FORMAT)){ try { return readResource(uri, NSManager.STL_FORMAT, FORMAT_LIB); } catch (LoadException ex) { } } QueryLoad ql = QueryLoad.create(); try { return ql.readWE(uri); } catch (LoadException ex) { logger.warn(ex.getMessage()); } return ""; }
&& e.getException() != null && e.getException().getMessage().contains("{E301}")) { try {
public void loadRDF(String fichier) { try { myCorese.load(fichier); appendMsg(myCapturer.getContent() + "\ndone.\n\n"); } catch (EngineException e) { appendMsg(e.toString()); e.printStackTrace(); } catch (LoadException e) { appendMsg(e.toString()); e.printStackTrace(); } }
void loadWF(String path, boolean run) { WorkflowParser parser = new WorkflowParser(); try { parser.parse(path); SemanticWorkflow wp = parser.getWorkflowProcess(); defQuery(wp, run); } catch (LoadException ex) { LOGGER.error(ex); appendMsg(ex.toString()); } }
Object load2(Producer p, Expr exp, Environment env, IDatatype dt, IDatatype undef_format) { Graph g = Graph.create(); Load ld = Load.create(g); try { if (PluginImpl.readWriteAuthorized){ ld.parse(dt.getLabel(), (undef_format == null) ? Load.TURTLE_FORMAT : Load.UNDEF_FORMAT); } } catch (LoadException ex) { logger.error("Load error: " + dt); logger.error(ex); ex.printStackTrace(); } IDatatype res = create("load", g, IDatatype.GRAPH); return res; }
public static LoadException create(Exception e, Object o, String p){ LoadException ee = new LoadException(e, o); ee.setPath(p); return ee; }
public void load(String fichier) { controler(LOAD); try { myCorese.load(fichier); appendMsg(myCapturer.getContent()); } catch (EngineException e) { appendMsg(e.toString()); e.printStackTrace(); } catch (LoadException e) { appendMsg(e.toString()); e.printStackTrace(); } }
void execWF(String path) { reset(); WorkflowParser parser = new WorkflowParser(); // parser.setDebug(true); try { Date d1 = new Date(); parser.parse(path); SemanticWorkflow wp = parser.getWorkflowProcess(); // wp.setDebug(true); Data res = wp.process(new Data(myCorese.getGraph())); Date d2 = new Date(); System.out.println("time: " + (d2.getTime() - d1.getTime()) / (1000.0)); appendMsg(res.toString() + "\n"); appendMsg("time: " + (d2.getTime() - d1.getTime()) / (1000.0) + "\n"); } catch (LoadException ex) { LOGGER.error(ex); appendMsg(ex.toString()); } catch (EngineException ex) { LOGGER.error(ex); appendMsg(ex.toString()); } }
IDatatype load(Producer p, Expr exp, Environment env, IDatatype dt, IDatatype format) { Graph g = Graph.create(); Load ld = Load.create(g); try { if (PluginImpl.readWriteAuthorized){ ld.parse(dt.getLabel(), (format == null) ? Load.UNDEF_FORMAT : LoadFormat.getDTFormat(format.getLabel())); } } catch (LoadException ex) { logger.error("Load error: " + dt); logger.error(ex); ex.printStackTrace(); } IDatatype res = DatatypeMap.createObject(g); return res; }