Sha256: ce9a345f21f25421f6d9029cff0e7e8bbc5dd9c914afa3a718bd86b1cf39fdf8
Contents?: true
Size: 1.84 KB
Versions: 3
Compression:
Stored size: 1.84 KB
Contents
require 'awesome_print' require_relative "../lib/active-orient.rb" # Start server ActiveOrient::OrientDB.default_server= { user: 'root', password: 'tretretre' } # Select database r = ActiveOrient::OrientDB.new database: 'BigDataBastard' #r.delete_class "Document_Test" doc1 = r.create_class "DocumentTest" # Create Document/Vertex/Edge class doc2 = r.create_class "DocumentArrive_Test" ver1 = r.create_vertex_class "VertexTest" ver2 = r.create_vertex_class "VertexArriveTest" edg1 = r.create_edge_class "EdgeTest" ver1 = r.open_class "VertexTest" # Same as create_class par = r.get_documents from: "DocumentTest", where: {name: "Doc1"} # Get documents par = doc1.get_documents where: {name: "Doc1"} # Same as above ap par, :indent => -2 num = r.count_documents from: "DocumentTest", where: {name: "Doc1"} num2 = doc1.count where: {name: "Doc1"} print num2 r.create_or_update_document doc1, set: {familyname: "John"}, where: {name: "Doc1"} r.update_or_create_documents doc1, where: {name: "Doc1"}, set: {age: 91} doc1.update_or_create_documents where: {name: "Doc1"}, set: {age: 91} doc1.update_or_create_documents where: {name: "Doc2"}, set: {age: 91} par = doc1.get_documents where: {name: "Doc1"} #ap par, :indent => -2 print "#{par[0].attributes} \n" # Access attributes print "#{par[0].metadata} \n" # Access metadata r.delete_documents doc1, where: {name: "Doc2"} doc1.delete_documents where: {name: "Doc2"} a = r.get_document "32:0" # Get by RID r.patch_document "32:0" do {name: "is a test"} end r.update_documents doc1, set: {age: 191}, where: {name: "Doc1"} # Update a document doc1.update_documents set: {age: 191}, where: {name: "Doc1"} a = r.execute "Document_Test" do # To execute commands [{type: "cmd", language: 'sql', command: "SELECT * FROM Document_Test WHERE name = 'Doc1'"}] end print a a = r.classname doc1 a = doc1.classname print "\n #{a} \n"
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
active-orient-0.79 | examples/test_commands_2.rb~ |
active-orient-0.6 | examples/test_commands_2.rb~ |
active-orient-0.5 | examples/test_commands_2.rb~ |