From 6ba8de8a9dc926fb10448f5944b8918f051a0c25 Mon Sep 17 00:00:00 2001 From: tworrall Date: Mon, 7 Oct 2013 15:48:22 -0400 Subject: [PATCH] fixed additional uris for context node tests --- .../AdditionalURIsForContextNodes.java | 8 +- .../AdditionalURIsForContextNodesTest.java | 165 +++++++++--------- 2 files changed, 89 insertions(+), 84 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodes.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodes.java index 4d3fa036e..96216d636 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodes.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodes.java @@ -142,7 +142,7 @@ public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate { + " prefix rdf: \n" + " prefix core: \n" + " prefix foaf: \n" - + " prefix obo: \n" + + " prefix obo: \n" + " prefix vcard: \n" + " prefix event: \n" + " prefix rdfs: \n" @@ -231,10 +231,12 @@ public class AdditionalURIsForContextNodes implements StatementToURIsToUpdate { "SELECT \n" + "(str(?e) as ?LeaderPerson ) WHERE {\n" - + " ?uri rdf:type foaf:Agent ; ?b ?c . \n" + + " ?uri rdf:type foaf:Agent . \n" + + " ?uri core:contributingRole ?c . \n" + " ?c rdf:type core:LeaderRole . \n" - + " OPTIONAL { ?c obo:RO_0000052 ?e . } . \n" + + " OPTIONAL { ?c obo:RO_0000052 ?e . \n" + + " ?e rdf:type foaf:Person . } . " +"}"); } diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java index 1d721c51a..f73674d80 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/search/indexing/AdditionalURIsForContextNodesTest.java @@ -20,7 +20,7 @@ public class AdditionalURIsForContextNodesTest { @Test public void testPositionChanges(){ String n3 = - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -33,8 +33,10 @@ public class AdditionalURIsForContextNodesTest { " . \n" + " . \n" + " . \n" + + " . \n" + + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -86,6 +88,7 @@ public class AdditionalURIsForContextNodesTest { "@prefix rdf: . \n" + "@prefix core: . \n" + "@prefix vivo: . \n" + + "@prefix obo: . \n" + " " + " \n" + " a owl:Thing , core:Role , core:LeaderRole ; \n" + @@ -94,14 +97,15 @@ public class AdditionalURIsForContextNodesTest { " core:LeaderRole ; \n" + " core:dateTimeInterval \n" + " ; \n" + - " core:leaderRoleOf ; \n" + - " core:roleIn . \n" + + " obo:RO_0000052 ; \n" + + " core:roleContributesTo . \n" + " \n" + " a , owl:Thing , , core:ClinicalOrganization ; \n" + " rdfs:label \"Organization XYZ\"^^xsd:string ; \n" + " vitro:mostSpecificType \n" + " core:ClinicalOrganization ; \n" + - " core:relatedRole . \n"; + " core:contributingRole . \n" + + " a , owl:Thing , . \n"; //make a test model with an person, an authorship context node and a book @@ -124,32 +128,31 @@ public class AdditionalURIsForContextNodesTest { String n3= " \"1, Test\" . \n " + - " \"1\"^^ . \n " + - " \"Test\"^^ . \n " + +// " \"1\"^^ . \n " + +// " \"Test\"^^ . \n " + " . \n " + - " . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + " \"Leader Role\"^^ . \n " + - " . \n " + + " . \n " + " . \n " + - " . \n " + + " . \n " + " . \n " + - " . \n " + " . \n " + " . \n " + " \"University1\"^^ . \n " + - " . \n " + + " . \n " + " .\n " + " . \n " + " . \n " + " . \n " + " . \n " ; - + //make a test model with an person, a leader role node and a university OntModel model = ModelFactory.createOntologyModel(); @@ -174,10 +177,10 @@ public class AdditionalURIsForContextNodesTest { public void testMemberRoleChanges(){ String n3 = - " . \n " + + " . \n " + " \"2, Test\" . \n " + - " \"2\"^^ . \n " + - " \"Test\"^^ . \n " + +// " \"2\"^^ . \n " + +// " \"Test\"^^ . \n " + " . \n " + " . \n " + " . \n " + @@ -185,16 +188,16 @@ public class AdditionalURIsForContextNodesTest { " \"Member Role\"^^ . \n " + " . \n " + - " . \n " + + " . \n " + " . \n " + - " . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + " \"University2\"^^ . \n " + - " . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + @@ -228,25 +231,25 @@ public class AdditionalURIsForContextNodesTest { String n3 = " \"3, Test\" . \n" + - " \"3\"^^ .\n" + - " \"Test\"^^ . \n" + - " . \n" + +// " \"3\"^^ .\n" + +// " \"Test\"^^ . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + " . \n" + - " . \n" + + " . \n" + " \"Clinical Role\"^^ . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + " . \n" + " \"Project1\"^^ . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -277,28 +280,28 @@ public class AdditionalURIsForContextNodesTest { String n3 = " \"4, Test\" . \n" + - " \"4\"^^ . \n" + - " \"Test\"^^ . \n" + - " . \n" + +// " \"4\"^^ . \n" + +// " \"Test\"^^ . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + " . \n" + - " . \n" + + " . \n" + " \"Clinical Role 2\"^^ . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + " . \n" + " \"Service1\"^^ . \n" + - " . \n" + - " . \n" + + " . \n" + + " . \n" + " . \n" + - " . \n" ; + " . \n" ; //make a test model with an person, a clinical role node and a service OntModel model = ModelFactory.createOntologyModel(); @@ -322,26 +325,26 @@ public class AdditionalURIsForContextNodesTest { @Test public void testPresenterRoleChangesForPresentation(){ String n3 = - " . \n" + + " . \n" + " \"5, Test\" . \n" + - " \"5\"^^ . \n" + - " \"Test\"^^ . \n" + +// " \"5\"^^ . \n" + +// " \"Test\"^^ . \n" + " . \n" + " . \n" + " . \n" + " . \n" + - " . \n" + + " . \n" + " \"Presenter Role\"^^ . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + " . \n" + " \"Presentation 1\"^^ . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -370,26 +373,26 @@ public class AdditionalURIsForContextNodesTest { public void testPresenterRoleChangesForInvitedTalk(){ String n3 = - " . \n " + + " . \n " + " \"6, Test\" . \n " + - " \"6\"^^ . \n " + - " \"Test\"^^ . \n " + +// " \"6\"^^ . \n " + +// " \"Test\"^^ . \n " + " . \n " + " . \n " + " . \n " + " . \n " + - " . \n " + + " . \n " + " \"Presenter Role 2\"^^ . \n " + " . \n " + - " . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + " . \n " + " \"Invited Talk 1\"^^ . \n " + - " . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + @@ -405,11 +408,11 @@ public class AdditionalURIsForContextNodesTest { //if the person changes then the invited talk needs to be updated List uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4112"); - assertTrue("did not find service for clinical role", uris.contains("http://vivo.scripps.edu/individual/n4107" )); + assertTrue("did not find invited talk for person", uris.contains("http://vivo.scripps.edu/individual/n4107" )); //if the invited talk changes then the person needs to be updated uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n4107"); - assertTrue("did not find person for clinical role", uris.contains("http://vivo.scripps.edu/individual/n4112" )); + assertTrue("did not find person for invited talk", uris.contains("http://vivo.scripps.edu/individual/n4112" )); } @@ -420,9 +423,9 @@ public class AdditionalURIsForContextNodesTest { String n3 = " \"7, Test\" . \n" + - " \"7\"^^ . \n" + - " \"Test\"^^ . \n" + - " . \n" + +// " \"7\"^^ . \n" + +// " \"Test\"^^ . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -430,15 +433,15 @@ public class AdditionalURIsForContextNodesTest { " \"Researcher Role\"^^ . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + " \"Grant1\"^^ . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -469,9 +472,9 @@ public class AdditionalURIsForContextNodesTest { String n3 = " \"8, Test\" . \n " + - " \"8\"^^ . \n " + - " \"Test\"^^ . \n " + - " . \n " + +// " \"8\"^^ . \n " + +// " \"Test\"^^ . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + @@ -479,16 +482,16 @@ public class AdditionalURIsForContextNodesTest { " \"Researcher Role 2\"^^ . \n " + " . \n " + - " . \n " + + " . \n " + " . \n " + - " . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + " \"Project2\"^^ . \n " + - " . \n " + + " . \n " + " . \n " + " . \n " + " . \n " + @@ -519,18 +522,18 @@ public class AdditionalURIsForContextNodesTest { String n3 = - " . \n" + + " . \n" + " \"8, Test\" . \n" + - " \"8\"^^ . \n" + - " \"Test\"^^ . \n" + +// " \"8\"^^ . \n" + +// " \"Test\"^^ . \n" + " . \n" + " . \n" + " . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -539,7 +542,7 @@ public class AdditionalURIsForContextNodesTest { " . \n" + " \"Grant 2\"^^ . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -555,11 +558,11 @@ public class AdditionalURIsForContextNodesTest { //if the person changes then the grant needs to be updated List uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n2368"); - assertTrue("did not find service for clinical role", uris.contains("http://vivo.scripps.edu/individual/n1742" )); + assertTrue("did not find grant for pi", uris.contains("http://vivo.scripps.edu/individual/n1742" )); //if the grant changes then the person needs to be updated uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n1742"); - assertTrue("did not find person for clinical role", uris.contains("http://vivo.scripps.edu/individual/n2368" )); + assertTrue("did not find pi for grant", uris.contains("http://vivo.scripps.edu/individual/n2368" )); } @@ -570,17 +573,17 @@ public class AdditionalURIsForContextNodesTest { String n3 = " \"9, Test\" . \n" + - " \"9\"^^ . \n" + - " \"Test\"^^ . \n" + +// " \"9\"^^ . \n" + +// " \"Test\"^^ . \n" + " . \n" + " . \n" + " . \n" + " . \n" + - " . \n" + + " . \n" + - " . \n" + + " . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -589,7 +592,7 @@ public class AdditionalURIsForContextNodesTest { " . \n" + " \"Grant 3\"^^ . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -619,25 +622,25 @@ public class AdditionalURIsForContextNodesTest { String n3 = " \"10, Test\" . \n" + - " \"10\"^^ . \n" + - " \"Test\"^^ . \n" + +// " \"10\"^^ . \n" + +// " \"Test\"^^ . \n" + " . \n" + " . \n" + " . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + " . \n" + " \"Grant 4\"^^ . \n" + - " . \n" + + " . \n" + " . \n" + " . \n" + " . \n" + @@ -653,11 +656,11 @@ public class AdditionalURIsForContextNodesTest { //if the investigator changes then the grant needs to be updated List uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n5282"); - assertTrue("did not find grant for co-pi", uris.contains("http://vivo.scripps.edu/individual/n160" )); + assertTrue("did not find grant for investigator", uris.contains("http://vivo.scripps.edu/individual/n160" )); //if the grant changes then the investigator needs to be updated uris = uriFinder.findAdditionalURIsToIndex( "http://vivo.scripps.edu/individual/n160"); - assertTrue("did not find co-pi for grant", uris.contains("http://vivo.scripps.edu/individual/n5282" )); + assertTrue("did not find investigator for grant", uris.contains("http://vivo.scripps.edu/individual/n5282" ));