Skip to content

Package: Utils

Utils

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