Skip to content

Commit

Permalink
log empty model
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandra Mierz committed Jun 21, 2021
1 parent 631ce49 commit e152b4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/main/java/eu/tib/service/ResponseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ public ResponseEntity<String> buildResponse(String queryName, Map<String, String
Model result = pipeline.run(queryName, input);
log.info("Finished pipeline for " + queryName);

if (result.isEmpty()) log.info("No data was generated.");

if (vivoProperties.isValid()) {
log.info("Found VIVO properties");
vivoExport.exportData(result, vivoProperties);
String status = String.format("{\"status\":\"%s\"}", "SPARQL update accepted.");
return ResponseEntity.status(HttpStatus.OK).body(status);

String msg = (result.isEmpty()) ? "No data was generated." : "SPARQL update accepted.";
String statusJSON = String.format("{\"status\":\"%s\"}", msg);
return ResponseEntity.status(HttpStatus.OK).body(statusJSON);
} else {
log.info("Returning JSON-LD");
StringWriter stringWriter = new StringWriter();
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/eu/tib/storage/VIVOExport.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ public class VIVOExport {
private static final int CHUNK_SIZE = 2500; // triples per 'chunk'

public void exportData(Model data, VIVOProperties vivo) {
if (data.isEmpty()) {
log.info("No data was generated, Model is empty.");
} else {
exportInChunks(data, vivo);
}
if (!data.isEmpty()) exportInChunks(data, vivo);
}

/**
Expand Down

0 comments on commit e152b4e

Please sign in to comment.