ALL COVERED TOPICS

NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter

NAVIGATE MAIN CATEGORIES

Close

Groovy: All content tagged as Groovy in NoSQL databases and polyglot persistence

Groovy User Defined Functions for Pig

After supporting UDFs in Python and Ruby and also embedding (embedding Pig scripts inside Python programs), now it’s time for Pig to accept Groovy UDFs. Nice.

Original title and link: Groovy User Defined Functions for Pig (NoSQL database©myNoSQL)

via: https://issues.apache.org/jira/browse/PIG-2763


Grails 2.0 and NoSQL

Graeme Rocher:

Grails 2.0 is the first release of Grails that truly abstracts the GORM layer so that new implementations of GORM can be used. […] The MongoDB plugin is at final release candidate stage and is based on the excellent Spring Data MongoDB project which is also available in RC form. […] Grails users can look forward to more exciting NoSQL announcements in 2012 with upcoming  future releases of GORM for Neo4j, Amazon SimpleDB and Cassandra in the works.

This is great news.

The very very big news would be a Grails version that doesn’t default anymore to using Hibernate for accessing a relational database.

Original title and link: Grails 2.0 and NoSQL (NoSQL database©myNoSQL)

via: http://blog.springsource.org/2011/12/15/grails-2-0-released/


Griffon and NoSQL Databases

Andres Almiray:

The following list enumerates all NoSQL options currently supported by Griffon via plugins:

  • BerkeleyDB
  • CouchDB
  • Memcached
  • Riak
  • Redis
  • Terrastore
  • Voldemort
  • Neo4j
  • Db4o
  • Neodatis

The first 7 are Key/Value stores. Neo4j is a Graph based database. The last two are object stores. All of them support multiple datasources, data bootstrap and a Java friendly API similar to the one shown earlier.

Griffon is a Groovy-based framework for developing desktop applications. While the coolness factor of Java-based desktop apps is close to zero, having some multi-platform management utilities for these NoSQL databases might be interesting.

Original title and link: Griffon and NoSQL Databases (NoSQL database©myNoSQL)

via: http://www.jroller.com/aalmiray/entry/griffon_to_sql_or_nosql


An Intro to Gremlin the Graph Traversal Language

A nice intro to Gremlin, the Groovy-based graph traversal language supporting Neo4j, OrientDB, DEX, RDF Sail, TinkerGraph, and ReXster:

Next thing you should do is take your favorite graph database and try out Gremlin.

Original title and link: An Intro to Gremlin the Graph Traversal Language (NoSQL database©myNoSQL)


Neo4j: Basic Example Using Groovy’s Sugar

Neo4j is basically a Java library with Java API, so it can always benefit from a bit of Groovy sugar.

Note: in case the embed doesn’t work, the original code can be found ☞ here

The “sugar” part is the metaClass code.


Node.metaClass {
  propertyMissing { String name, val -> delegate.setProperty(name, val) }
  propertyMissing { String name -> delegate.getProperty(name) }
  methodMissing { String name, args -> 
      delegate.createRelationshipTo(args[0], MyRelationshipTypes."$name") 
  }
}

Relationship.metaClass {
  propertyMissing { String name, val -> delegate.setProperty(name, val) }
  propertyMissing { String name -> delegate.getProperty(name) }
}

Original title and link: Neo4j: Basic Example Using Groovy’s Sugar (NoSQL databases © myNoSQL)


Tutorial: MongoDB in Java

Every time I realize the flurry of NoSQL activity in the dynamic languages space, I feel the urge to post about the status of NoSQL adoption and support in environments like C# and Java.

So, what solutions do you have if you are in the Java land wanting to use MongoDB?

Using MongoDB Java driver API

Lets start with a code snippet to get a feeling of the MongoDB Java driver:

To learn more about basic CRUD operations with MongoDB you can check ☞ this post, or ☞ this post, and/or the first 10 slides of James’ slides below:

Another good resource are the following slides from Brendan W. McAdams:

If using the Java driver feels too verbose, then I have some Groovy sugar for it.

MongoDB driver API with Groovy sugar

Same James Williams has ☞ a post on the how things can get a bit better when using Groovy and MongoDB.

GuiceyData: ProtocolBuffers-like mapping

In ☞ this post, Matt Insler talks about the complexity of using schemaless NoSQL databases and statically types languages.

One of the best things about MongoDB is the lack of an enforced schema for collections. […] All of that being said, working with these records in a language like Java and on large diverse teams of people who don’t want to open the database and inspect the records to see what values and sub-records are available, means that you will always spend time wrapping these records in a strong-typed class. Wrapping up loose data into classes that can both access and create that data sounds just like another project I’ve used recently.

and he comes out with a possible solution based on external data definitions:

The GuiceyData Generator is a quick and easy way to specify strongly typed data structures to be stored in a MongoDB database and mapped to wrappers and builders in Java.

As a side note, BSON is a typed serialization format, so the real problem is just type mapping.

GuiceyData source code can be found on ☞ GitHub and you can read more about it ☞ here.

Sculptor: DSL for code generation

Another code generator, based on an internal DSL is ☞ Sculptor.

Sculptor generates data mapper classes that converts domain objects to/from MongoDB data structures, DBObjects. This makes it easy to use a domain model à la DDD with automatic mapping to MongoDB data structures.

Sculptor provides generic repository operations for use with MongoDB. This includes operations such as save, delete, findById, findByKey, findByCondition, and some more. You get CRUD operations, and GUI, for free.

Sculptor 1.9.0 - Support for MongoDB

Morphia: JPA-like

A different approach is proposed by ☞ Morphia which feels closer to JPA.

According to the slidedeck below:

  • brings Hibernate/JPA paradigms to MongoDB
  • allows annotating of POJOs to make converting them between MongoDB and Java very easy
  • supports DAO abstractions
  • offers type-safe query support
  • compatible with GWT, Guice, Spring, and DI frameworks

A look at Morphia performance and possible optimizations can be found ☞ here.

GuiceyData vs Morphia vs Sculptor

If you have a hard time deciding which one should you pick, you’ll probably find ☞ this article resource useful.

With that I guess you should just get started. And if you have a preferred approach to using MongoDB in Java please share it with the rest of us!


Schemaless data modeling with Bigtable and Groovy's Gaelyk or Clojure

A short intro to NoSQL data modeling, an important topic for the NoSQL space, by ☞ Andrew Glover:

When developers talk about non-relational or NoSQL databases, the first thing often said is that they require a change in mindset. In my opinion, that actually depends upon your initial approach to data modeling. If you are accustomed to designing applications by modeling the database structure first (that is, you figure out tables and their associated relationships first), then data modeling with a schemaless datastore like Bigtable will require rethinking how you do things. If, however, you design your applications starting with the domain model, then Bigtable’s schemaless structure will feel more natural.

Somehow related you may also find interesting the Clojure DSL for Google App Engine by ☞ Stefan Richter:

Modeling your data structures for a distributed key-value store for large-scale internet applications differs in several key aspects from ER-modeling: Forget normalization, optimizing for read-access, etc. As a result, we believe that using object-oriented persistence mapping can cause a developer to incorrectly abstract object relationships: You should not have complex object relationships in your datastore. In addition, since Clojure is a functional programming language, it makes less sense to use a persistence mechanism rooted in object oriented practices. In Clojure you are using structs (maps) and not “objects” to hold your data, which means that you already have simple key-value structured data at hand. There’s no need to use object persistence mapping anyway. The most natural way is to use the low-level API to the datastore directly.

via: http://nosql.mypopescu.com/post/507962068/the-role-of-data-modeling-with-key-value-stores


A Groovy Way to Work with Neo4j

Groovy can really make things much more readable and nice:

The article shows a couple more tricks.

via: http://www.soderstrom.se/?p=81


REST up with CouchDB and Groovy's RESTClient

A burst of innovation in the open source world over the last few years has led to an increase in Java™ developer productivity. Freely available tools, frameworks, and solutions address once-common time sinks. A promising new entry on the scene is Apache CouchDB, hailed by some as the database for Web 2.0. The big picture of CouchDB is easy to grasp, and using it is as simple as using a Web browser. This Java development 2.0 column introduces CouchDB and shows you how Groovy’s RESTClient can help you tap into its strengths.

Source code for the article is available for download so you can play with it in minutes.

via: https://www.ibm.com/developerworks/java/library/j-javadev2-5/