Hi,
I used your example to calibrate the ruby-interface active-orient (and
could improve several things).
Have you set proper indexes to speed up the query?
Here is the Active-Orient-Solution (as always outlined as RSpec-Test) ....
all tests are passing.
49 context "Books Words example" , focus: true do
50 before(:all) do
51 @r.delete_class :book
52 Book = @r.create_vertex_class :book
53 Book.create_property( :title, type: :string, index: :unique )
54 @r.delete_class :word
55 Word= @r.create_vertex_class :word
56 Word.create_property( :item , type: :string, index: :unique )
57 @r.delete_class :has_content
58 HC= @r.create_edge_class :has_content
59
60 end
61 it "check structure" do
62 expect( @r.class_hierachie( base_class: 'V').sort ).to eq [Book.new
.classname, Word.new.classname]
63 expect( @r.class_hierachie( base_class: 'E') ).to eq [HC.new.
classname]
64 end
65
66 it "put test-content" do
67 fill_database = ->( sentence, this_book ) do
68 sentence.split(' ').each do |x|
69 this_word = Word.update_or_create where: { item: x }
70 this_edge = HC.create_edge from: this_book, to: this_word
71 end
72 end
73 words = 'Die Geschäfte in der Industrie im wichtigen
US-Bundesstaat New York sind im August so schlecht gelaufen wie seit mehr
als sechs Jahren nicht mehr Der entsprechende Empire-State-Index fiel
überraschend von plus Punkten im Juli auf minus 14,92 Zähler Dies teilte
die New Yorker Notenbank Fed heut mit Bei Werten im positiven Bereich
signalisiert das Barometer ein Wachstum Ökonomen hatten eigentlich mit
einem Anstieg auf 5,0 Punkte gerechnet'
74 this_book = Book.create title: 'first'
75 fill_database[ words, this_book ]
76 expect( Word.count ).to be > 10
77
78 words2 = 'Das Bruttoinlandsprodukt BIP in Japan ist im zweiten
Quartal mit einer aufs Jahr hochgerechneten Rate von Prozent geschrumpft Zu
Jahresbeginn war die nach den USA und China drittgrößte Volkswirtschaft der
Welt noch um Prozent gewachsen Der Schwächeanfall wird auch als Rückschlag
für Ministerpräsident Shinzo Abe gewertet der das Land mit einem Mix aus
billigem Geld und Konjunkturprogramm aus der Flaute bringen will Allerdings
wirkte sich die heutige Veröffentlichung auf die Märkten nur wenig aus da
Ökonomen mit einem schwächeren zweiten Quartal gerechnet hatten'
79 this_book = Book.create title: 'second'
80 fill_database[ words2, this_book ]
81 expect( Word.count ).to be > 100
82 end
83 it "Subquery Initialisation" do
84 query = OrientSupport::OrientQuery.new where: "out('HasContent').item
IN ['Quartal','Land']"
85 result= Book.query_database query
86 expect( result).to be_a Array
87 expect( result).to have_at_least(1).item
88 queried_book = result.first
89 expect( queried_book ).to be_a ActiveOrient::Model::Book
90 expect( queried_book.title ).to eq 'second'
91
92 end
93 end
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.