Skip to content

Package: Connector

Connector

Coverage

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.ontodriver.owlapi.connector;
16:
17: import org.semanticweb.owlapi.model.OWLOntologyChange;
18:
19: import java.util.List;
20: import java.util.function.Consumer;
21: import java.util.function.Function;
22:
23: /**
24: * Storage connector interface.
25: * <p>
26: * This interface declares the methods accessible from the driver.
27: */
28: public interface Connector {
29:
30: /**
31: * Gets snapshot of the underlying ontology.
32: * <p>
33: * The snapshot is completely independent of the live ontology, so any changes to either are not visible to the
34: * other.
35: *
36: * @return Value object with the ontology snapshot
37: */
38: OntologySnapshot getOntologySnapshot();
39:
40: <R> R executeRead(Function<OntologySnapshot, R> function);
41:
42: void executeWrite(Consumer<OntologySnapshot> function);
43:
44: /**
45: * Applies the specified changes to the underlying ontology.
46: * <p>
47: * Note that this operation is atomic - the changes are applied as a whole and no other operation can be performed
48: * on the underlying ontology while the changes are being applied.
49: *
50: * @param changes The changes to apply
51: */
52: void applyChanges(List<OWLOntologyChange> changes);
53: }