use of org.apache.jena.shared.DoesNotExistException in project jena by apache.
the class JenaReader method read.
/**
* 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);
}
}
Aggregations