This commit is contained in:
parent
cf69ec009a
commit
4943a966fe
3 changed files with 17 additions and 16 deletions
|
@ -29,6 +29,7 @@ public class SearchQueryHandler {
|
|||
|
||||
private OntModel fullModel;
|
||||
private String contextNodeURI;
|
||||
private int totalInd;
|
||||
//private String query = "";
|
||||
|
||||
// private static final String queryForEducationalTraining = "SELECT ?query WHERE {" +
|
||||
|
@ -40,6 +41,7 @@ public class SearchQueryHandler {
|
|||
OntModel displayOntModel, ServletContext context) {
|
||||
this.fullModel = ModelContext.getJenaOntModel(context);
|
||||
this.contextNodeURI = contextNodeURI;
|
||||
this.totalInd = fullModel.listIndividuals().toList().size();
|
||||
//query = getQueryFromModel(contextNodeURI, displayOntModel);
|
||||
}
|
||||
|
||||
|
@ -644,11 +646,7 @@ public class SearchQueryHandler {
|
|||
return propertyValues.toString();
|
||||
|
||||
}
|
||||
|
||||
private int getTotalIndividuals(){
|
||||
return fullModel.listIndividuals().toList().size();
|
||||
}
|
||||
|
||||
|
||||
public float calculateBeta(String uri){
|
||||
float beta=0;
|
||||
RDFNode node = (Resource) fullModel.getResource(uri);
|
||||
|
@ -659,7 +657,7 @@ public class SearchQueryHandler {
|
|||
Conn++;
|
||||
}
|
||||
|
||||
beta = (float)Conn/getTotalIndividuals();
|
||||
beta = (float)Conn/totalInd;
|
||||
beta += 1;
|
||||
return beta;
|
||||
}
|
||||
|
|
|
@ -242,17 +242,17 @@ public class Entity2LuceneDoc implements Obj2DocIface{
|
|||
String contextNodePropertyValues;
|
||||
|
||||
// if(ent.isVClass("http://xmlns.com/foaf/0.1/Person")){
|
||||
contextNodePropertyValues = searchQueryHandler.getPropertiesAssociatedWithEducationalTraining(ent.getURI());
|
||||
/*contextNodePropertyValues = searchQueryHandler.getPropertiesAssociatedWithEducationalTraining(ent.getURI());
|
||||
contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithRole(ent.getURI());
|
||||
contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithPosition(ent.getURI());
|
||||
contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithRelationship(ent.getURI());
|
||||
contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithAwardReceipt(ent.getURI());
|
||||
contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithInformationResource(ent.getURI());
|
||||
contextNodePropertyValues += searchQueryHandler.getPropertiesAssociatedWithInformationResource(ent.getURI()); */
|
||||
|
||||
// }
|
||||
|
||||
Field contextNodeInformation = new Field(term.CONTEXTNODE, contextNodePropertyValues, Field.Store.YES, Field.Index.ANALYZED );
|
||||
doc.add(contextNodeInformation);
|
||||
/* Field contextNodeInformation = new Field(term.CONTEXTNODE, contextNodePropertyValues, Field.Store.YES, Field.Index.ANALYZED );
|
||||
doc.add(contextNodeInformation);*/
|
||||
|
||||
//Moniker
|
||||
|
||||
|
|
|
@ -71,6 +71,9 @@ public class IndividualToSolrDocument implements Obj2DocIface {
|
|||
String classPublicNames = "";
|
||||
SolrInputDocument doc = new SolrInputDocument();
|
||||
|
||||
float beta = searchQueryHandler.calculateBeta(ent.getURI());
|
||||
doc.addField(term.BETA,beta);
|
||||
|
||||
//DocId
|
||||
String id = ent.getURI();
|
||||
log.debug("translating " + id);
|
||||
|
@ -152,10 +155,10 @@ public class IndividualToSolrDocument implements Obj2DocIface {
|
|||
value = ent.getLocalName();
|
||||
}
|
||||
|
||||
doc.addField(term.NAME_RAW, value, NAME_BOOST);
|
||||
doc.addField(term.NAME_LOWERCASE, value.toLowerCase(),NAME_BOOST);
|
||||
doc.addField(term.NAME_UNSTEMMED, value,NAME_BOOST);
|
||||
doc.addField(term.NAME_STEMMED, value, NAME_BOOST);
|
||||
doc.addField(term.NAME_RAW, value, (NAME_BOOST*beta));
|
||||
doc.addField(term.NAME_LOWERCASE, value.toLowerCase(),(NAME_BOOST*beta));
|
||||
doc.addField(term.NAME_UNSTEMMED, value,(NAME_BOOST*beta));
|
||||
doc.addField(term.NAME_STEMMED, value, (NAME_BOOST*beta));
|
||||
|
||||
long tContextNodes = System.currentTimeMillis();
|
||||
|
||||
|
@ -241,8 +244,8 @@ public class IndividualToSolrDocument implements Obj2DocIface {
|
|||
|
||||
log.debug("time to include data property statements, object property statements in the index: " + Long.toString(System.currentTimeMillis() - tPropertyStatements));
|
||||
|
||||
doc.addField(term.ALLTEXT, value,ALL_TEXT_BOOST);
|
||||
doc.addField(term.ALLTEXTUNSTEMMED, value,ALL_TEXT_BOOST);
|
||||
doc.addField(term.ALLTEXT, value,(ALL_TEXT_BOOST*beta));
|
||||
doc.addField(term.ALLTEXTUNSTEMMED, value,(ALL_TEXT_BOOST*beta));
|
||||
}
|
||||
|
||||
return doc;
|
||||
|
|
Loading…
Add table
Reference in a new issue