Skip to contentMethod: setStringQueryAttribute(String)
1: /**
2: * Copyright (C) 2022 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.Id;
18: import cz.cvut.kbss.jopa.model.annotations.OWLClass;
19: import cz.cvut.kbss.jopa.model.annotations.OWLDataProperty;
20: import cz.cvut.kbss.jopa.model.annotations.Sparql;
21:
22: import java.net.URI;
23:
24: @OWLClass(iri = Vocabulary.C_OwlClassWithQueryAttr)
25: public class OWLClassWithQueryAttr implements HasUri {
26:
27: private static final String QUERY = "SELECT ?str\n" +
28: "WHERE {?this <http://krizik.felk.cvut.cz/ontologies/jopa/attributes#B-stringAttribute> ?str . }";
29:
30: @Id
31: private URI uri;
32:
33: @OWLDataProperty(iri = "http://krizik.felk.cvut.cz/ontologies/jopa/attributes#B-stringAttribute",
34: simpleLiteral = true)
35: private String stringAttribute;
36:
37: @Sparql(query = QUERY)
38: private String stringQueryAttribute;
39:
40: public OWLClassWithQueryAttr() {
41: }
42:
43: public OWLClassWithQueryAttr(URI uri) {
44: this.uri = uri;
45: }
46:
47: public void setUri(URI uri) {
48: this.uri = uri;
49: }
50:
51: @Override
52: public URI getUri() {
53: return uri;
54: }
55:
56: public String getStringAttribute() {
57: return stringAttribute;
58: }
59:
60: public void setStringAttribute(String stringAttribute) {
61: this.stringAttribute = stringAttribute;
62: }
63:
64: public String getStringQueryAttribute() {
65: return stringQueryAttribute;
66: }
67:
68: public void setStringQueryAttribute(String stringQueryAttribute) {
69: this.stringQueryAttribute = stringQueryAttribute;
70: }
71:
72: public static String getSparqlQuery() {
73: return QUERY;
74: }
75:
76: @Override
77: public String toString() {
78: String out = "OWLClassWithQueryAttr: uri = " + uri;
79: out += ", stringAttribute = " + stringAttribute;
80: return out;
81: }
82: }