VIVO-870 Make IndexingUriFinders configurable.
Use no-argument constructors, supplying data through the ContextModelsUser interface as needed. Add toString() methods to IndexingUriFinders, DocumentModifiers and SearchIndexExcluders
This commit is contained in:
parent
5b89014105
commit
69711960bc
8 changed files with 109 additions and 93 deletions
|
@ -254,6 +254,13 @@ public class CalculateParameters implements DocumentModifier, ContextModelsUser
|
|||
public void shutdown(){
|
||||
shutdown=true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + "[]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TotalInd implements Runnable{
|
||||
|
|
|
@ -122,6 +122,12 @@ public class VIVOValuesFromVcards implements DocumentModifier, ContextModelsUser
|
|||
shutdown = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName() + "[]";
|
||||
}
|
||||
|
||||
private abstract static class ResultParser {
|
||||
public abstract void parse(String uri, QuerySolution solution, SearchInputDocument doc);
|
||||
|
||||
|
|
|
@ -21,25 +21,27 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccess;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser;
|
||||
|
||||
public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate {
|
||||
|
||||
private final RDFService rdfService;
|
||||
private Set<String> alreadyChecked;
|
||||
private long accumulatedTime = 0;
|
||||
public class AdditionalURIsForContextNodes implements IndexingUriFinder, ContextModelsUser {
|
||||
private Log log = LogFactory.getLog(AdditionalURIsForContextNodes.class);
|
||||
|
||||
private static final List<String> multiValuedQueriesForAgent = new ArrayList<String>();
|
||||
private static final String multiValuedQueryForInformationContentEntity;
|
||||
private static final List<String> multiValuedQueriesForRole = new ArrayList<String>();
|
||||
private static final List<String>queryList;
|
||||
|
||||
private Log log = LogFactory.getLog(AdditionalURIsForContextNodes.class);
|
||||
private RDFService rdfService;
|
||||
private Set<String> alreadyChecked;
|
||||
private long accumulatedTime = 0;
|
||||
|
||||
|
||||
public AdditionalURIsForContextNodes( RDFService rdfService){
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
@Override
|
||||
public void setContextModels(ContextModelAccess models) {
|
||||
this.rdfService = models.getRDFService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findAdditionalURIsToIndex(Statement stmt) {
|
||||
|
@ -78,7 +80,7 @@ public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endIndxing() {
|
||||
public void endIndexing() {
|
||||
log.debug( "Accumulated time for this run of the index: " + accumulatedTime + " msec");
|
||||
alreadyChecked = null;
|
||||
}
|
||||
|
@ -765,4 +767,9 @@ public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate {
|
|||
queryList = Collections.unmodifiableList(tmpList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.searchindex.indexing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
|
||||
/**
|
||||
* Make a list of StatementToURIsToUpdate objects for use by the
|
||||
* IndexBuidler.
|
||||
*/
|
||||
public class AdditionalUriFinders {
|
||||
|
||||
public static List<StatementToURIsToUpdate> getList(RDFService rdfService,
|
||||
IndividualDao indDao) {
|
||||
List<StatementToURIsToUpdate> uriFinders = new ArrayList<>();
|
||||
uriFinders.add(new AdditionalURIsForDataProperties());
|
||||
uriFinders.add(new AdditionalURIsForObjectProperties(rdfService));
|
||||
uriFinders.add(new AdditionalURIsForContextNodes(rdfService));
|
||||
uriFinders.add(new AdditionalURIsForTypeStatements());
|
||||
uriFinders.add(new URIsForClassGroupChange(indDao));
|
||||
uriFinders.add(new AdditionalUrisForVCards(rdfService));
|
||||
return uriFinders;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,13 +18,15 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccess;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.configuration.ContextModelsUser;
|
||||
|
||||
/**
|
||||
* If the property of a VCard object is changed, we should re-index the owner of
|
||||
* that VCard.
|
||||
*/
|
||||
public class AdditionalUrisForVCards implements StatementToURIsToUpdate {
|
||||
public class AdditionalUrisForVCards implements IndexingUriFinder, ContextModelsUser {
|
||||
private static final Log log = LogFactory
|
||||
.getLog(AdditionalUrisForVCards.class);
|
||||
|
||||
|
@ -37,10 +39,11 @@ public class AdditionalUrisForVCards implements StatementToURIsToUpdate {
|
|||
+ " ?uri obo:ARG_2000028 ?contactInfo . \n " //
|
||||
+ "}";
|
||||
|
||||
private final RDFService rdfService;
|
||||
|
||||
public AdditionalUrisForVCards(RDFService rdfService) {
|
||||
this.rdfService = rdfService;
|
||||
private RDFService rdfService;
|
||||
|
||||
@Override
|
||||
public void setContextModels(ContextModelAccess models) {
|
||||
this.rdfService = models.getRDFService();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,8 +116,13 @@ public class AdditionalUrisForVCards implements StatementToURIsToUpdate {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endIndxing() {
|
||||
public void endIndexing() {
|
||||
// Nothing to tear down.
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue