-
Notifications
You must be signed in to change notification settings - Fork 16
Semantic Object Query Language
Martin Ledvinka edited this page Dec 2, 2022
·
8 revisions
Since 0.14.0
The Semantic Object Query Language (SOQL) is an object query language analogous to JPQL (or HQL) designed for JOPA. Its main purpose is to simplify creation of queries over the object model managed by JOPA. SOQL queries are translated into SPARQL based on the metamodel and executed in a similar manner to the current support for SPARQL in JOPA.
The goal is to support as many features of JPQL as possible, but taking into account the specifics of SPARQL and ontologies.
-
SELECT
,DISTINCT
- Join by property path (
p.phone.number
) -
LIKE
,AND
,OR
,NOT
-
ORDER BY
,GROUP BY
-
COUNT
- on entity result, e.g.SELECT COUNT(p) FROM Person p
Simple examples:
SELECT p FROM Person p
SELECT p FROM Person p WHERE p.username = :username
SELECT p FROM Person p WHERE NOT p.role = :role
SELECT p FROM Person p WHERE p.username LIKE :username
SELECT p FROM Person p WHERE p.phone.number = :phoneNumber
SELECT p FROM Person p WHERE p.age > :age ORDER BY p.age DESC
See SoqlQueryParserTest
for more examples.
The following features are not implemented, yet:
- Parentheses in the
WHERE
clause -
ASK
,OPTIONAL
,IN
- Aggregation functions besides
count
(furthermore,count
works only for entities) - Complex joins
- Projection of multiple entities or entity attributes -> currently, only an entity (or its count) can be projected from the query
- Inner select