Skip to content

Package: MappingUtils

MappingUtils

nameinstructionbranchcomplexitylinemethod
MappingUtils()
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%
isClassAssertion(Axiom)
M: 0 C: 9
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
isEntityClass(Axiom, EntityType)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
isEntityClassAssertion(Axiom, EntityType)
M: 0 C: 11
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2024 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.oom;
19:
20: import cz.cvut.kbss.jopa.model.metamodel.EntityType;
21: import cz.cvut.kbss.ontodriver.model.Assertion.AssertionType;
22: import cz.cvut.kbss.ontodriver.model.Axiom;
23:
24: final class MappingUtils {
25:
26: private MappingUtils() {
27: throw new AssertionError();
28: }
29:
30: /**
31: * Checks whether the specified axioms is a class assertion for an instance
32: * of the specified entity type. </p>
33: *
34: * @param ax Axiom
35: * @param et Entity type
36: * @return True if the axioms asserts that an individual is of type
37: * represented by the entity type
38: */
39: static boolean isEntityClassAssertion(Axiom<?> ax, EntityType<?> et) {
40:• return isClassAssertion(ax) && isEntityClass(ax, et);
41: }
42:
43: /**
44: * Returns true if the specified axiom is a class assertion axiom.
45: *
46: * @param ax Axiom to check
47: * @return true if class assertion
48: */
49: static boolean isClassAssertion(Axiom<?> ax) {
50:• return ax.getAssertion().getType() == AssertionType.CLASS;
51: }
52:
53: private static boolean isEntityClass(Axiom<?> ax, EntityType<?> et) {
54: final String type = et.getIRI().toString();
55: final String val = ax.getValue().stringValue();
56: return val.equals(type);
57: }
58: }