Skip to content

Package: Utils

Utils

nameinstructionbranchcomplexitylinemethod
Utils()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
ensureClass(OWLClassExpression)
M: 0 C: 18
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
ensureDataProperty(OWLDataPropertyExpression)
M: 12 C: 6
33%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
ensureDatatype(OWLDataRange)
M: 12 C: 22
65%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 1 C: 4
80%
M: 0 C: 1
100%
ensureObjectProperty(OWLObjectPropertyExpression)
M: 0 C: 18
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
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.jopa.owl2java;
16:
17: import cz.cvut.kbss.jopa.owl2java.exception.UnsupportedICException;
18: import org.semanticweb.owlapi.model.*;
19:
20: public class Utils {
21:
22: private Utils() {
23: throw new AssertionError();
24: }
25:
26: static OWLDatatype ensureDatatype(final OWLDataRange r) {
27:• if (!r.isOWLDatatype()) {
28: throw new UnsupportedICException("Data ranges not supported: " + r);
29: }
30:
31:• if (!r.asOWLDatatype().isBuiltIn()) {
32: throw new UnsupportedICException("Only built in datatypes are supported: " + r);
33: }
34: return r.asOWLDatatype();
35: }
36:
37: static OWLClass ensureClass(final OWLClassExpression r) {
38:• if (!r.isAnonymous()) {
39: return r.asOWLClass();
40: }
41: throw new UnsupportedICException("Only named classes are supported: " + r);
42: }
43:
44: static OWLDataProperty ensureDataProperty(final OWLDataPropertyExpression e) {
45:• if (e.isAnonymous()) {
46: throw new UnsupportedICException("Data property expressions not supported: " + e);
47: }
48: return e.asOWLDataProperty();
49: }
50:
51: static OWLObjectProperty ensureObjectProperty(final OWLObjectPropertyExpression e) {
52:• if (e.isAnonymous()) {
53: throw new UnsupportedICException("Object property expressions not supported: " + e);
54: }
55: return e.asOWLObjectProperty();
56: }
57: }