Skip to content

Package: JenaTypes

JenaTypes

nameinstructionbranchcomplexitylinemethod
JenaTypes(JenaAdapter, Procedure, Procedure)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
addTypes(NamedResource, URI, Set)
M: 0 C: 22
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
getTypes(NamedResource, URI, boolean)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
removeTypes(NamedResource, URI, Set)
M: 0 C: 22
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2020 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.jena;
16:
17: import cz.cvut.kbss.ontodriver.Types;
18: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
19: import cz.cvut.kbss.ontodriver.jena.util.Procedure;
20: import cz.cvut.kbss.ontodriver.model.Axiom;
21: import cz.cvut.kbss.ontodriver.model.NamedResource;
22:
23: import java.net.URI;
24: import java.util.Objects;
25: import java.util.Set;
26:
27: public class JenaTypes implements Types {
28:
29: private final Procedure beforeCallback;
30: private final Procedure afterCallback;
31:
32: private final JenaAdapter adapter;
33:
34: JenaTypes(JenaAdapter adapter, Procedure beforeCallback, Procedure afterCallback) {
35: this.beforeCallback = beforeCallback;
36: this.afterCallback = afterCallback;
37: this.adapter = adapter;
38: }
39:
40: @Override
41: public Set<Axiom<URI>> getTypes(NamedResource individual, URI context, boolean includeInferred)
42: throws OntoDriverException {
43: Objects.requireNonNull(individual);
44: beforeCallback.execute();
45: return adapter.typesHandler().getTypes(individual, context, includeInferred);
46: }
47:
48: @Override
49: public void addTypes(NamedResource individual, URI context, Set<URI> types) throws OntoDriverException {
50: Objects.requireNonNull(individual, "individual");
51: Objects.requireNonNull(types, "types");
52: beforeCallback.execute();
53: adapter.typesHandler().addTypes(individual, context, types);
54: afterCallback.execute();
55: }
56:
57: @Override
58: public void removeTypes(NamedResource individual, URI context, Set<URI> types) throws OntoDriverException {
59: Objects.requireNonNull(individual, "individual");
60: Objects.requireNonNull(types, "types");
61: beforeCallback.execute();
62: adapter.typesHandler().removeTypes(individual, context, types);
63: afterCallback.execute();
64: }
65: }