Skip to content

Commit

Permalink
make ingestion warnings accessible through more client functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Cuddihy committed Oct 14, 2022
1 parent af7f196 commit 0305124
Showing 1 changed file with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1835,17 +1835,21 @@ private String executeToJobIdSaveWarnings() throws ConnectException, EndpointNot
SimpleResultSet ret = SimpleResultSet.fromJson((JSONObject)super.execute());
ret.throwExceptionIfUnsuccessful("Ingestion error");

this.saveWarnings(ret);

return ret.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
}

private void saveWarnings(SimpleResultSet res) {
this.warnings = null;
try {
// check for warnings
this.warnings = null;
JSONArray jArr = ret.getResultJSONArray(SimpleResultSet.WARNINGS_RESULT_KEY);

JSONArray jArr = res.getResultJSONArray(SimpleResultSet.WARNINGS_RESULT_KEY);
this.warnings = new ArrayList<String>();
this.warnings.addAll(jArr);
} catch (Exception e) {
// leave warnings null
}

return ret.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
}

public JSONObject execGetClassTemplateAndCsv(String classUri, String idRegex, String sparqlConnection) throws ConnectException, EndpointNotFoundException, Exception{
Expand Down Expand Up @@ -1921,9 +1925,10 @@ public String execIngestFromCsvStringsByIdAsync(String nodegroupId, String csvCo

try{
JSONObject jobj = (JSONObject) this.execute();
SimpleResultSet retval = SimpleResultSet.fromJson(jobj);
retval.throwExceptionIfUnsuccessful();
return retval.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
SimpleResultSet res = SimpleResultSet.fromJson(jobj);
this.saveWarnings(res);
res.throwExceptionIfUnsuccessful();
return res.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
}
finally{
this.reset();
Expand All @@ -1947,9 +1952,10 @@ public String execIngestFromCsvStringsAsync(SparqlGraphJson sgjsonWithOverride,

try{
JSONObject jobj = (JSONObject) this.execute();
SimpleResultSet retval = SimpleResultSet.fromJson(jobj);
retval.throwExceptionIfUnsuccessful();
return retval.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
SimpleResultSet res = SimpleResultSet.fromJson(jobj);
this.saveWarnings(res);
res.throwExceptionIfUnsuccessful();
return res.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
}
finally{
this.reset();
Expand All @@ -1971,9 +1977,10 @@ public String execIngestFromCsvStringsAsync(SparqlGraphJson sgjsonWithOverride,

try{
JSONObject jobj = (JSONObject) this.execute();
SimpleResultSet retval = SimpleResultSet.fromJson(jobj);
retval.throwExceptionIfUnsuccessful();
return retval.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
SimpleResultSet res = SimpleResultSet.fromJson(jobj);
this.saveWarnings(res);
res.throwExceptionIfUnsuccessful();
return res.getResult(SimpleResultSet.JOB_ID_RESULT_KEY);
}
finally{
this.reset();
Expand Down

0 comments on commit 0305124

Please sign in to comment.