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
2ceab6e3df
commit
64624f2b84
23 changed files with 255 additions and 194 deletions
|
@ -9,11 +9,14 @@ import org.junit.Assert;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccessStub;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames;
|
||||
|
||||
/**
|
||||
* @author bdc34
|
||||
|
@ -36,7 +39,12 @@ public class AdditionalURIsForClassGroupChangesTest {
|
|||
OntModel model = ModelFactory.createOntologyModel();
|
||||
model.read( new StringReader(n3ForPresentationClass), null, "N3");
|
||||
|
||||
StatementToURIsToUpdate uriFinder = new AdditionalURIsForClassGroupChanges( model );
|
||||
ContextModelAccessStub models = new ContextModelAccessStub();
|
||||
models.setOntModel(ModelNames.TBOX_ASSERTIONS, model);
|
||||
|
||||
AdditionalURIsForClassGroupChanges uriFinder = new AdditionalURIsForClassGroupChanges( );
|
||||
uriFinder.setContextModels(models);
|
||||
|
||||
List<String> uris = uriFinder.findAdditionalURIsToIndex(
|
||||
ResourceFactory.createStatement(
|
||||
ResourceFactory.createResource("http://vivoweb.org/ontology/core#Presentation"),
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.searchindex.indexing;
|
||||
|
||||
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.WhichService.CONTENT;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,6 +11,8 @@ import org.junit.Assert;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ContextModelAccessStub;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
|
@ -22,6 +26,7 @@ public class AdditionalURIsForObjectPropertiesTest {
|
|||
|
||||
Model model;
|
||||
RDFService rdfService;
|
||||
AdditionalURIsForObjectProperties aufop;
|
||||
|
||||
String testNS = "http://example.com/test#";
|
||||
String n3 = "" +
|
||||
|
@ -44,11 +49,16 @@ public class AdditionalURIsForObjectPropertiesTest {
|
|||
model = ModelFactory.createDefaultModel();
|
||||
model.read(new StringReader(n3 ), null , "N3");
|
||||
rdfService = new RDFServiceModel(model);
|
||||
|
||||
ContextModelAccessStub models = new ContextModelAccessStub();
|
||||
models.setRDFService(CONTENT, rdfService);
|
||||
|
||||
aufop = new AdditionalURIsForObjectProperties();
|
||||
aufop.setContextModels(models);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChangeOfRdfsLabel() {
|
||||
AdditionalURIsForObjectProperties aufop = new AdditionalURIsForObjectProperties(rdfService);
|
||||
List<String> uris = aufop.findAdditionalURIsToIndex(
|
||||
ResourceFactory.createStatement(
|
||||
ResourceFactory.createResource(testNS + "bob"),
|
||||
|
@ -70,8 +80,6 @@ public class AdditionalURIsForObjectPropertiesTest {
|
|||
|
||||
@Test
|
||||
public void testChangeOfObjPropStmt() {
|
||||
|
||||
AdditionalURIsForObjectProperties aufop = new AdditionalURIsForObjectProperties(rdfService);
|
||||
List<String> uris = aufop.findAdditionalURIsToIndex(
|
||||
ResourceFactory.createStatement(
|
||||
ResourceFactory.createResource(testNS + "bob"),
|
||||
|
@ -93,7 +101,6 @@ public class AdditionalURIsForObjectPropertiesTest {
|
|||
|
||||
@Test
|
||||
public void testOfDataPropChange() {
|
||||
AdditionalURIsForObjectProperties aufop = new AdditionalURIsForObjectProperties(rdfService);
|
||||
List<String> uris = aufop.findAdditionalURIsToIndex(
|
||||
ResourceFactory.createStatement(
|
||||
ResourceFactory.createResource(testNS + "bob"),
|
||||
|
@ -112,9 +119,12 @@ public class AdditionalURIsForObjectPropertiesTest {
|
|||
|
||||
Model model = ModelFactory.createDefaultModel();
|
||||
model.read(new StringReader( n3ForNIHVIVO_2902 ), null , "N3");
|
||||
RDFService rdfService = new RDFServiceModel(model);
|
||||
|
||||
ContextModelAccessStub models = new ContextModelAccessStub();
|
||||
models.setRDFService(CONTENT, new RDFServiceModel(model));
|
||||
|
||||
AdditionalURIsForObjectProperties aufop = new AdditionalURIsForObjectProperties(rdfService);
|
||||
aufop.setContextModels(models);
|
||||
|
||||
List<String> uris = aufop.findAdditionalURIsToIndex(
|
||||
ResourceFactory.createStatement(
|
||||
ResourceFactory.createResource("http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n2241"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue