removing graph vars from getSearchBoost() to improve performance of search indexing with Sesame endpoint
This commit is contained in:
parent
5981f30047
commit
b23e77fe23
1 changed files with 9 additions and 35 deletions
|
@ -291,48 +291,22 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void constructProperty(OntResource ind, String propertyURI) {
|
|
||||||
DatasetWrapper w = getDatasetWrapper();
|
|
||||||
Dataset dataset = w.getDataset();
|
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
|
||||||
try {
|
|
||||||
String[] graphVars = { "?g" };
|
|
||||||
String queryStr =
|
|
||||||
"CONSTRUCT { <"+ind.getURI()+"> <" + propertyURI + "> ?value } \n" +
|
|
||||||
"WHERE { \n" +
|
|
||||||
"<" + ind.getURI() +"> <" + propertyURI + "> ?value \n" +
|
|
||||||
WebappDaoFactorySDB.getFilterBlock(graphVars, datasetMode) +
|
|
||||||
"\n} ";
|
|
||||||
Query query = QueryFactory.create(queryStr);
|
|
||||||
QueryExecution qe = QueryExecutionFactory.create(
|
|
||||||
query, dataset);
|
|
||||||
qe.execConstruct(ind.getModel());
|
|
||||||
} finally {
|
|
||||||
dataset.getLock().leaveCriticalSection();
|
|
||||||
w.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float getSearchBoost(){
|
public Float getSearchBoost(){
|
||||||
if( this._searchBoostJena != null ){
|
if( this._searchBoostJena != null ){
|
||||||
return this._searchBoostJena;
|
return this._searchBoostJena;
|
||||||
}else{
|
}else{
|
||||||
String[] graphVars = { "?g" };
|
|
||||||
String getPropertyValue =
|
String getPropertyValue =
|
||||||
"SELECT ?value \n" +
|
"SELECT ?value \n" +
|
||||||
"WHERE { GRAPH ?g { \n" +
|
"WHERE { \n" +
|
||||||
"<" +individualURI+ "> <" +webappDaoFactory.getJenaBaseDao().SEARCH_BOOST_ANNOT+ "> ?value }\n" +
|
"<" +individualURI+ "> <" +webappDaoFactory.getJenaBaseDao().SEARCH_BOOST_ANNOT+ "> ?value \n" +
|
||||||
WebappDaoFactorySDB.getFilterBlock(graphVars, datasetMode) + "\n" +
|
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
DatasetWrapper w = getDatasetWrapper();
|
DatasetWrapper w = getDatasetWrapper();
|
||||||
Dataset dataset = w.getDataset();
|
Dataset dataset = w.getDataset();
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
QueryExecution qe = QueryExecutionFactory.create(
|
||||||
|
QueryFactory.create(getPropertyValue), dataset);
|
||||||
try{
|
try{
|
||||||
ResultSet rs = QueryExecutionFactory.create(
|
ResultSet rs = qe.execSelect();
|
||||||
QueryFactory.create(getPropertyValue),
|
|
||||||
dataset).execSelect();
|
|
||||||
|
|
||||||
if(rs.hasNext()){
|
if(rs.hasNext()){
|
||||||
QuerySolution qs = rs.nextSolution();
|
QuerySolution qs = rs.nextSolution();
|
||||||
if(qs.get("value") !=null){
|
if(qs.get("value") !=null){
|
||||||
|
@ -340,14 +314,14 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
searchBoost = Float.parseFloat(value.getLexicalForm());
|
searchBoost = Float.parseFloat(value.getLexicalForm());
|
||||||
return searchBoost;
|
return searchBoost;
|
||||||
}
|
}
|
||||||
}
|
} else{
|
||||||
else{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
log.error(e,e);
|
log.error(e,e);
|
||||||
return null;
|
return null;
|
||||||
}finally{
|
} finally{
|
||||||
|
qe.close();
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue