Skip to content

Method: SoqlConstants.Functions()

1: /*
2: * JOPA
3: * Copyright (C) 2024 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.query.soql;
19:
20: /**
21: * Constants of the Semantic Object Query Language (SOQL).
22: */
23: public class SoqlConstants {
24:
25: /**
26: * {@code SELECT} keyword.
27: */
28: public static final String SELECT = "SELECT";
29:
30: /**
31: * {@code DISTINCT} operator.
32: */
33: public static final String DISTINCT = "DISTINCT";
34:
35: /**
36: * {@code FROM} keyword.
37: */
38: public static final String FROM = "FROM";
39:
40: /**
41: * {@code WHERE} keyword.
42: */
43: public static final String WHERE = "WHERE";
44:
45: /**
46: * {@code IN} operator.
47: */
48: public static final String IN = "IN";
49:
50: /**
51: * {@code MEMBER OF} operator.
52: */
53: public static final String MEMBER_OF = "MEMBER OF";
54:
55: /**
56: * {@code NOT} operator.
57: */
58: public static final String NOT = "NOT";
59:
60: /**
61: * {@code GROUP BY} statement.
62: */
63: public static final String GROUP_BY = "GROUP BY";
64:
65: /**
66: * {@code ORDER BY} statement.
67: */
68: public static final String ORDER_BY = "ORDER BY";
69:
70: /**
71: * {@code ASC} keyword.
72: */
73: public static final String ASC = "ASC";
74:
75: /**
76: * {@code DESC} keyword.
77: */
78: public static final String DESC = "DESC";
79:
80: /**
81: * SPARQL shortcut for {@code rdf:type} - {@code a}.
82: */
83: public static final String RDF_TYPE = "a";
84:
85: /**
86: * SOQL variable prefix.
87: * <p>
88: * Same as in JPQL.
89: */
90: public static final char VARIABLE_PREFIX = ':';
91:
92: /**
93: * Supported SOQL functions.
94: */
95: public static class Functions {
96:
97: /**
98: * Takes an argument string and transforms it to lower case.
99: */
100: public static final String LOWER = "LOWER";
101:
102: /**
103: * Takes an argument string and transforms it to upper case.
104: */
105: public static final String UPPER = "UPPER";
106:
107: /**
108: * Counts the number of elements.
109: */
110: public static final String COUNT = "COUNT";
111:
112: /**
113: * Returns the length of a string.
114: */
115: public static final String LENGTH = "LENGTH";
116:
117: /**
118: * Returns the absolute value of the argument.
119: */
120: public static final String ABS = "ABS";
121:
122: /**
123: * Returns the smallest number with no fractional part that is not less than the argument.
124: */
125: public static final String CEIL = "CEIL";
126:
127: /**
128: * Returns the largest number with no fractional part that is not greater than the argument.
129: */
130: public static final String FLOOR = "FLOOR";
131:
132: /**
133: * Returns language tag of a literal, if it has one. Returns an empty string if it has no language tag.
134: */
135: public static final String LANG = "LANG";
136:
137: private Functions() {
138: throw new AssertionError();
139: }
140: }
141:
142: private SoqlConstants() {
143: throw new AssertionError();
144: }
145: }