Skip to content

Package: AbstractAxiomDescriptor

AbstractAxiomDescriptor

nameinstructionbranchcomplexitylinemethod
AbstractAxiomDescriptor(NamedResource)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
equals(Object)
M: 4 C: 15
79%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 2 C: 4
67%
M: 0 C: 1
100%
getSubject()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hashCode()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

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.ontodriver.descriptor;
19:
20: import cz.cvut.kbss.ontodriver.model.Assertion;
21: import cz.cvut.kbss.ontodriver.model.NamedResource;
22:
23: import java.net.URI;
24: import java.util.Objects;
25: import java.util.Set;
26:
27: /**
28: * Defines common API for axiom descriptors.
29: */
30: public abstract class AbstractAxiomDescriptor {
31:
32: private final NamedResource subject;
33:
34: protected AbstractAxiomDescriptor(NamedResource subject) {
35: this.subject = Objects.requireNonNull(subject);
36: }
37:
38: public NamedResource getSubject() {
39: return subject;
40: }
41:
42: /**
43: * Gets the set of assertions in this descriptor.
44: *
45: * @return Set of assertions
46: */
47: public abstract Set<Assertion> getAssertions();
48:
49: /**
50: * Checks whether this descriptor contains the specified assertion.
51: *
52: * @param assertion Assertion to look for
53: * @return {@code boolean} result
54: */
55: public abstract boolean containsAssertion(Assertion assertion);
56:
57: /**
58: * Gets the set of repository context identifiers in which this descriptor's subject may be.
59: * <p>
60: * The contract of this method is as follows: it must not return {@code null}, if the the subject is in the default
61: * context, an empty set is returned.
62: *
63: * @return Set of context identifiers
64: */
65: public abstract Set<URI> getSubjectContexts();
66:
67: /**
68: * Gets the set of repository context identifiers in which the specified assertion values may be.
69: * <p>
70: * If no context was explicitly set, the same contexts as the subject's are returned. An empty result indicates that
71: * the default context should be used.
72: *
73: * @return Set of context identifiers
74: */
75: public abstract Set<URI> getAssertionContexts(Assertion assertion);
76:
77: @Override
78: public boolean equals(Object o) {
79:• if (this == o) {
80: return true;
81: }
82:• if (!(o instanceof AbstractAxiomDescriptor)) {
83: return false;
84: }
85: AbstractAxiomDescriptor that = (AbstractAxiomDescriptor) o;
86: return subject.equals(that.subject);
87: }
88:
89: @Override
90: public int hashCode() {
91: return Objects.hash(subject);
92: }
93: }