Skip to content

Package: CriteriaBuilder

CriteriaBuilder

Coverage

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.sessions;
16:
17: import cz.cvut.kbss.jopa.model.query.criteria.*;
18:
19: public interface CriteriaBuilder extends PredicateFactory {
20:
21:
22: /**
23: * Create a CriteriaQuery object with the specified result type.
24: * @param resultClass type of the query result
25: * @return criteria query object
26: */
27: <T> CriteriaQuery<T> createQuery(Class<T> resultClass);
28:
29: /**
30: * Create an aggregate expression applying the count operation.
31: * Return type of count function in SPARQL is xsd:integer which JOPA internally represents as Integer.
32: * @param x expression representing input value to count operation
33: * @return count expression
34: */
35: Expression<Integer> count(Expression<?> x);
36:
37: /**
38: * Create a parameter expression.
39: * @param paramClass - parameter class
40: * @return parameter expression
41: */
42: <T> ParameterExpression<T> parameter(Class<T> paramClass);
43:
44: /**
45: * Create a parameter expression with the given name.
46: * @param paramClass - parameter class
47: * @param name - name that can be used to refer to the parameter
48: * @return parameter expression
49: */
50: <T> ParameterExpression<T> parameter(Class<T> paramClass, String name);
51:
52: /**
53: * Create an expression for a literal.
54: *
55: * @param value - value represented by the expression
56: * @return expression literal
57: */
58: <T> Expression<T> literal(T value);
59:
60: /**
61: * Create an expression for a string literal with language tag.
62: * @param value - string value represented by the expression
63: * @param languageTag - string language tag
64: * @return expression literal
65: */
66: Expression<String> literal(String value, String languageTag);
67:
68: /**
69: * Create an ordering by the ascending value of the expression.
70: * @param x expression used to define the ordering
71: * @return ascending ordering corresponding to the expression
72: */
73: Order asc(Expression<?> x);
74:
75: /**
76: * Create an ordering by the descending value of the expression.
77: * @param x expression used to define the ordering
78: * @return descending ordering corresponding to the expression
79: */
80: Order desc(Expression<?> x);
81: }