Hi,
Apache Cassandra has the following abstract data model.
Keyspace: A List of Tables
Table: A Map of Rows
Row: A Map of Primitive Values.
In Java syntax:
SortedMap<RowKey, SortedMap<ColumnKey, ColumnValue>>
https://www.ebayinc.com/stories/blogs/tech/cassandra-data-modeling-best-practices-part-1/
<https://www.ebayinc.com/stories/blogs/tech/cassandra-data-modeling-best-practices-part-1/>
This structure can be processed with the proposed generalized
has()/values()/drop()/add() steps.
Here are some CQL queries and then their “Gremlin-esque” representation:
** I’m assuming R(tableName) is shorthand for T(tableName).values() ***
SELECT COUNT(*) FROM users;
g.R(‘users’).count()
SELECT max(points), COUNT(*) FROM users;
g.R(‘users’).union(values(‘points’).max(),count())
// we need some sort of branching-project() in TP4 to do this better
SELECT lastname FROM cycling.cyclist_name LIMIT 50000;
g.R(‘cycling.cyclist_name’).values(‘lastname’).limit(50000)
SELECT first_name, last_name FROM emp WHERE empID IN (105, 107, 104);
g.R(‘emp’).has(‘empID’,within(105,107,104)).values(‘first_name’,’last_name’)
// assuming values() with two or more arguments produces a
Map<String,Object> (where values().asMap() is valueMap())
SELECT * FROM playlists WHERE venue CONTAINS 'The Fillmore’;
g.R(‘playlists’).has(‘venue’,regex(‘*The Fillmore*’)).values()
// assuming values() with zero arguments produces a Map<String,Object>
SELECT sum(race_points) FROM cycling.cyclist_points WHERE id=e3b19ec4 AND
race_points > 7;
g.R(‘cycling.cyclist_points’).has(‘id’,’e3b19ec4’).has(‘race_points’,
gt(7)).values(‘race_points’).sum()
INSERT INTO cycling.cyclist_name (id, lastname, firstname) VALUES (c4b65263,
'RATTO', 'Rissella')
g.T(‘cycling.cyclist_name’).add().value(‘id’,’c4b65263’).value(‘lastname’,’RATTO’).value(‘firstname’,’Rissella’)
// assuming value() is property() … still looking for general terms
that are clear.
It seems pretty straightforward to support Cassandra in TP4. Cassandra is just
nested Collections w/ no “Linkables.”
Take care,
Marko.
http://rredux.com <http://rredux.com/>