001 /***************************************************************************/
002 /* Copyright (C) 2010-2011, Sebastian Hellmann */
003 /* Note: If you need parts of NLP2RDF in another licence due to licence */
004 /* incompatibility, please mail hellmann@informatik.uni-leipzig.de */
005 /* */
006 /* This file is part of NLP2RDF. */
007 /* */
008 /* NLP2RDF is free software; you can redistribute it and/or modify */
009 /* it under the terms of the GNU General Public License as published by */
010 /* the Free Software Foundation; either version 3 of the License, or */
011 /* (at your option) any later version. */
012 /* */
013 /* NLP2RDF is distributed in the hope that it will be useful, */
014 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
015 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
016 /* GNU General Public License for more details. */
017 /* */
018 /* You should have received a copy of the GNU General Public License */
019 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
020 /***************************************************************************/
021
022 package org.nlp2rdf.ontology.olia;
023
024 import org.nlp2rdf.ontology.ClasspathLoader;
025 import org.nlp2rdf.ontology.OntologyLoader;
026
027 import java.util.HashMap;
028 import java.util.Map;
029
030 /**
031 * @author Sebastian Hellmann - http://bis.informatik.uni-leipzig.de/SebastianHellmann
032 */
033 public class OLiAManager {
034
035 private Map<String, OLiAOntology> url2OLiAOntology = new HashMap<String, OLiAOntology>();
036
037 private OntologyLoader ontologyLoader = new ClasspathLoader();
038
039 public OLiAManager() {
040 }
041
042 public OLiAManager(OntologyLoader ontologyLoader) {
043 this.ontologyLoader = ontologyLoader;
044 }
045
046 public OLiAOntology getOLiAOntology(String ontologyUrl) {
047 OLiAOntology oo;
048 if ((oo = url2OLiAOntology.get(ontologyUrl)) != null) {
049 return oo;
050 }
051 oo = new OLiAOntology(ontologyUrl, ontologyLoader);
052 url2OLiAOntology.put(ontologyUrl, oo);
053 return oo;
054 }
055
056
057 public OntologyLoader getOntologyLoader() {
058 return ontologyLoader;
059 }
060
061 public void setOntologyLoader(OntologyLoader ontologyLoader) {
062 this.ontologyLoader = ontologyLoader;
063 }
064 }