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