001 /** 002 * OntoBride library 003 * Departamento de Ingeniería del Software e Inteligencia Artificial 004 * Universidad Complutense de Madrid 005 * 006 * Licensed under the terms of the GNU Library or Lesser General Public License (LGPL) 007 * 008 * @author Juan A. Recio García 009 * 010 * This software is a subproject of the jCOLIBRI framework 011 * http://sourceforge.net/projects/jcolibri-cbr/ 012 * http://gaia.fdi.ucm.es/projects/jcolibri/ 013 * 014 * File: OntologyDocument.java 015 * 22/11/2006 016 */ 017 package es.ucm.fdi.gaia.ontobridge; 018 019 import es.ucm.fdi.gaia.ontobridge.exceptions.NoLocalFileException; 020 021 /** 022 * Represents the file/document containing an ontology. 023 * As ontologies should be online but usually are placed locally this class allows to 024 * map the URI of the ontology with the local copy. 025 * 026 * @author Juan A. Recio Garcia 027 */ 028 public class OntologyDocument { 029 030 private String _URL; 031 private String _localfile; 032 033 034 /** 035 * Creates an ontology document 036 * @param URL The correct URL of the ontology 037 * @param localfile the local copy of the ontology 038 */ 039 public OntologyDocument(String URL, String localfile) 040 { 041 _URL = URL; 042 _localfile = localfile; 043 } 044 045 /** 046 * Creates an ontology document. There is no local copy. 047 * @param URL The correct URL of the ontology 048 */ 049 public OntologyDocument(String URL) 050 { 051 this(URL,null); 052 } 053 054 055 /** 056 * @return the localfile 057 */ 058 public String getLocalfile() throws NoLocalFileException{ 059 if(_localfile == null) 060 throw new NoLocalFileException(_localfile); 061 return _localfile; 062 } 063 064 /** 065 * @return the URL 066 */ 067 public String getURL() { 068 return _URL; 069 } 070 071 /** 072 * Checks if user has configured the local copy 073 */ 074 public boolean hasAltLocalFile() 075 { 076 return (_localfile != null); 077 } 078 079 080 }