11/*
22 * The baseCode project
3- *
3+ *
44 * Copyright (c) 2011 University of British Columbia
5- *
5+ *
66 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
77 * the License. You may obtain a copy of the License at
8- *
8+ *
99 * http://www.apache.org/licenses/LICENSE-2.0
10- *
10+ *
1111 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
1212 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
1313 * specific language governing permissions and limitations under the License.
1414 */
1515package ubic .basecode .ontology .providers ;
1616
17+ import com .hp .hpl .jena .ontology .OntModel ;
1718import ubic .basecode .ontology .jena .AbstractOntologyMemoryBackedService ;
18- import ubic .basecode .util .Configuration ;
19+
20+ import java .io .IOException ;
21+ import java .io .InputStream ;
22+ import java .util .zip .GZIPInputStream ;
1923
2024/**
2125 * @author paul
22- *
2326 */
2427public class NIFSTDOntologyService extends AbstractOntologyMemoryBackedService {
2528
26- private static final String NIFSTD_ONTOLOGY_URL = "url.nifstdOntology " ;
29+ private static final String NIFSTD_ONTOLOGY_FILE = "/data/loader/ontology/nif-gemma.owl.gz " ;
2730
2831 @ Override
2932 protected String getOntologyName () {
@@ -32,7 +35,23 @@ protected String getOntologyName() {
3235
3336 @ Override
3437 protected String getOntologyUrl () {
35- return Configuration .getString ( NIFSTD_ONTOLOGY_URL );
38+ return "classpath:" + NIFSTD_ONTOLOGY_FILE ;
39+ }
40+
41+ @ Override
42+ protected boolean getProcessImport () {
43+ return false ;
3644 }
3745
46+ @ Override
47+ protected OntModel loadModel () {
48+ try ( InputStream stream = getClass ().getResourceAsStream ( NIFSTD_ONTOLOGY_FILE ) ) {
49+ if ( stream == null ) {
50+ throw new RuntimeException ( String .format ( "The NIF ontology was not found in classpath at %s." , NIFSTD_ONTOLOGY_FILE ) );
51+ }
52+ return loadModelFromStream ( new GZIPInputStream ( stream ) );
53+ } catch ( IOException e ) {
54+ throw new RuntimeException ( e );
55+ }
56+ }
3857}
0 commit comments