Eclipse JNoSQL Query API

A query project to Eclipse JNoSQL

License

License

GroupId

GroupId

org.jnosql.query
ArtifactId

ArtifactId

jnosql-query-api
Last Version

Last Version

0.0.7
Release Date

Release Date

Type

Type

jar
Description

Description

Eclipse JNoSQL Query API
A query project to Eclipse JNoSQL
Project URL

Project URL

http://jnosql.org/

Download jnosql-query-api

How to add to project

<!-- https://jarcasting.com/artifacts/org.jnosql.query/jnosql-query-api/ -->
<dependency>
    <groupId>org.jnosql.query</groupId>
    <artifactId>jnosql-query-api</artifactId>
    <version>0.0.7</version>
</dependency>
// https://jarcasting.com/artifacts/org.jnosql.query/jnosql-query-api/
implementation 'org.jnosql.query:jnosql-query-api:0.0.7'
// https://jarcasting.com/artifacts/org.jnosql.query/jnosql-query-api/
implementation ("org.jnosql.query:jnosql-query-api:0.0.7")
'org.jnosql.query:jnosql-query-api:jar:0.0.7'
<dependency org="org.jnosql.query" name="jnosql-query-api" rev="0.0.7">
  <artifact name="jnosql-query-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jnosql.query', module='jnosql-query-api', version='0.0.7')
)
libraryDependencies += "org.jnosql.query" % "jnosql-query-api" % "0.0.7"
[org.jnosql.query/jnosql-query-api "0.0.7"]

Dependencies

provided (4)

Group / Artifact Type Version
javax.json : javax.json-api jar 1.1.3
javax.json.bind : javax.json.bind-api jar 1.0
javax.annotation : javax.annotation-api jar 1.3.2
javax.enterprise : cdi-api jar 2.0.SP1

test (6)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter-engine jar 5.3.1
org.junit.jupiter : junit-jupiter-params jar 5.3.1
org.hamcrest : hamcrest-all jar 1.3
org.mockito : mockito-core jar 2.23.0
org.mockito : mockito-junit-jupiter jar 2.23.0
org.awaitility : awaitility jar 3.1.2

Project Modules

There are no modules declared in this project.

Per https://bugs.eclipse.org/bugs/show_bug.cgi?id=544301 This repo has been archived.

Eclipse JNoSQL Aphrodite Project

Eclipse JNoSQL Aphrodite

Eclipse JNoSQL Aphrodite is the project that contains the syntax query to JNoSQL API.

The general concepts about the statements:

  • All instructions end with a break like \n
  • It is case sensitive
  • All keywords must be in lowercase
  • The goal is to look like SQL, however simpler
  • The scope of this API is to key-value, column and document type, once Apache Tinkerpop already have one to Graph.
  • Even with this query, a specific implementation may not support an operation, condition, so on. E.g: Column family may not support query with equals operator in a different field that is not the key field.
  • The goal of the API is not about forgotten the specific behavior that there is in a particular database. These features matter, that's why there's an extensible API.

Column and Document

Select

The select statement reads one or more fields for one or more entities. It returns a result-set of the entities matching the request, where each entity contains the fields for corresponding to the query.

select_statement ::=  SELECT ( select_clause | '*' )
                      FROM entity_name
                      [ WHERE where_clause ]
                      [ SKIP (integer) ]
                      [ LIMIT (integer) ]
                      [ ORDER BY ordering_clause ]

Sample

select * from God
select  name, age ,adress.age from God order by name desc age desc
select  * from God where birthday between "01-09-1988" and "01-09-1988" and salary = 12
select  name, age ,adress.age from God skip 20 limit 10 order by name desc age desc

Insert

Inserting data for an entity is done using an INSERT statement:

insert_statement ::=  INSERT entity_name (name = value, (`,` name = value) *) [ TTL ]

Sample:

insert God (name = "Diana", age = 10)
insert God (name = "Diana", age = 10, power = {"sun", "god"})
insert God (name = "Diana", age = 10, power = {"sun", "god"}) 1 day

Update

Updating an entity is done using an UPDATE statement:

insert_statement ::=  UPDATE entity_name (name = value, (`,` name = value) *)

Sample:

update God (name = "Diana", age = 10)
update God (name = "Diana", age = 10, power = {"hunt", "moon"})

Delete

Deleting either an entity or fields uses the DELETE statement

delete_statement ::=  DELETE [ simple_selection ( ',' simple_selection ) ]
                      FROM entity_name
                      WHERE where_clause

Sample:

delete from God
delete  name, age ,adress.age from God

Key-value

GET

Retrieving data for an entity is done using an GET statement:

get_statement ::=  GET ID (',' ID)*

Sample:

get "Diana" "Artemis"
get "Apollo"

PUT

To either insert or overrides values from a key-value database use the PUT statement.

put_statement ::=  PUT {KEY, VALUE, [TTL]} (',' {KEY, VALUE [TTL]})*

Sample:

put {"Diana" ,  "The goddess of hunt", 10 second}
put {"Diana" ,  "The goddess of hunt"}
put {"Diana" ,  "The goddess of hunt", 10 second}, {"Aphrodite" ,  "The goddess of love"}

REMOVE

To delete one or more entities use the REMOVE statement

del_statement ::=  GET ID (',' ID)*

Sample:

remove "Diana" "Artemis"
remove "Apollo"

WHERE

The WHERE clause specifies a filter to the result. These filters are booleans operations that are composed of one or more conditions appended with the and (AND) and or (OR) operators.

Conditions

Condition performs different computations or actions depending on whether a boolean query condition evaluates to true or false. The conditions are composed of three elements:

  1. Name, the data source or target, to apply the operator
  2. Operator, that defines comparing process between the name and the value.
  3. Value, that data that receives the operation.

Operators

The Operators are:

Operator Description
= Equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
BETWEEN TRUE if the operand is within the range of comparisons
NOT Displays a record if the condition(s) is NOT TRUE
AND TRUE if all the conditions separated by AND is TRUE
OR TRUE if any of the conditions separated by OR is TRUE
LIKE TRUE if the operand matches a pattern
IN TRUE if the operand is equal to one of a list of expressions

The value

The value is the last element in a condition, and it defines what it 'll go to be used, with an operator, in a field target.

There are six types:

  • number is a mathematical object used to count, measure and also label where if it is a decimal, will become double, otherwise, long. E.g.: age = 20, salary = 12.12
  • string one or more characters: among two double quotes ". E.g.: name = "Ada Lovelace"
  • Convert: convert is a function where given the first value parameter, as number or string, it will convert to the class type of the second one. E.g.: birthday = convert("03-01-1988", java.time.LocalDate)
  • parameter: the parameter is a dynamic value, which means, it does not define the query, it'll replace in the execution time. The parameter is at @ followed by a name. E.g.: age = @age
  • array: A sequence of elements that can be either number or string that is between braces { }. E.g.: power = {"Sun", "hunt"}
  • json: JavaScript Object Notation is a lightweight data-interchange format. E.g.: siblings = {"apollo": "brother", "zeus": "father"}

SKIP

The SKIP option to a SELECT statement defines where the query should start,

LIMIT

The LIMIT option to a SELECT statement limits the number of rows returned by a query,

ORDER BY

The ORDER BY clause allows selecting the order of the returned results. It takes as argument a list of column names along with the order for the column (ASC for ascendant and DESC for the descendant, omitting the order being equivalent to ASC).

TTL

Both the INSERT and PUT commands support setting a time for data in an entity to expire. It defines the time to live of an object that is composed of the integer value and then the unit that might be day, hour, minute, second, millisecond, nanosecond. E.g.: ttl 10 second

org.jnosql.query

JNoSQL

The JNoSQL is a framework whose has the goal to help Java developers to create Java EE applications with NoSQL, whereby they can make scalable application.

Versions

Version
0.0.7
0.0.6