use of org.sbpax.impl.HashGraph in project vcell by virtualcell.
the class ModelComparer method createDiff.
public static Graph createDiff(Graph model1, Graph model2) {
Graph graph = new HashGraph();
graph.addAll(model1);
graph.removeAll(model2);
return graph;
}
use of org.sbpax.impl.HashGraph 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;
}
use of org.sbpax.impl.HashGraph in project vcell by virtualcell.
the class UniProtRDFRequest method response.
public Response response() {
Response response = null;
try {
Graph model = new HashGraph();
// print out debug messsage to console -------- can be uncommented later.
// Debug.message(urlRDF());
URL url = new URL(urlRDF());
URLConnection connection = url.openConnection();
Map<String, String> nsMap = new HashMap<String, String>();
SesameRioUtil.readRDFFromStream(connection.getInputStream(), model, nsMap, RDFFormat.RDFXML, uri());
response = new ModelResponse(this, model);
} catch (Exception exception) {
response = new ExceptionResponse(this, exception);
}
return response;
}
use of org.sbpax.impl.HashGraph 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);
}
}
Aggregations