Skip to content

Package: PropertiesHandler

PropertiesHandler

nameinstructionbranchcomplexitylinemethod
PropertiesHandler(OwlapiAdapter, OntologySnapshot)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
addProperties(NamedResource, Map)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getExplicitProperties(NamedResource)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getProperties(NamedResource, boolean)
M: 0 C: 10
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
getPropertiesIncludingInferred(NamedResource)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
removeProperties(NamedResource, Map)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2022 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;
16:
17: import cz.cvut.kbss.ontodriver.model.Assertion;
18: import cz.cvut.kbss.ontodriver.model.Axiom;
19: import cz.cvut.kbss.ontodriver.model.NamedResource;
20: import cz.cvut.kbss.ontodriver.model.Value;
21: import cz.cvut.kbss.ontodriver.owlapi.connector.OntologySnapshot;
22:
23: import java.util.Collection;
24: import java.util.Map;
25: import java.util.Set;
26:
27: class PropertiesHandler {
28:
29: private final OwlapiAdapter adapter;
30: private final OntologySnapshot snapshot;
31:
32: PropertiesHandler(OwlapiAdapter adapter, OntologySnapshot snapshot) {
33: this.adapter = adapter;
34: this.snapshot = snapshot;
35: }
36:
37: public Collection<Axiom<?>> getProperties(NamedResource subject, boolean includeInferred) {
38:• if (includeInferred) {
39: return getPropertiesIncludingInferred(subject);
40: } else {
41: return getExplicitProperties(subject);
42: }
43: }
44:
45: private Collection<Axiom<?>> getPropertiesIncludingInferred(NamedResource subject) {
46: return new InferredAxiomLoader(adapter, snapshot).loadPropertyAxioms(subject);
47: }
48:
49: private Collection<Axiom<?>> getExplicitProperties(NamedResource subject) {
50: return new ExplicitAxiomLoader(adapter, snapshot).loadPropertyAxioms(subject);
51: }
52:
53: public void addProperties(NamedResource subject, Map<Assertion, Set<Value<?>>> properties) {
54: new AxiomSaver(adapter, snapshot).persistAxioms(subject, properties);
55: }
56:
57: public void removeProperties(NamedResource subject, Map<Assertion, Set<Value<?>>> properties) {
58: new EpistemicAxiomRemover(adapter, snapshot).removeAxioms(subject, properties);
59: }
60: }