Skip to content

Package: OntologySnapshot

OntologySnapshot

nameinstructionbranchcomplexitylinemethod
OntologySnapshot(OWLOntology, OWLOntologyManager, OWLDataFactory, OWLReasoner)
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
applyChanges(List)
M: 12 C: 10
45%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 3
75%
M: 0 C: 1
100%
getDataFactory()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getOntology()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getOntologyManager()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getReasoner()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

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 cz.cvut.kbss.ontodriver.owlapi.exception.OntologyChangeApplicationException;
18: import org.semanticweb.owlapi.model.OWLDataFactory;
19: import org.semanticweb.owlapi.model.OWLOntology;
20: import org.semanticweb.owlapi.model.OWLOntologyChange;
21: import org.semanticweb.owlapi.model.OWLOntologyManager;
22: import org.semanticweb.owlapi.model.parameters.ChangeApplied;
23: import org.semanticweb.owlapi.reasoner.OWLReasoner;
24:
25: import java.util.List;
26:
27: public class OntologySnapshot {
28:
29: private final OWLOntology ontology;
30: private final OWLOntologyManager ontologyManager;
31: private final OWLDataFactory dataFactory;
32: private final OWLReasoner reasoner;
33:
34: public OntologySnapshot(OWLOntology ontology, OWLOntologyManager ontologyManager, OWLDataFactory dataFactory,
35: OWLReasoner reasoner) {
36: this.ontology = ontology;
37: this.ontologyManager = ontologyManager;
38: this.dataFactory = dataFactory;
39: this.reasoner = reasoner;
40: }
41:
42: public OWLOntology getOntology() {
43: return ontology;
44: }
45:
46: public OWLOntologyManager getOntologyManager() {
47: return ontologyManager;
48: }
49:
50: public OWLDataFactory getDataFactory() {
51: return dataFactory;
52: }
53:
54: public OWLReasoner getReasoner() {
55: return reasoner;
56: }
57:
58: /**
59: * Applies the specified changes to this ontology snapshot.
60: *
61: * @param changes The changes to apply
62: * @return The applied changes
63: */
64: public List<OWLOntologyChange> applyChanges(List<OWLOntologyChange> changes) {
65: final ChangeApplied result = ontologyManager.applyChanges(changes);
66:• if (result == ChangeApplied.UNSUCCESSFULLY) {
67: throw new OntologyChangeApplicationException(
68: "At least one of the following changes could not have been applied to this ontology snapshot: " +
69: changes);
70: }
71: return changes;
72: }
73: }