NIHVIVO-2489
The functionality for ASK query is added to the SparqlQueryServlet. The output is a boolean true/false. ASK query returns a boolean based on if the pattern in the query exists in the model or not.
This commit is contained in:
parent
a26824b46e
commit
619aa66c67
1 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.controller;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
|
@ -239,6 +240,12 @@ public class SparqlQueryServlet extends BaseEditController {
|
|||
resultModel = qe.execConstruct();
|
||||
}else if ( query.isDescribeType() ){
|
||||
resultModel = qe.execDescribe();
|
||||
}else if(query.isAskType()){
|
||||
//Irrespective of the ResultFormatParam, this always prints a boolean to the default OutputStream.
|
||||
String result = (qe.execAsk() == true) ? "true" : "false";
|
||||
PrintWriter p = response.getWriter();
|
||||
p.write(result);
|
||||
return;
|
||||
}
|
||||
response.setContentType(rdfFormatSymbols.get(rdfResultFormatParam));
|
||||
OutputStream out = response.getOutputStream();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue