Skip to content

Commit

Permalink
fix MarkLogic ttl upload through python and js interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Cuddihy committed Sep 6, 2023
1 parent c142a6e commit 7b04811
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -639,24 +639,31 @@ private JSONObject mlcp(File tempFile) throws Exception {

BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));

String line=null;
StringBuffer output = new StringBuffer();
while((line=input.readLine()) != null) {
output.append(line + "\n");
String stdoutLine=null;
StringBuffer stdout = new StringBuffer();
while((stdoutLine=input.readLine()) != null) {
stdout.append(stdoutLine + "\n");
}

int exitVal = pr.waitFor();

String outputStr = output.toString();
String stderrLine=null;
input = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
StringBuffer stderr = new StringBuffer();
while((stderrLine=input.readLine()) != null) {
stderr.append(stderrLine + "\n");
}

int exitVal = pr.waitFor();

String outputStr = stdout.toString();
String errStr = stderr.toString();
SimpleResultSet simple = new SimpleResultSet();
if (exitVal==0 && !outputStr.contains("FATAL") && !outputStr.contains("ERROR") ) {
if (errStr.isBlank() ) {
simple.setSuccess(true);
simple.setMessage(outputStr);
simple.setMessage(stdoutLine); // last line of stdout
} else {
simple.setSuccess(false);
simple.setMessage("MLCP ingestion failed");
simple.addRationaleMessage("MarkLogicSparqlEndpoint.mlcp()", outputStr);
simple.addRationaleMessage("MarkLogicSparqlEndpoint.mlcp()", errStr);
}

return simple.toJson();
Expand Down
4 changes: 2 additions & 2 deletions sparqlGraphWeb/sparqlGraph/js/msiclientquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ define([ // properly require.config'ed bootstrap-modal
this.data.serverAndPort = ssinterface.serverURL;
this.data.serverType = ssinterface.serverType;
this.data.graph = ssinterface.graph;
this.data.user = "dba";
this.data.password = "dba";
this.data.user = "";
this.data.password = "";

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,11 @@ private JSONObject uploadFile(String endpointName,
// 1. provided user/password
// 2. properties file
// 3. fake one
String nonEmptyUser = (user==null || user.isBlank()) ? query_props.getUser() : user;
String nonEmptyUser = (user==null || user.isBlank()) ? query_props.getUser() : user;
String nonEmptyPassword = (password==null || password.isBlank()) ? query_props.getPassword() : password;
nonEmptyUser = (user==null || user.isBlank()) ? "nonempty-user" : user;
nonEmptyPassword = (password==null || password.isBlank()) ? "nonempty-password" : password;

nonEmptyUser = (nonEmptyUser==null || nonEmptyUser.isBlank()) ? "nonempty-user" : nonEmptyUser;
nonEmptyPassword = (nonEmptyPassword==null || nonEmptyPassword.isBlank()) ? "nonempty-password" : nonEmptyPassword;

sei = SparqlEndpointInterface.getInstance(serverType, serverAndPort, graph, nonEmptyUser, nonEmptyPassword);

Expand Down

0 comments on commit 7b04811

Please sign in to comment.