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, Collection, 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: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.ontodriver.jena;
19:
20: import cz.cvut.kbss.ontodriver.Types;
21: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
22: import cz.cvut.kbss.ontodriver.jena.util.Procedure;
23: import cz.cvut.kbss.ontodriver.model.Axiom;
24: import cz.cvut.kbss.ontodriver.model.NamedResource;
25:
26: import java.net.URI;
27: import java.util.Collection;
28: import java.util.Objects;
29: import java.util.Set;
30:
31: public class JenaTypes implements Types {
32:
33: private final Procedure beforeCallback;
34: private final Procedure afterCallback;
35:
36: private final JenaAdapter adapter;
37:
38: JenaTypes(JenaAdapter adapter, Procedure beforeCallback, Procedure afterCallback) {
39: this.beforeCallback = beforeCallback;
40: this.afterCallback = afterCallback;
41: this.adapter = adapter;
42: }
43:
44: @Override
45: public Set<Axiom<URI>> getTypes(NamedResource individual, Collection<URI> contexts, boolean includeInferred)
46: throws OntoDriverException {
47: Objects.requireNonNull(individual);
48: beforeCallback.execute();
49: return adapter.typesHandler().getTypes(individual, contexts, includeInferred);
50: }
51:
52: @Override
53: public void addTypes(NamedResource individual, URI context, Set<URI> types) throws OntoDriverException {
54: Objects.requireNonNull(individual, "individual");
55: Objects.requireNonNull(types, "types");
56: beforeCallback.execute();
57: adapter.typesHandler().addTypes(individual, context, types);
58: afterCallback.execute();
59: }
60:
61: @Override
62: public void removeTypes(NamedResource individual, URI context, Set<URI> types) throws OntoDriverException {
63: Objects.requireNonNull(individual, "individual");
64: Objects.requireNonNull(types, "types");
65: beforeCallback.execute();
66: adapter.typesHandler().removeTypes(individual, context, types);
67: afterCallback.execute();
68: }
69: }