Sufficient Object Document Model?

36 views
Skip to first unread message

Marko A. Rodriguez

unread,
Feb 10, 2010, 9:14:12 PM2/10/10
to gremli...@googlegroups.com
Hi,

I'm thinking that an object document model in Blueprints will be very
easy. I'm thinking of making a Document just a Java Map (and thus, no
special interface). Thus, all there is only a Store.java interface:

http://github.com/tinkerpop/blueprints/blob/master/src/main/java/com/tinkerpop/blueprints/odm/Store.java

here is the implementation of Store.java for MongoDB:

http://github.com/tinkerpop/blueprints/blob/master/src/main/java/com/tinkerpop/blueprints/odm/impls/mongodb/MongoStore.java

The only thing missing is an Iterator<Map> getAll(Map document) for
queries that return more than one.

Am I stupid or is this sufficient? The CouchDB connector is nearly
identical (haven't built it yet though).

Beyond that--the only issue is that MongoDB supports collections---
therefore, do we allow only one collection per MongoStore instance...
Or make it so they can public void changeCollection(String collection)
(but thats NOT part of the Store.java interface).

Thoughts? If this is sufficient, betting this going in Blueprints is
relatively straightforward and moreover, getting Gremlin/(MongoDB/
CouchDB) going is very easy to do and, very natural to do given
Gremlins nice language support for lists and maps.

Take care,
Marko.

http://blueprints.tinkerpop.com
http://linkedprocess.org

Michael Hunger

unread,
Feb 11, 2010, 3:33:27 AM2/11/10
to Gremlin-users
I would not go for a map interface, because it is big and bloated.

Rather have something like your Element interface.
interface Document {
put(Object key, Object value);
Object get(Object key);
Iterable<Object> keys(); -> or have it implement Iterable<Object>
long keyCount();
}
and perhaps if want to support compatibility with Map a
Map toMap(); method

That would be more than enough and much easier for implementers.
So you can control your implementation and give nothing away.
Also you would have to care for all the mutating map functions and
take care if you want to provide a read only document.

Michael

On 11 Feb., 03:14, "Marko A. Rodriguez" <okramma...@gmail.com> wrote:
> Hi,
>
> I'm thinking that an object document model in Blueprints will be very  
> easy. I'm thinking of making a Document just a Java Map (and thus, no  
> special interface). Thus, all there is only a Store.java interface:
>

> http://github.com/tinkerpop/blueprints/blob/master/src/main/java/com/...


>
> here is the implementation of Store.java for MongoDB:
>

> http://github.com/tinkerpop/blueprints/blob/master/src/main/java/com/...

Marko A. Rodriguez

unread,
Feb 11, 2010, 12:06:55 PM2/11/10
to gremli...@googlegroups.com
Hi Michael,

This is what I was originally thinking---a simple Document interface
with barebones "map stuff" and iterator based. However, when I was
looking at the MongoDB and CouchDB APIs, their corresponding Document
objects either implement Map or extend HashMap. .... thus, it was
simple enough to just "return them."

> That would be more than enough and much easier for implementers.

This is true. ... So like Vertex/Edge, our blueprints.Document is just
a "wrapper"..?

> Also you would have to care for all the mutating map functions and
> take care if you want to provide a read only document.

Can you say more about this please---I don't understand this.

Thanks,
Marko.

http://blueprints.tinkerpop.com
http://markorodriguez.com

Marko A. Rodriguez

unread,
Feb 15, 2010, 6:39:14 PM2/15/10
to Gremlin-users
Reply all
Reply to author
Forward
0 new messages