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