Skip to content

Commit

Permalink
Allow download nq again
Browse files Browse the repository at this point in the history
  • Loading branch information
hvarg committed Nov 20, 2024
1 parent 3bad0e5 commit 5125935
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<jersey.version>2.36</jersey.version>
<gson.version>2.6.2</gson.version>
<commons-configuration.version>1.10</commons-configuration.version>
<ontapi.version>1.3.4</ontapi.version>
<ontapi.version>1.3.8</ontapi.version>
<jbcrypt.version>0.3m</jbcrypt.version>
<java.version>1.8</java.version>
<httpclient.version>4.5.2</httpclient.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,34 +508,34 @@ public Response getOutputData(@JsonProperty("request") ExternalDataRequest r) {
return rBuild.build();
}

//@GET
//@Path("ontology.nq")
//@Override
//public Response getOntologyAll() {
// try {
// FileAndMeta all = this.repo.getOntologyAll();
// ResponseBuilder rBuild = Response.ok(all.data, all.contentType);
// return rBuild.build();
// } catch (Exception e) {
// try {
// // Create Json error response
// Gson gson = new Gson();
// ErrorMessage error = new ErrorMessage(e.getMessage());
// String jsonData = gson.toJson(error);

// // Prepare the response
// response.setContentType("application/json");
// response.setCharacterEncoding("utf-8");
// response.setStatus(500);

// // Send the response
// response.getWriter().print(jsonData.toString());
// response.getWriter().flush();
// } catch (IOException e1) {
// e1.printStackTrace();
// }
// }
// return null;
//}
@GET
@Path("ontology.nq")
@Override
public Response getOntologyAll() {
try {
FileAndMeta all = this.repo.getOntologyAll();
ResponseBuilder rBuild = Response.ok(all.data, all.contentType);
return rBuild.build();
} catch (Exception e) {
try {
// Create Json error response
Gson gson = new Gson();
ErrorMessage error = new ErrorMessage(e.getMessage());
String jsonData = gson.toJson(error);

// Prepare the response
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
response.setStatus(500);

// Send the response
response.getWriter().print(jsonData.toString());
response.getWriter().flush();
} catch (IOException e1) {
e1.printStackTrace();
}
}
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ public Entity getOrCreateEntity(String username) {
return this.diskDB.loadOrRegisterEntity(username);
}

/*public FileAndMeta getOntologyAll() {
public FileAndMeta getOntologyAll() {
this.rdf.startRead();
Dataset all = this.rdf.fac.getDataset();
ByteArrayOutputStream rawBytes = new ByteArrayOutputStream();
Expand All @@ -746,5 +746,5 @@ public Entity getOrCreateEntity(String username) {
FileAndMeta fileData = new FileAndMeta(bytes, "application/n-quads");
this.rdf.end();
return fileData;
}*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ public Response getOutputData(
@JsonProperty("request") ExternalDataRequest r);

// Download ontologies
//@GET
//@Path("ontology.nq")
//@Produces("application/rdf+xml")
//public Response getOntologyAll();
@GET
@Path("ontology.nq")
@Produces("application/rdf+xml")
public Response getOntologyAll();
}

0 comments on commit 5125935

Please sign in to comment.