diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForObjectPropertiesTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForObjectPropertiesTest.java index 3a5a5f6f3..eeacf0e6f 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForObjectPropertiesTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForObjectPropertiesTest.java @@ -98,4 +98,62 @@ public class AdditionalURIsForObjectPropertiesTest { Assert.assertNotNull(uris); Assert.assertTrue("uris was not empty", uris.size() == 0 ); } + + // For NIHVIVO-2902 + @Test + public void testNIHVIVO_2902 (){ + //Update search index for research area when a statement is + //removed between a person and the research area. + + Model model = ModelFactory.createDefaultModel(); + model.read(new StringReader( n3ForNIHVIVO_2902 ), null , "N3"); + + AdditionalURIsForObjectProperties aufop = new AdditionalURIsForObjectProperties(model); + List uris = aufop.findAdditionalURIsToIndex( + ResourceFactory.createStatement( + ResourceFactory.createResource("http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n2241"), + ResourceFactory.createProperty("http://vivoweb.org/ontology/core#hasResearchArea"), + ResourceFactory.createResource("http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n7416"))); + + Assert.assertNotNull(uris); + Assert.assertTrue("uris was empty", uris.size() > 0 ); + + Assert.assertTrue("NIHVIVO-2902 regression, research area is not getting reindexed", uris.contains("http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n7416")); + } + + // For NIHVIVO-2902 + String n3ForNIHVIVO_2902 = + "@prefix dc: . \n" + + "@prefix pvs: . \n" + + "@prefix geo: . \n" + + "@prefix foaf: . \n" + + "@prefix scires: . \n" + + "@prefix scripps: . \n" + + "@prefix dcterms: . \n" + + "@prefix rdfs: . \n" + + "@prefix swrl: . \n" + + "@prefix vitro: . \n" + + "@prefix event: . \n" + + "@prefix bibo: . \n" + + "@prefix xsd: . \n" + + "@prefix owl: . \n" + + "@prefix swrlb: . \n" + + "@prefix rdf: . \n" + + "@prefix core: . \n" + + "@prefix skos: . \n" + + "@prefix vivo: . \n" + + "@prefix dcelem: . \n" + + "@prefix ero: . \n" + + " \n" + + " \n" + + " a core:FacultyMember , foaf:Person , owl:Thing , foaf:Agent ; \n" + + " rdfs:label \"Faculty, Jane\" ; \n" + + " vitro:modTime \"2011-07-15T15:08:35\"^^xsd:dateTime ; \n" + + " vitro:mostSpecificType \n" + + " core:FacultyMember ; \n" + + " core:hasResearchArea \n" + + " ; \n" + + " core:mailingAddress ; \n" + + " foaf:firstName \"Jane\"^^xsd:string ; \n" + + " foaf:lastName \"Faculty\"^^xsd:string . "; }