libgraviton / gdk-java Goto Github PK
View Code? Open in Web Editor NEWGraviton Development Kit for Java
Graviton Development Kit for Java
Right now the only way to use RQL queries is to use the GravitonApi rest methods that take a Url as argument, for example
GravitonApi gravitonApi = new GravitonApi();
gravitonApi.get("https://graviton-base-url/person/customer/?eq(name,string:Herbert)&select(zip, city)").execute();
RQL support should be better integrated into the GDK that allows the user to rely on method instead of plain RQL syntax. Probably the easiest way to integrate the base RQL support, is to consider all set attributes in the POJO while linking them with the AND modifier. This might look like
GravitonApi gravitonApi = new GravitonApi();
Customer customer = new Customer();
customer.setName("Herbert");
customer.setAge(45);
gravitonApi.query(customer).execute();
Which would give us all customers with the name Herbert that have the age 45.
The next step would be to support selectors like limit and select. As a new part (maybe similar to the HeaderBag) of the Request.Builder this could look like
GravitonApi gravitonApi = new GravitonApi();
Customer customer = new Customer();
customer.setName("Herbert");
gravitonApi
.query(customer)
.setQuery(new Rql.Builder()
.setLimit(1)
.addSelect("zip")
.addSelect("city")
.build())
.execute();
With #12 RQL support was introduced for string and date fields.
Since the RQL syntax varies depending on the field type, integer and float and boolean are currently not supported, since they get treated as regular string fields.
Lets have a look at a typical query against a string field fieldname with the value value
?eq(fieldname,string:value)
In this case the string:
prefix is not required. It has the same result as
?eq(fieldname,value)
But lets look at another example (again a string field)
?eq(fieldname,string:20)
At this point the string:
prefix is required, since the Graviton RQL parser needs to know it's dealing with a string. Omitting string:
would lead to an empty result
On the other hand, if we look at an integer field
?eq(integerFieldName,string:20)
would lead to an empty result. In this case the query needs to look like
?eq(integerFieldName,20)
The part that needs changing is https://github.com/libgraviton/gdk-java/blob/develop/gdk-core/src/main/java/com/github/libgraviton/gdk/api/query/rql/Rql.java#L141 where currently every field is always treated as string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.