View Javadoc
1   /*
2    * The baseCode project
3    *
4    * Copyright (c) 2013 University of British Columbia
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
7    * the License. You may obtain a copy of the License at
8    *
9    * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
12   * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
13   * specific language governing permissions and limitations under the License.
14   */
15  package ubic.basecode.ontology.jena;
16  
17  import com.hp.hpl.jena.ontology.OntModel;
18  
19  import javax.annotation.Nullable;
20  import java.io.InputStream;
21  
22  /**
23   * This class has some stuff that's specific to in-memory ontologies. Unlike database backed ontologies we don't use a
24   * pool keeping only one instance of model in memory.
25   *
26   * @author paul
27   */
28  public abstract class AbstractOntologyMemoryBackedService extends AbstractOntologyService {
29  
30      @Override
31      protected OntModel loadModel() {
32          return OntologyLoader.loadMemoryModel( this.getOntologyUrl(), this.getOntologyName() );
33      }
34  
35      @Override
36      protected OntModel loadModelFromStream( InputStream is ) {
37          return OntologyLoader.loadMemoryModel( is, this.getOntologyUrl() );
38      }
39  }