/** * Reads from reader, using base URI xmlbase, adding triples to model. If * xmlbase is "" then relative URIs may be added to model. * * @param m * A model to add triples to. * @param reader * The RDF/XML document. * @param xmlBase * The base URI of the document or "". */ @Override public void read(final Model m, Reader reader, String xmlBase) throws JenaException { read(m, new InputSource(reader), xmlBase); }
/** * Reads from inputStream, using base URI xmlbase, adding triples to graph. * If xmlbase is "" then relative URIs may be added to graph. * * @param g * A graph to add triples to. * @param in * The RDF/XML document stream. * @param xmlBase * The base URI of the document or "". */ public void read(Graph g, InputStream in, String xmlBase) { read(g, new InputSource(in), xmlBase, null); }
/** * Reads from inputStream, using base URI xmlbase, adding triples to graph. * If xmlbase is "" then relative URIs may be added to graph. * * @param g * A graph to add triples to. * @param in * The RDF/XML document stream. * @param xmlBase * The base URI of the document or "". */ public void read(Graph g, InputStream in, String xmlBase) { read(g, new InputSource(in), xmlBase, null); }
/** * Reads from reader, using base URI xmlbase, adding triples to graph. If * xmlbase is "" then relative URIs may be added to graph. * * @param g * A graph to add triples to. * @param reader * The RDF/XML document. * @param xmlBase * The base URI of the document or "". */ public void read(Graph g, Reader reader, String xmlBase) throws JenaException { read(g, new InputSource(reader), xmlBase, null); }
/** * Reads from inputStream, using base URI xmlbase, adding triples to model. * If xmlbase is "" then relative URIs may be added to model. * * @param m * A model to add triples to. * @param in * The RDF/XML document stream. * @param xmlBase * The base URI of the document or "". */ @Override public void read(final Model m, InputStream in, String xmlBase) throws JenaException { read(m, new InputSource(in), xmlBase); }
/** * Reads from reader, using base URI xmlbase, adding triples to graph. If * xmlbase is "" then relative URIs may be added to graph. * * @param g * A graph to add triples to. * @param reader * The RDF/XML document. * @param xmlBase * The base URI of the document or "". */ public void read(Graph g, Reader reader, String xmlBase) throws JenaException { read(g, new InputSource(reader), xmlBase, null); }
/** * Reads from inputStream, using base URI xmlbase, adding triples to model. * If xmlbase is "" then relative URIs may be added to model. * * @param m * A model to add triples to. * @param in * The RDF/XML document stream. * @param xmlBase * The base URI of the document or "". */ @Override public void read(final Model m, InputStream in, String xmlBase) throws JenaException { read(m, new InputSource(in), xmlBase); }
/** * Reads from reader, using base URI xmlbase, adding triples to model. If * xmlbase is "" then relative URIs may be added to model. * * @param m * A model to add triples to. * @param reader * The RDF/XML document. * @param xmlBase * The base URI of the document or "". */ @Override public void read(final Model m, Reader reader, String xmlBase) throws JenaException { read(m, new InputSource(reader), xmlBase); }
/** * Reads from reader, using base URI xmlbase, adding triples to model. If * xmlbase is "" then relative URIs may be added to model. * * @param m * A model to add triples to. * @param reader * The RDF/XML document. * @param xmlBase * The base URI of the document or "". */ private void read(Model m, InputSource inputS, String xmlBase) throws JenaException { model = m; read(model.getGraph(), inputS, xmlBase, model); }
/** * Reads from reader, using base URI xmlbase, adding triples to model. If * xmlbase is "" then relative URIs may be added to model. * * @param m * A model to add triples to. * @param reader * The RDF/XML document. * @param xmlBase * The base URI of the document or "". */ private void read(Model m, InputSource inputS, String xmlBase) throws JenaException { model = m; read(model.getGraph(), inputS, xmlBase, model); }
/** * Reads from url, using url as base, adding triples to model. * Uses content negotiation to ask for application/rdf+xml, if available. * * @param m * A model to add triples to. * @param url * The URL of the RDF/XML document. */ @Override public void read(Model m, String url) throws JenaException { try { URLConnection conn = new URL(url).openConnection(); conn.setRequestProperty("accept", "application/rdf+xml, application/xml; q=0.8, text/xml; q=0.7, application/rss+xml; q=0.3, */*; q=0.2"); String encoding = conn.getContentEncoding(); if (encoding == null) read(m, conn.getInputStream(), url); else read(m, new InputStreamReader(conn.getInputStream(), encoding), url); } catch (FileNotFoundException e) { throw new DoesNotExistException(url); } catch (IOException e) { throw new JenaException(e); } }
/** * Reads from url, using url as base, adding triples to model. * Uses content negotiation to ask for application/rdf+xml, if available. * * @param m * A model to add triples to. * @param url * The URL of the RDF/XML document. */ @Override public void read(Model m, String url) throws JenaException { try { URLConnection conn = new URL(url).openConnection(); conn.setRequestProperty("accept", "application/rdf+xml, application/xml; q=0.8, text/xml; q=0.7, application/rss+xml; q=0.3, */*; q=0.2"); String encoding = conn.getContentEncoding(); if (encoding == null) read(m, conn.getInputStream(), url); else read(m, new InputStreamReader(conn.getInputStream(), encoding), url); } catch (FileNotFoundException e) { throw new DoesNotExistException(url); } catch (IOException e) { throw new JenaException(e); } }
Model loadRDF(InFactoryX in, RDFErrorHandler eh, String base) throws IOException { Model model = ModelFactory.createDefaultModel(); JenaReader jr = new JenaReader(); if (eh != null) jr.setErrorHandler(eh); jr.setProperty("error-mode", "strict"); if ( base.contains( "/xmlns/" ) || base.contains( "/comments/" ) ) jr.setProperty("embedding","true"); try ( InputStream inx = in.open() ) { jr.read(model, inx, base); } return model; }
Model loadRDF(InFactoryX in, RDFErrorHandler eh, String base) throws IOException { Model model = ModelFactory.createDefaultModel(); JenaReader jr = new JenaReader(); if (eh != null) jr.setErrorHandler(eh); jr.setProperty("error-mode", "strict"); if ( base.contains( "/xmlns/" ) || base.contains( "/comments/" ) ) jr.setProperty("embedding","true"); try ( InputStream inx = in.open() ) { jr.read(model, inx, base); } return model; }