dmill-bz / rexpro-php

Rexpro PHP client
Other
7 stars 3 forks source link

Option to use JSON instead of MSGPACK #7

Closed electricjones closed 10 years ago

electricjones commented 10 years ago

I have forked this repository. We are working on a database agnotstic ORM specifically for Graph Databases that is based on Laravel's Eloquent ORM, Schema, Migrations, and Query Builders. Truthfully, the only reason I forked it is so that I can allow the option of using JSON or MSGPACK protocols. Not everyone has the msgpack pecl extension installed.

Is it already possible to do this? Would you like to collaborate rather than for me to fork?

travib commented 10 years ago

I don't know if you ever figured it out, but if not, I built my own version, so I didn't have to use MsgPack. https://github.com/ConvergeSystems/Dolittle

electricjones commented 10 years ago

That is perfect. Thanks. I actually put the project on hold, but I'm getting back to it next week.

dmill-bz commented 10 years ago

Hey guys, oddly enough I haven't been warned about these messages so I'm very late to the party. I've been considering doing without msgPack as well as it's a bit of a hindrance. I threw it together quickly. I'm sorry it's taken so long, I would have done it quickly had I seen this before (but I get the email updates now so it should be good from now on) For Info, we use this on a regular basis in my company so just letting you know it's an active project. We will be adding TinkerPop3/Gremlin-server support soon

As for this update:

rexpro-php will use the pecl msgpack extention by default. But if it isn't installed on the system it will automatically revert to using JSON.

If you wish to force a specific serializer type you may do so like this:

$db = new Connection;
echo $db->getSerializer(); // will echo 'MSGPACK'
$db->setSerializer(Messages::SERIALIZER_JSON);
echo $db->getSerializer(); // will echo 'JSON'
// do something with $db Connection Object.

I've updated the documentation as well. You can simply pull the master. I will clean the code up and make adding future serializers easier. Though I'm wondering if it will be necessary as TinkerPop3 is around the corner and that will move everything around.

About the ORM project

Do you have an idea of the direction you're going to take with this? I'm especially curious about Schema handling given the nature of graph DBs. Overall it's going to be difficult because of gremlin being an imperative language. It makes handling scopes and the likes a real headache. I've tackled this myself (maybe in the wrong way) but today I have a working prototype of a graph - db agnostic - ActiveRecord/QueryBuilder abstraction layer on top of the Yii2 php framework. I unfortunately can't share the code but I'd be more than happy to participate in your venture if my schedule allows for it. At the very least I can give my insight.

On a related topic there have been talks in the various titan/gremlin mailing lists of the future possibility of being able to switch to Cypher from Gremlin and back. Maybe that's our savior right there, since Cypher is declarative, working on top of it would solve some of the headaches of working with gremlin. (Though Licensing might be an issue)

travib commented 10 years ago

My company will be releasing a DBAL/OGM implementation for Gremlin/Titan soon. I will update you. Thanks for the update. I wish I had seen it before I went and rewrote it. Great tool.

dmill-bz commented 10 years ago

Please do. I'm very interested :)

electricjones commented 10 years ago

I am working on an OGM based on Laravel's Eloquent. I should be pushing my initial commit in about a month. I would be interested in collaborating with some others instead of doing multiple things, if anyone is interested. I am glad to see some in the PHP community interested in Graph Databases. I feel it is the future as I talk about in this blog post. I've also given some basic notes on Phoenix graphs, which is the Eloquent OGM. I'd love feedback.

dmill-bz commented 10 years ago

Both of you have projects I'm keen to go through. It's interesting to see how others have tackled what I've been working on for a bit now. I'm unfamiliar with Lavarel's Eloquent but I'll try myself at it sometime soon to see what it's about.

As a status on my end and to be transparent. For the time being our Yii2 OGM extension is under proprietary licensing but that could eventually change. A lot of it depends on :

It is current missing Migrations and a more thought out Schema handling class but apart from that it's been fully functional for our needs. Besides we expect to have those done relatively quickly as we'll be needing them soon.

There's no real point going further into detail as the code in unavailable but it would have been really cool to have some fellow enthusiasts around when I was making it to get second opinions so I'm definitely up for lending a hand.

Btw @chrismichaels84 in your Pheonix graph blog post you have a link to an article on the difference between graph and SQL schemas but the link is broken. Do you know where I could find that article?

electricjones commented 10 years ago

@PommeVerte Thank you for letting me know about the broken link. OrientDB has changed their documentation. The page is a bit different, but here is the new link http://www.orientechnologies.com/docs/last/orientdb.wiki/Tutorial-Document-and-graph-model.html.

If I may ask, which databases do y'all use? Neo4j? Titan? Orient?

dmill-bz commented 10 years ago

Thanks for the link I'll have a read. We started out using Neo4j but have switched to Titan with a cassandra backend for several reasons, vertex centric indexes, graph limitation + partitioning, some replication reasons, faunus etc.. Loving it so far.

travib commented 10 years ago

We are using Titan.

On Sun, Aug 24, 2014 at 1:44 PM, PommeVerte notifications@github.com wrote:

Thanks for the link I'll have a read. We started out using Neo4j but have switched to Titan with a cassandra backend for several reasons, vertex centric indexes, graph limitation + partitioning, some replication reasons, faunus etc.. Loving it so far.

— Reply to this email directly or view it on GitHub https://github.com/PommeVerte/rexpro-php/issues/7#issuecomment-53201023.

dmill-bz commented 10 years ago

As extra info for both of you, the TP3 version of this driver is now available. Hopefully it will be of some use to you guys. I'm also looking into updating the TP3 documentation on making drivers as it's a little outdated and missing some information. https://github.com/PommeVerte/rexpro-php/tree/3.0