001/**
002 * Copyright (C) 2007 - 2016, Jens Lehmann
003 *
004 * This file is part of DL-Learner.
005 *
006 * DL-Learner is free software; you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation; either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * DL-Learner is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package org.dllearner.utilities.owl;
020
021import org.semanticweb.owlapi.model.OWLOntology;
022import org.semanticweb.owlapi.model.OWLOntologyManager;
023
024/**
025 * Created by IntelliJ IDEA.
026 * User: Chris Shellenbarger
027 * Date: 3/14/12
028 * Time: 7:30 PM
029 * <p/>
030 * Interface to allow the conversion of an OWL Ontology into a byte array and back.
031 * <p/>
032 * The purpose of the interface is to allow the association of an OWLOntology object with a specified OWLOntologyManager.
033 * <p/>
034 * If someone hands us an OWLOntology, we may not want to use the associated OWLOntologyManager.  Rather, we can serialize it out
035 * to a byte array and then read it back in with a different OWLOntologyManager.
036 */
037public interface OntologyToByteConverter {
038
039    /**
040     * Convert the ontology into a byte array.
041     *
042     * @param ontology The ontology to convert to a byte array.
043     * @return The byte array representing the ontology
044     */
045    byte[] convert(OWLOntology ontology);
046
047    /**
048     * Convert bytes into an Ontology registered with manager.
049     *
050     * @param bytes   The bytes to convert to an OWLOntology
051     * @param manager The Ontology Manager to load the ontology with.
052     * @return The ontology derived from bytes.
053     */
054    OWLOntology convert(byte[] bytes, OWLOntologyManager manager);
055}