Skip to content

Package: ContextDefinition

ContextDefinition

nameinstructionbranchcomplexitylinemethod
ContextDefinition()
M: 0 C: 33
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 7
100%
M: 0 C: 1
100%
add(OWLEntity)
M: 0 C: 50
100%
M: 0 C: 10
100%
M: 0 C: 6
100%
M: 0 C: 11
100%
M: 0 C: 1
100%
addAxiom(OWLAxiom)
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
lambda$addAxiom$0(OWLEntity)
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%
parse()
M: 0 C: 24
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
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.owl2java;
19:
20: import cz.cvut.kbss.jopa.model.SequencesVocabulary;
21: import org.semanticweb.owlapi.model.*;
22:
23: import java.util.Arrays;
24: import java.util.HashSet;
25: import java.util.Set;
26: import java.util.TreeSet;
27:
28: class ContextDefinition {
29:
30: /**
31: * OWLEntities to skip
32: */
33: private static final Set<IRI> SKIPPED = new HashSet<>(
34: Arrays.asList(IRI.create(SequencesVocabulary.c_Collection), IRI.create(SequencesVocabulary.c_List),
35: IRI.create(SequencesVocabulary.c_OWLSimpleList),
36: IRI.create(SequencesVocabulary.c_OWLReferencedList)));
37:
38: final Set<OWLAxiom> axioms = new HashSet<>();
39: final Set<OWLClass> classes = new TreeSet<>();
40: final Set<OWLObjectProperty> objectProperties = new TreeSet<>();
41: final Set<OWLDataProperty> dataProperties = new TreeSet<>();
42: final Set<OWLAnnotationProperty> annotationProperties = new TreeSet<>();
43: final Set<OWLNamedIndividual> individuals = new TreeSet<>();
44:
45: IntegrityConstraintSet set;
46:
47: void parse() {
48: final IntegrityConstraintParser parser = new IntegrityConstraintParser();
49:• for (final OWLAxiom a : axioms) {
50: a.accept(parser);
51: }
52: this.set = parser.getClassIntegrityConstraintSet();
53: }
54:
55: void addAxiom(OWLAxiom axiom) {
56:• axiom.signature().filter(e -> !SKIPPED.contains(e.getIRI())).forEach(this::add);
57: axioms.add(axiom);
58: }
59:
60: void add(OWLEntity e) {
61:• if (e.isOWLClass()) {
62: classes.add(e.asOWLClass());
63:• } else if (e.isOWLObjectProperty()) {
64: objectProperties.add(e.asOWLObjectProperty());
65:• } else if (e.isOWLDataProperty()) {
66: dataProperties.add(e.asOWLDataProperty());
67:• } else if (e.isOWLAnnotationProperty()) {
68: annotationProperties.add(e.asOWLAnnotationProperty());
69:• } else if (e.isOWLNamedIndividual()) {
70: individuals.add(e.asOWLNamedIndividual());
71: }
72: }
73: }