aemadrid / orientdb-jruby

JRuby wrapper for OrientDB
http://rubygems.org/gems/orientdb
MIT License
48 stars 21 forks source link

OrientDB 2.0.3 Compatibility #19

Open nengine opened 9 years ago

nengine commented 9 years ago

Hi, OrientDB 2.0.3 was released not so long ago, but this seems to be for 1.7.8. Please let me know if there will be updates or I can just use this one?

aemadrid commented 9 years ago

I'm not currently using OrientDB so I'm not keeping up with the latest releases. Please submit a PR if you make the changes to make it work.

bougyman commented 9 years ago

Are any of the contributors on this project still using orientdb? Could we have an offline about why you stopped using it? We are just in the investigation phase and cannot find any ruby driver which is up to date with the latest 2.0.3.

amiracam commented 9 years ago

not a contributor , I am using it actively but with 1.7.16 i.e. so far for what I have used it the 1.7.8 seems to work, my guess is that if you include the jar in your packaging , things will work, of course you won't be able to exercise new features of 2.0.3, and I don't know if 2.0.3 has broken backward compatibility

OrientDB is now my go to DB, on occasion I have dropped off and used the straight Java api which is made so much less painful because of the magic of Jruby but the oriented-jruby current release has worked for almost everything I have needed.

aemadrid commented 9 years ago

Since I've changed jobs and the project I inherited was well on its way with PostgresQL I've had no need to keep using and maintaining this gem. I've received updates from other contributors before though and I'll gladly accept one for 2.0.3.

amiracam commented 9 years ago

Does anybody know what the api diffs are between 1.7.8 and 2.0.3?

Sent from my whatever

On Mar 2, 2015, at 5:59 PM, Adrian Madrid notifications@github.com wrote:

Since I've changed jobs and the project I inherited was well on its way with PostgresQL I've had no need to keep using and maintaining this gem. I've received updates from other contributors before though and I'll gladly accept one for 2.0.3.

— Reply to this email directly or view it on GitHub.

nengine commented 9 years ago

I have forked and updated 2.0.3 jar files. Did some SQL commands and works fine, but some of the specs are failing on index creation. For me, being able to execute SQL commands is pretty much what I needed. From my view, I don't think orientdb gem exposes all Orieent Java API, but may be a subset. For advance graph traversals I think pacer gem might be better.

require 'orientdb'
DB.run_command("CREATE CLASS Person Extends V")
DB.run_command("CREATE PROPERTY Person.name String")
DB.run_command("CREATE PROPERTY Person.age Integer")
DB.run_command("CREATE PROPERTY Person.dob Date")
amiracam commented 9 years ago

It definitely doesn't , passing the Sql commands is most of what I need, I don't use it as a graph db. Thanks for the fork.

Sent from my whatever

On Mar 3, 2015, at 7:30 AM, nengine notifications@github.com wrote:

I have forked and updated 2.0.3 jar files. Did some SQL commands and works fine, but some of the specs are failing on index creation. For me, being able to execute SQL commands is pretty much what I needed. From my view, I don't think orientdb gem exposes all Orieent Java API, but may be a subset. For advance graph traversals I think pacer gem might be better.

require 'orientdb' DB.run_command("CREATE CLASS Person Extends V") DB.run_command("CREATE PROPERTY Person.name String") DB.run_command("CREATE PROPERTY Person.age Integer") DB.run_command("CREATE PROPERTY Person.dob Date") — Reply to this email directly or view it on GitHub.

bougyman commented 9 years ago

I need the graph stuff myself and I can't find any successful way to add an edge.

[90] pry(main)> edge = database.add_edge('class:member_of', bob, org, 'member_of')
=> #<Java::ComTinkerpopBlueprintsImplsOrient::OrientEdge:0x4fa06f52>
[91] pry(main)> edge.save
=> nil
[92] pry(main)> database.commit
Java::ComOrientechnologiesOrientServerDistributed::ODistributedException: Quorum 2 not reached for request (id=49 from=xena task=tx userName=admin). Timeout=425ms Servers in timeout/conflict are:
 - zulu: com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #-1:-2 (cluster: null)
 - pzero: com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #-1:-2 (cluster: null)
Received: {xena=com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #-1:-2 (cluster: null), pzero=com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #-1:-2 (cluster: null), zulu=com.orientechnologies.orient.core.exception.ODatabaseException: Error on retrieving record #-1:-2 (cluster: null)}
from com.orientechnologies.orient.server.distributed.ODistributedResponseManager.manageConflicts(com/orientechnologies/orient/server/distributed/ODistributedResponseManager.java:576)

I get that every which way I try to add an edge.

bougyman commented 9 years ago

Even tried using run_command on a DocumentDatabase, similar non-results:

[22] pry(main)> res = DB.run_command("CREATE EDGE member_of from #12:4 to #14:1")
=> #<Java::JavaUtil::ArrayList:0x6e0ff644>
[23] pry(main)> res.first.record
=> #<OrientDB::Document:member_of:#15:-2 out:#<OrientDB::Document:Person:#12:4 name:"bob" email:"bob@bob.com"> in:#<OrientDB::Document:Organization:#14:1 name:"Division1" out_owns:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x241a53ef> out_member_of:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x344344fa> in_member_of:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x2db2cd5>>>
[24] pry(main)> res.first.save
=> #<OrientDB::Document:member_of:#15:-2 out:#<OrientDB::Document:Person:#12:4 name:"bob" email:"bob@bob.com"> in:#<OrientDB::Document:Organization:#14:1 name:"Division1" out_owns:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x241a53ef> out_member_of:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x344344fa> in_member_of:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x2db2cd5>>>
[25] pry(main)> res.first.record
=> #<OrientDB::Document:member_of:#15:-2 out:#<OrientDB::Document:Person:#12:4 name:"bob" email:"bob@bob.com"> in:#<OrientDB::Document:Organization:#14:1 name:"Division1" out_owns:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x241a53ef> out_member_of:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x344344fa> in_member_of:#<Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x2db2cd5>>>
[26] pry(main)> DB.commit
=> #<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x525d79f0>
[29] pry(main)> res.first.reload
Java::ComOrientechnologiesOrientCoreException::ORecordNotFoundException: The record with id '#15:-2' not found
from com.orientechnologies.orient.core.record.ORecordAbstract.reload(com/orientechnologies/orient/core/record/ORecordAbstract.java:266)
amiracam commented 9 years ago

What’s the Java api for adding an edge ?

Charles Monteiro

On Mar 4, 2015, at 4:09 PM, bougyman notifications@github.com wrote:

Even tried using run_command on a DocumentDatabase, similar non-results:

[22] pry(main)> res = DB.run_command("CREATE EDGE member_of from #12:4 to #14:1") => #Java::JavaUtil::ArrayList:0x6e0ff644 [23] pry(main)> res.first.record => #<OrientDB::Document:member_of:#15:-2 out:#<OrientDB::Document:Person:#12:4 name:"bob" email:"bob@bob.com"> in:#<OrientDB::Document:Organization:#14:1 name:"Division1" out_owns:# out_member_of:#Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x344344fa in_member_of:#Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x2db2cd5>> [24] pry(main)> res.first.save => #<OrientDB::Document:member_of:#15:-2 out:#<OrientDB::Document:Person:#12:4 name:"bob" email:"bob@bob.com"> in:#<OrientDB::Document:Organization:#14:1 name:"Division1" out_owns:# out_member_of:#Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x344344fa in_member_of:#Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x2db2cd5>> [25] pry(main)> res.first.record => #<OrientDB::Document:member_of:#15:-2 out:#<OrientDB::Document:Person:#12:4 name:"bob" email:"bob@bob.com"> in:#<OrientDB::Document:Organization:#14:1 name:"Division1" out_owns:# out_member_of:#Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x344344fa in_member_of:#Java::ComOrientechnologiesOrientCoreDbRecordRidbag::ORidBag:0x2db2cd5>> [26] pry(main)> DB.commit => #Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x525d79f0 [29] pry(main)> res.first.reload Java::ComOrientechnologiesOrientCoreException::ORecordNotFoundException: The record with id '#15:-2' not found from com.orientechnologies.orient.core.record.ORecordAbstract.reload(com/orientechnologies/orient/core/record/ORecordAbstract.java:266) — Reply to this email directly or view it on GitHub https://github.com/aemadrid/orientdb-jruby/issues/19#issuecomment-77247869.

bougyman commented 9 years ago
public OrientEdge addEdge(Object id,
                          Vertex outVertex,
                          Vertex inVertex,
                          String label)
Creates an edge between a source Vertex and a destination Vertex setting label as Edge's label.
Parameters:
id - Optional, can contains the Edge's class name by prefixing with "class:"
outVertex - Source vertex
inVertex - Destination vertex
label - Edge's label
Returns:
bougyman commented 9 years ago

That's from http://www.orientechnologies.com/javadoc/latest/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.html#addEdge-java.lang.Object-. When I tcpdump the proper things happen, and if I use a 'label' that is not an edge I get a different error:

[70] pry(main)> database = OrientDB::OrientGraph.new('remote:localhost/Corganizations', 'admin', 'admin')
=> #<Java::ComTinkerpopBlueprintsImplsOrient::OrientGraph:0x7daa61f3>
[71] pry(main)> bob = database.get_vertex('#12:4')
=> #<Java::ComTinkerpopBlueprintsImplsOrient::OrientVertex:0x78f9ed3e>
[72] pry(main)> corp = database.get_vertex('#14:1')
=> #<Java::ComTinkerpopBlueprintsImplsOrient::OrientVertex:0x24e8de5c>
[73] pry(main)> edge = database.add_edge(nil, bob, corp, 'dummy_edge')
Mar 04, 2015 5:04:01 PM com.orientechnologies.common.log.OLogManager log
WARNING: Requested command 'Committing the active transaction to create the new type 'dummy_edge' as subclass of 'E'. The transaction will be reopen right after that. To avoid this behavior create the classes outside the transaction' must be executed outside active transaction: the transaction will be committed and reopen right after it. To avoid this behavior execute it outside a transaction
Java::ComOrientechnologiesOrientServerDistributed::ODistributedException: Quorum 3 not reached for request (id=97 from=xena task=command_sql(create class dummy_edge extends E) userName=admin). Timeout=415ms Servers in timeout/conflict are:
 - zulu: com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional
 - pzero: com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional
Received: {xena=com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional, pzero=com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional, zulu=com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional}
from com.orientechnologies.orient.server.distributed.ODistributedResponseManager.manageConflicts(com/orientechnologies/orient/server/distributed/ODistributedResponseManager.java:576)
bougyman commented 9 years ago

Here's a realtime view of what I'm seeing, including the network traffic as I'm doing it. What else could help to troubleshoot this? http://bougyman.voidlinux.com/orient.html

amiracam commented 9 years ago

unfortunately I have not worked with the graph side of things but my first attempt would be to get clarification from the OrientDB google group as to what the meaning of this:

WARNING: Requested command 'Committing the active transaction to create the new type 'dummy_edge' as subclass of 'E'. The transaction will be reopen right after that. To avoid this behavior create the classes outside the transaction' must be executed outside active transaction: the transaction will be committed and reopen right after it. To avoid this behavior execute it outside a transaction Java::ComOrientechnologiesOrientServerDistributed::ODistributedException: Quorum 3 not reached for request (id=97 from=xena task=command_sql(create class dummy_edge extends E) userName=admin). Timeout=415ms Servers in timeout/conflict are:

it seems to me that this is not an issue with orientdb-jruby driver but rather its more an issue of how OrientDB is used

Charles Monteiro

On Mar 4, 2015, at 7:59 PM, bougyman notifications@github.com wrote:

Here's a realtime view of what I'm seeing, including the network traffic as I'm doing it. What else could help to troubleshoot this? http://bougyman.voidlinux.com/orient.html http://bougyman.voidlinux.com/orient.html — Reply to this email directly or view it on GitHub https://github.com/aemadrid/orientdb-jruby/issues/19#issuecomment-77285139.