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: 12
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
ensureDataProperty(OWLDataPropertyExpression)
M: 6 C: 6
50%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
ensureDatatype(OWLDataRange)
M: 6 C: 16
73%
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: 12
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

Coverage

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