use of org.vcell.sybil.util.http.pathwaycommons.PCExceptionResponse in project vcell by virtualcell.
the class PCIDRequest method response.
@Override
public PathwayCommonsResponse response() {
try {
URL url = url();
URLConnection connection = url.openConnection();
String text = StringUtil.textFromInputStream(connection.getInputStream());
Graph graph = new HashGraph();
Map<String, String> nsMap = new HashMap<String, String>();
SesameRioUtil.readRDFFromString(text, graph, nsMap, RDFFormat.RDFXML, uriBase);
try {
return new PCTextModelResponse(this, text, graph);
} catch (Throwable t) {
return new PCTextResponse(this, text);
}
} catch (MalformedURLException e) {
return new PCExceptionResponse(this, e);
} catch (IOException e) {
return new PCExceptionResponse(this, e);
} catch (RDFParseException e) {
return new PCExceptionResponse(this, e);
} catch (RDFHandlerException e) {
return new PCExceptionResponse(this, e);
}
}
use of org.vcell.sybil.util.http.pathwaycommons.PCExceptionResponse in project vcell by virtualcell.
the class PCNeighborsRequest method response.
@Override
public PathwayCommonsResponse response() {
PathwayCommonsResponse response = null;
try {
URL url = url();
URLConnection connection = url.openConnection();
String text = StringUtil.textFromInputStream(connection.getInputStream());
if (PathwayCommonsUtil.isErrorResponse(text)) {
response = new PCErrorResponse(this, PCErrorResponse.errorElement(text));
} else {
try {
Graph graph = new HashGraph();
Map<String, String> nsMap = new HashMap<String, String>();
SesameRioUtil.readRDFFromString(text, graph, nsMap, RDFFormat.RDFXML, uriBase);
response = new PCTextModelResponse(this, text, graph);
} catch (Throwable t) {
response = new PCTextResponse(this, text);
}
}
} catch (MalformedURLException e) {
response = new PCExceptionResponse(this, e);
} catch (IOException e) {
response = new PCExceptionResponse(this, e);
} catch (SAXException e) {
response = new PCExceptionResponse(this, e);
} catch (ParserConfigurationException e) {
response = new PCExceptionResponse(this, e);
}
return response;
}
Aggregations