Skip to contentPackage: FieldResult
FieldResult
Coverage
1: /**
2: * Copyright (C) 2016 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.model.annotations;
16:
17: import java.lang.annotation.Retention;
18: import java.lang.annotation.RetentionPolicy;
19: import java.lang.annotation.Target;
20:
21: /**
22: * Used in conjunction with the {@link EntityResult} annotation to map columns specified in the SELECT list of a SPARQL
23: * query to the properties or fields of an entity class.
24: * <p>
25: * Example:
26: * <pre>
27: * <code>
28: * Query q = em.createNativeQuery(
29: * "SELECT ?x, ?quantity, ?item, ?label, ?description "+
30: * "WHERE {
31: * ?x a <http://onto.fel.cvut.cz/ontologies/jopa/Order> ;
32: * <http://onto.fel.cvut.cz/ontologies/ufo/has_part> ?item .
33: * ?item a <http://onto.fel.cvut.cz/ontologies/jopa/Order> ;
34: * rdfs:label ?label;
35: * rdfs:comment ?description .
36: * }", "OrderItemResults");
37: *
38: * {@literal @}SparqlResultSetMapping(name="OrderItemResults",
39: * entities={
40: * {@literal @}EntityResult(entityClass=cz.cvut.kbss.jopa.Order.class, fields = {
41: * {@literal @}FieldResult(name="uri", variable="x")
42: * }),
43: * {@literal @}EntityResult(entityClass=cz.cvut.kbss.jopa.Item.class)
44: * })
45: * </code>
46: * </pre>
47: *
48: * @see EntityResult
49: * @see SparqlResultSetMapping
50: */
51: @Target({})
52: @Retention(RetentionPolicy.RUNTIME)
53: public @interface FieldResult {
54:
55: /**
56: * Name of the persistent field or property of the class.
57: */
58: String name();
59:
60: /**
61: * Name of the variable in the SELECT clause.
62: */
63: String variable();
64: }