Skip to content

Package: JenaProperties

JenaProperties

nameinstructionbranchcomplexitylinemethod
JenaProperties(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%
addProperties(NamedResource, URI, Map)
M: 0 C: 20
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
getProperties(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%
removeProperties(NamedResource, URI, Map)
M: 0 C: 20
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.Properties;
18: import cz.cvut.kbss.ontodriver.jena.exception.JenaDriverException;
19: import cz.cvut.kbss.ontodriver.jena.util.Procedure;
20: import cz.cvut.kbss.ontodriver.model.Assertion;
21: import cz.cvut.kbss.ontodriver.model.Axiom;
22: import cz.cvut.kbss.ontodriver.model.NamedResource;
23: import cz.cvut.kbss.ontodriver.model.Value;
24:
25: import java.net.URI;
26: import java.util.Collection;
27: import java.util.Map;
28: import java.util.Objects;
29: import java.util.Set;
30:
31: class JenaProperties implements Properties {
32:
33: private final JenaAdapter adapter;
34:
35: private final Procedure beforeCallback;
36: private final Procedure afterChangeCallback;
37:
38: JenaProperties(JenaAdapter adapter, Procedure beforeCallback, Procedure afterChangeCallback) {
39: this.adapter = adapter;
40: this.beforeCallback = beforeCallback;
41: this.afterChangeCallback = afterChangeCallback;
42: }
43:
44: @Override
45: public Collection<Axiom<?>> getProperties(NamedResource individual, URI context, boolean includeInferred)
46: throws JenaDriverException {
47: Objects.requireNonNull(individual);
48: beforeCallback.execute();
49: return adapter.propertiesHandler().getProperties(individual, context, includeInferred);
50: }
51:
52: @Override
53: public void addProperties(NamedResource individual, URI context, Map<Assertion, Set<Value<?>>> properties)
54: throws JenaDriverException {
55: Objects.requireNonNull(individual);
56: Objects.requireNonNull(properties);
57: beforeCallback.execute();
58: adapter.propertiesHandler().addProperties(individual, context, properties);
59: afterChangeCallback.execute();
60: }
61:
62: @Override
63: public void removeProperties(NamedResource individual, URI context, Map<Assertion, Set<Value<?>>> properties)
64: throws JenaDriverException {
65: Objects.requireNonNull(individual);
66: Objects.requireNonNull(properties);
67: beforeCallback.execute();
68: adapter.propertiesHandler().removeProperties(individual, context, properties);
69: afterChangeCallback.execute();
70: }
71: }