Skip to content

Package: OWLClassA

OWLClassA

nameinstructionbranchcomplexitylinemethod
OWLClassA()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
OWLClassA(URI)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
OWLClassA(URI, String)
M: 0 C: 23
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
equals(Object)
M: 2 C: 21
91%
M: 2 C: 4
67%
M: 2 C: 2
50%
M: 0 C: 4
100%
M: 0 C: 1
100%
getClassIri()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPersistenceContext()
M: 0 C: 10
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getStringAttribute()
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getStringField()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getTypes()
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getUri()
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: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setPersistenceContext(UnitOfWorkImpl)
M: 0 C: 11
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setStringAttribute(String)
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
setTypes(Set)
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
setUri(URI)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
toString()
M: 0 C: 71
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 5
100%
M: 0 C: 1
100%

Coverage

1:•/**
2: * Copyright (C) 2020 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.test;
16:
17: import cz.cvut.kbss.jopa.model.annotations.*;
18:
19: import java.lang.reflect.Field;
20: import java.net.URI;
21: import java.util.Objects;
22: import java.util.Set;
23:
24: @SparqlResultSetMappings({@SparqlResultSetMapping(name = OWLClassA.VARIABLE_MAPPING, variables = {
25: @VariableResult(name = "x", type = String.class),
26: @VariableResult(name = "y")
27: }), @SparqlResultSetMapping(name = OWLClassA.CONSTRUCTOR_MAPPING, classes = {
28: @ConstructorResult(targetClass = OWLClassA.class, variables = {
29: @VariableResult(name = "x"),
30: @VariableResult(name = "y", type = String.class)
31:
32: })
33: }), @SparqlResultSetMapping(name = OWLClassA.ENTITY_MAPPING, entities = {
34: @EntityResult(entityClass = OWLClassA.class, fields = {
35: @FieldResult(name = "uri", variable = "x")
36: })
37: })})
38: @NamedNativeQueries({@NamedNativeQuery(name = "OWLClassA.findAll",
39: query = "SELECT ?x WHERE {?x a <http://krizik.felk.cvut.cz/ontologies/jopa/entities#OWLClassA> . } ORDER BY ?x"),
40: @NamedNativeQuery(name = "OWLClassA.findByString", query = "SELECT ?x WHERE { ?x <" +
41: Vocabulary.P_A_STRING_ATTRIBUTE + "> ?str . }")
42: })
43: @OWLClass(iri = Vocabulary.C_OWL_CLASS_A)
44: public class OWLClassA {
45:
46: public static final String VARIABLE_MAPPING = "OWLClassA.testMapping";
47: public static final String CONSTRUCTOR_MAPPING = "OWLClassA.constructorMapping";
48: public static final String ENTITY_MAPPING = "OWLClassA.entityMapping";
49:
50: @Types(fetchType = FetchType.EAGER)
51: private Set<String> types;
52:
53: @Id
54: private URI uri;
55:
56: @OWLDataProperty(iri = Vocabulary.P_A_STRING_ATTRIBUTE)
57: private String stringAttribute;
58:
59: public OWLClassA() {
60: }
61:
62: public OWLClassA(URI uri) {
63: this.uri = uri;
64: }
65:
66: public OWLClassA(URI uri, String stringAttribute) {
67: this.uri = uri;
68: this.stringAttribute = stringAttribute;
69: }
70:
71: /**
72: * @param uri the uri to set
73: */
74: public void setUri(URI uri) {
75: this.uri = uri;
76: }
77:
78: /**
79: * @return the uri
80: */
81: public URI getUri() {
82: return uri;
83: }
84:
85: public void setStringAttribute(String stringAttribute) {
86: this.stringAttribute = stringAttribute;
87: }
88:
89: public String getStringAttribute() {
90: return stringAttribute;
91: }
92:
93: public void setTypes(Set<String> types) {
94: this.types = types;
95: }
96:
97: public Set<String> getTypes() {
98: return types;
99: }
100:
101: @Override
102: public boolean equals(Object o) {
103:• if (this == o) return true;
104:• if (o == null || getClass() != o.getClass()) return false;
105: OWLClassA owlClassA = (OWLClassA) o;
106: return Objects.equals(uri, owlClassA.uri);
107: }
108:
109: @Override
110: public int hashCode() {
111: return Objects.hash(uri);
112: }
113:
114: @Override
115: public String toString() {
116: String out = "OWLClassA: uri = " + uri;
117: out += ", stringAttribute = " + stringAttribute;
118:• if (types != null) {
119: out += ", types = {" + types.toString() + "}";
120: }
121: return out;
122: }
123:
124: public static String getClassIri() {
125: return OWLClassA.class.getDeclaredAnnotation(OWLClass.class).iri();
126: }
127:
128: public static Field getStringField() {
129: try {
130: return OWLClassA.class.getDeclaredField("stringAttribute");
131: } catch (NoSuchFieldException e) {
132: throw new RuntimeException(e);
133: }
134: }
135: }