Skip to content

Package: OWLClassA

OWLClassA

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