|
17 | 17 | import com.hp.hpl.jena.ontology.OntClass; |
18 | 18 | import com.hp.hpl.jena.ontology.OntModel; |
19 | 19 | import com.hp.hpl.jena.shared.JenaException; |
20 | | -import org.junit.BeforeClass; |
21 | 20 | import org.junit.Test; |
22 | 21 | import ubic.basecode.ontology.AbstractOntologyTest; |
23 | 22 | import ubic.basecode.ontology.jena.OntologyLoader; |
24 | 23 | import ubic.basecode.ontology.jena.OntologyTermImpl; |
25 | | -import ubic.basecode.ontology.jena.search.*; |
| 24 | +import ubic.basecode.ontology.jena.search.OntologyIndexer; |
26 | 25 | import ubic.basecode.ontology.jena.search.OntologySearch; |
| 26 | +import ubic.basecode.ontology.jena.search.OntologySearchJenaException; |
| 27 | +import ubic.basecode.ontology.jena.search.SearchIndex; |
27 | 28 |
|
28 | | -import java.io.IOException; |
29 | 29 | import java.io.InputStream; |
30 | 30 | import java.util.Collection; |
31 | | -import java.util.HashSet; |
32 | | -import java.util.List; |
33 | 31 | import java.util.Set; |
34 | 32 | import java.util.zip.GZIPInputStream; |
35 | 33 |
|
|
45 | 43 | */ |
46 | 44 | public class OntologySearchTest extends AbstractOntologyTest { |
47 | 45 |
|
48 | | - private static OntModel uberon; |
49 | | - private static SearchIndex uberonIndex; |
50 | | - |
51 | | - @BeforeClass |
52 | | - public static void setUpUberon() throws IOException { |
53 | | - try ( InputStream is = new GZIPInputStream( requireNonNull( OntologySearchTest.class.getResourceAsStream( "/data/uberon.owl.gz" ) ) ) ) { |
54 | | - uberon = OntologyLoader.loadMemoryModel( is, "UBERON_TEST2" ); |
55 | | - uberonIndex = OntologyIndexer.indexOntology( "UBERON_TEST2", uberon, false ); |
56 | | - } |
57 | | - } |
58 | | - |
59 | 46 | @Test |
60 | 47 | public final void testIndexing() throws Exception { |
61 | 48 | InputStream is = new GZIPInputStream( requireNonNull( this.getClass().getResourceAsStream( "/data/mged.owl.gz" ) ) ); |
@@ -246,23 +233,6 @@ public final void testOmitDefinitions4() throws Exception { |
246 | 233 | index.close(); |
247 | 234 | } |
248 | 235 |
|
249 | | - @Test |
250 | | - public void testOmitDefinition() throws OntologySearchException { |
251 | | - OntClass brain = uberon.getOntClass( "http://purl.obolibrary.org/obo/UBERON_0000955" ); |
252 | | - assertNotNull( brain ); |
253 | | - Set<OntologySearch.SearchResult<OntClass>> searchResults = OntologySearch.matchClasses( uberon, uberonIndex, "brain" ).toSet(); |
254 | | - assertEquals( 128, searchResults.size() ); |
255 | | - } |
256 | | - |
257 | | - @Test |
258 | | - public void testScore() throws OntologySearchException { |
259 | | - OntClass brain = uberon.getOntClass( "http://purl.obolibrary.org/obo/UBERON_0000955" ); |
260 | | - assertNotNull( brain ); |
261 | | - List<OntologySearch.SearchResult<OntClass>> searchResults = OntologySearch.matchClasses( uberon, uberonIndex, "brain" ).toList(); |
262 | | - assertEquals( 446, searchResults.size() ); |
263 | | - assertEquals( 3.334063, searchResults.get( 0 ).score, 0.000001 ); |
264 | | - assertEquals( 128, new HashSet<>( searchResults ).size() ); |
265 | | - } |
266 | 236 |
|
267 | 237 | @Test |
268 | 238 | public final void testPersistence() throws Exception { |
|
0 commit comments