Download - Let's talk about NoSQL Standard
![Page 2: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/2.jpg)
NoSQL
● Database● Doesn't use relationship● BASE● Five types
![Page 3: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/3.jpg)
Key Value
● AmazonDynamo● AmazonS3● Redis● Scalaris● Voldemort ● Couchbase
valuekey
valuekey
valuekey
![Page 4: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/4.jpg)
Document
● AmazonSimpleDb● ApacheCouchdb● MongoDb● Riak● Couchbase
![Page 5: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/5.jpg)
Column
● Hbase● Cassandra● Scylla● Clouddata● SimpleDb● DynamoDB
Row-key Columns...
Apollo
Aphrodite
Ares
SunDuty
{Love, happy}Duty
WarDuty
Swordweapon
Color
Kratos
Dead Gods13
![Page 6: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/6.jpg)
Graph
● Neo4j● InfoGrid● Sones● HyperGraphDB
Apollo Ares
Kratos
was dead was dead
Is brother
killed killed
![Page 7: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/7.jpg)
Multi-model
● OrientDB● Couchbase● Elasticsearch● Cassandra
![Page 8: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/8.jpg)
The Problem
![Page 9: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/9.jpg)
The Problem
![Page 10: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/10.jpg)
The Current solution
● Spring Data● Hibernate OGM● TopLink
![Page 11: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/11.jpg)
The Perfect Solution
● Abstraction API● Communication API● No lock-in● Split problems
![Page 12: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/12.jpg)
Apache Diana was Born (incubator)
● API Communication layer● Apache Project● Document, key-value, Column, Graph● Universal Adapter● Standard
![Page 13: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/13.jpg)
What Diana is not
● A new API to replace JPA● A new API to abstraction layer● Just one API communication to solve all kind of NoSQL
database● Be responsible to do integrations with other technologies such
as CDI, EJB, Bean Validation, Spring, etc.
![Page 14: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/14.jpg)
Diana Project
● Commons API● Document API● Graph API● Key-value API● Column API● Four TCKs
![Page 15: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/15.jpg)
Diana Project
![Page 16: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/16.jpg)
Why Diana?
● Goddess of the hunt, nature and moon
● Fought in Troy● brave warrior and hunter
![Page 17: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/17.jpg)
Road Map
● Draft and code Proposal● Community Feedback● Involve NoSQL Vendors● Involve Solution Vendors● Apache Project● Development● JSR
![Page 18: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/18.jpg)
Nomenclature
● Configuration● Factory● Manager● Entity● Value
![Page 19: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/19.jpg)
Value
Value value = Value.of("123");Integer integerValue = value.get(Integer.class);List<Integer> list = value.getList(Integer.class);Set<Integer> set = value.getSet(Integer.class);Stream<Integer> stream = value.getStream(Integer.class);String cast = value.cast();//unsafe
![Page 20: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/20.jpg)
Custom Value
public class MoneyWriter implements WriterField<Money, String> {
@Override public boolean isCompatible(Class clazz) { return false; }
@Override public String write(Money object) { return object.toString();
}}
public class MoneyReader implements ReaderField {
@Override public boolean isCompatible(Class clazz) { return Money.class.equals(clazz); }
@Override public <T> T read(Class<T> clazz, Object value) { return (T) Money.parse(value.toString()); }}
![Page 21: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/21.jpg)
Entities
Money money = new Money();Value value = Value.of(money);DocumentCollectionEntity entity = DocumentCollectionEntity.of("collection");entity.add(Document.of("name", "Daniel Soro"));entity.add(Document.of("age", 26));entity.add(Document.of("salary", money));
String name = entity.getName();List<Document> documents = entity.getDocuments();Optional<Document> age = entity.find("age");
![Page 22: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/22.jpg)
Entities
Money money = new Money();Value value = Value.of(money);DocumentCollectionEntity entity = DocumentCollectionEntity.of("collection");entity.add(Document.of("name", "Daniel Soro"));entity.add(Document.of("age", 26));entity.add(Document.of("salary", money));entity.add(Document.of("subdocument", Document.of("sub", Arrays.asList(1, 2, 3))));
String name = entity.getName();List<Document> documents = entity.getDocuments();Optional<Document> age = entity.find("age");
![Page 23: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/23.jpg)
EntitiesMoney money = new Money();Value value = Value.of(money);
ColumnFamilyEntity entity = ColumnFamilyEntity.of("family");Column id = Column.of("id", 10L);entity.add(id);entity.add(Column.of("version", 0.001));entity.add(Column.of("name", "Diana"));entity.add(Column.of("options", Arrays.asList(1, 2, 3)));entity.add(Column.of("pay", value));
String name = entity.getName();List<Column> columns = entity.getColumns();Optional<Column> notFound = entity.find("notFound");
![Page 24: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/24.jpg)
Entities
Value value = Value.of(new Money());KeyValue<String> keyValue = KeyValue.of("key", value);String key = keyValue.getKey();Value value1 = keyValue.getValue();
![Page 25: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/25.jpg)
Entities
Value value = Value.of(new Money());KeyValue<String> keyValue = KeyValue.of("key", value);String key = keyValue.getKey();Value value1 = keyValue.getValue();
![Page 26: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/26.jpg)
ManagerDocumentCollectionEntity entitySaved = collectionManager.save(entity);collectionManager.save(entity, TTL.ofHours(2));collectionManager.saveAsync(entity);collectionManager.saveAsync(entity, TTL.ofDays(3));collectionManager.saveAsync(entity, System.out::print);
DocumentQuery query = DocumentQuery.of("collection");Optional<Document> id = entitySaved.find("_id");query.addCondition(DocumentCondition.eq(id.get()));List<DocumentCollectionEntity> documentsFound = collectionManager.find(query);DocumentCollectionEntity document = collectionManager.findOne(query);
collectionManager.delete(query);collectionManager.deleteAsync(query);collectionManager.deleteAsync(query, System.out::print);
![Page 27: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/27.jpg)
Manager
columnEntityManager.save(entity);columnEntityManager.saveAsync(entity);columnEntityManager.saveAsync(entity, TTL.ofDays(3));columnEntityManager.saveAsync(entity, System.out::print);
ColumnQuery query = ColumnQuery.of("family");query.addCondition(ColumnCondition.eq(id));List<ColumnFamilyEntity> entities = columnEntityManager.find(query);ColumnFamilyEntity family = columnEntityManager.findOne(query);
columnEntityManager.delete(query);columnEntityManager.deleteAsync(query);columnEntityManager.deleteAsync(query, System.out::print);
![Page 28: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/28.jpg)
Manager
KeyValue<String> keyValue = KeyValue.of("myKey", Value.of("value"));bucket.put("key", "value");bucket.put(keyValue);bucket.put(keyValue, TTL.ofMicros(12));Optional<Value> value = bucket.get("key");
![Page 29: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/29.jpg)
Factory
BucketManager bucket = managerFactory.getBucketManager("bucket");List<String> list = managerFactory.getList("bucketList", String.class);Set<String> set = managerFactory.getSet("bucketSet", String.class);Map<String, Integer> map = managerFactory.getMap("bucketList", String.class, Integer.class);Queue<String> queue = managerFactory.getQueue("queueList", String.class);
![Page 30: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/30.jpg)
Factory
ColumnFamilyManager columnEntityManager = columnManagerFactory.getColumnEntityManager("space");DocumentCollectionManager collection = documentManagerFactory.getDocumentEntityManager("collection");
![Page 31: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/31.jpg)
Configuration
ColumnConfiguration columnConfiguration = new ColumnDriver();DocumentConfiguration documentConfiguration = new DocumentDriver();KeyValueConfiguration keyValueConfiguration = new KeyValueDriver();
ColumnFamilyManagerFactory columnFactory = columnConfiguration.getManagerFactory();DocumentCollectionManagerFactory documentFactory = documentConfiguration.getManagerFactory();BucketManagerFactory keyFactory = keyValueConfiguration.getManagerFactory();
![Page 32: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/32.jpg)
Native Query
columnEntityManager.nativeQueryAsync(query, System.out::println);List<ColumnFamilyEntity> entities = columnEntityManager.nativeQuery(query);PreparedStatement preparedStatement = columnEntityManager.nativeQueryPrepare(query);preparedStatement.bind(1,2,3);preparedStatement.executeQuery();preparedStatement.executeQueryAsync(System.out::println);
![Page 33: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/33.jpg)
Native Query
collectionManager.nativeQueryAsync(query, System.out::println);List<DocumentCollectionEntity> entities = collectionManager.nativeQuery(query);PreparedStatement preparedStatement = collectionManager.nativeQueryPrepare(query);preparedStatement.bind(1,2,3);preparedStatement.executeQuery();preparedStatement.executeQueryAsync(System.out::println);
![Page 34: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/34.jpg)
Diana Query Language
Select
select * from bucket;
select key1, key2 from bucket;
Insert
INSERT INTO bucket VALUES (key, value);
INSERT INTO bucket VALUES (key, value) ttl 20 (seconds, minutes, hours, days);
Delete
DELETE FROM bucket WHERE id =value;
![Page 35: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/35.jpg)
Diana Query Language
Insert
INSERT INTO collection (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
INSERT INTO collection (column1,column2,column3,...)
VALUES (value1,value2,value3,...) (value1,value2,value3,...);
INSERT INTO collection (column1,column2,column3,...)
VALUES (value1,value2,value3,...) ttl 20 (seconds, minutes, hours, days);
INSERT INTO collection (column1,column2,column3,...)
VALUES (value1,value2,value3,...) ttl 20 (seconds, minutes, hours, days) async;
![Page 36: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/36.jpg)
Diana Query Language
Select
select * from collection;
select field, field2 from collection;
select field, field2 from collection where id = 2;
select field, field2 from collection where id >= 2 or field >3;
Delete
DELETE FROM collection WHERE id =value;
DELETE field, field2 FROM collection WHERE id =value;
![Page 37: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/37.jpg)
Diana Query LanguageInsert
INSERT INTO family (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
INSERT INTO family (column1,column2,column3,...)
VALUES (value1,value2,value3,...) (value1,value2,value3,...);
INSERT INTO family (column1,column2,column3,...)
VALUES (value1,value2,value3,...) ttl 20 (seconds, minutes, hours, days);
INSERT INTO family (column1,column2,column3,...)
VALUES (value1,value2,value3,...) ttl 20 (seconds, minutes, hours, days) async;
![Page 38: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/38.jpg)
Diana Query Language
Select
select * from family;
select field, field2 from family;
select field, field2 from family where id = 2;
select field, field2 from family where id >= 2 and index >3;
Delete
DELETE FROM family WHERE id =value;
DELETE field, field2 FROM family WHERE id =value;
![Page 39: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/39.jpg)
Site
https://jnosql.github.io/diana-site/
![Page 41: Let's talk about NoSQL Standard](https://reader031.vdocuments.net/reader031/viewer/2022021814/58f010b21a28abc7678b45f1/html5/thumbnails/41.jpg)
Apache Proposal
https://wiki.apache.org/incubator/DianaProposal