Package: MappingUtils
MappingUtils
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MappingUtils() |
|
|
|
|
|
||||||||||||||||||||
isClassAssertion(Axiom) |
|
|
|
|
|
||||||||||||||||||||
isEntityClass(Axiom, EntityType) |
|
|
|
|
|
||||||||||||||||||||
isEntityClassAssertion(Axiom, EntityType) |
|
|
|
|
|
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: }