NIHVIVO-2343 Figuring out how to get the correct model that I want for queries.
This commit is contained in:
parent
505fd4456d
commit
9fa5986cf2
1 changed files with 6 additions and 3 deletions
|
@ -64,7 +64,7 @@ public class SparqlQueryAjaxController extends VitroAjaxController {
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
try {
|
try {
|
||||||
String modelParam = getModelParam(vreq);
|
String modelParam = getModelParam(vreq);
|
||||||
Model model = locateModel(modelParam);
|
Model model = locateModel(vreq, modelParam);
|
||||||
String queryParam = locateQueryParam(vreq);
|
String queryParam = locateQueryParam(vreq);
|
||||||
Query query = createQuery(queryParam);
|
Query query = createQuery(queryParam);
|
||||||
executeQuery(response, query, model);
|
executeQuery(response, query, model);
|
||||||
|
@ -86,7 +86,8 @@ public class SparqlQueryAjaxController extends VitroAjaxController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model locateModel(String modelParam) throws AjaxControllerException {
|
private Model locateModel(VitroRequest vreq, String modelParam)
|
||||||
|
throws AjaxControllerException {
|
||||||
Object o = getServletContext().getAttribute("baseOntModelSelector");
|
Object o = getServletContext().getAttribute("baseOntModelSelector");
|
||||||
if (!(o instanceof OntModelSelector)) {
|
if (!(o instanceof OntModelSelector)) {
|
||||||
throw new AjaxControllerException(SC_INTERNAL_SERVER_ERROR,
|
throw new AjaxControllerException(SC_INTERNAL_SERVER_ERROR,
|
||||||
|
@ -98,7 +99,9 @@ public class SparqlQueryAjaxController extends VitroAjaxController {
|
||||||
if (OPTION_MODEL_USER_ACCOUNTS.equals(modelParam)) {
|
if (OPTION_MODEL_USER_ACCOUNTS.equals(modelParam)) {
|
||||||
model = oms.getUserAccountsModel();
|
model = oms.getUserAccountsModel();
|
||||||
} else {
|
} else {
|
||||||
model = oms.getFullModel();
|
// TODO What is the appropriate way to do this?
|
||||||
|
// model = oms.getFullModel();
|
||||||
|
model = vreq.getJenaOntModel();
|
||||||
}
|
}
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
throw new AjaxControllerException(SC_INTERNAL_SERVER_ERROR,
|
throw new AjaxControllerException(SC_INTERNAL_SERVER_ERROR,
|
||||||
|
|
Loading…
Add table
Reference in a new issue