intermine 0.98.04 → 0.98.05

Sign up to get free protection for your applications and to get access to all the features.
@@ -356,6 +356,17 @@ module InterMine::PathQuery
356
356
  return doc
357
357
  end
358
358
 
359
+ # Return true if the other query has exactly
360
+ # the same configuration, and belongs to the same
361
+ # service.
362
+ def eql?(other)
363
+ if other.is_a? Query
364
+ return self.service == other.service && self.to_xml_to_s == other.to_xml.to_s
365
+ else
366
+ return false
367
+ end
368
+ end
369
+
359
370
  # Get your own result reader for handling the results at a low level.
360
371
  # If no columns have been selected for output before requesting results,
361
372
  # all attribute columns will be selected.
@@ -498,11 +509,16 @@ module InterMine::PathQuery
498
509
  # Any columns ending in "*" will be interpreted as a request to add
499
510
  # all attribute columns from that table to the query
500
511
  #
512
+ # Any columns that name a class or reference will add the id of that
513
+ # object to the query. This is helpful for creating lists and other
514
+ # specialist services.
515
+ #
501
516
  # query = service.query("Gene")
502
517
  # query.add_views("*")
503
518
  # query.add_to_select("*")
504
519
  # query.add_views("proteins.*")
505
520
  # query.add_views("pathways.*", "organism.shortName")
521
+ # query.add_views("proteins", "exons")
506
522
  #
507
523
  def add_views(*views)
508
524
  views.flatten.map do |x|
@@ -514,6 +530,7 @@ module InterMine::PathQuery
514
530
  add_views(attrs)
515
531
  else
516
532
  path = InterMine::Metadata::Path.new(y, @model, subclasses)
533
+ path = InterMine::Metadata::Path.new(y.to_s + ".id", @model, subclasses) unless path.is_attribute?
517
534
  if @root.nil?
518
535
  @root = path.rootClass
519
536
  end
@@ -333,7 +333,7 @@ module InterMine::Results
333
333
 
334
334
 
335
335
  # Get the parameters for this request, given the specified format.
336
- def params(format)
336
+ def params(format="tab")
337
337
  p = @query.params.merge("start" => @start, "format" => format)
338
338
  p["size"] = @size unless @size.nil?
339
339
  return p
@@ -92,6 +92,7 @@ module InterMine
92
92
  extend Forwardable
93
93
 
94
94
  VERSION_PATH = "/version"
95
+ RELEASE_PATH = "/version/release"
95
96
  MODEL_PATH = "/model/json"
96
97
  TEMPLATES_PATH = "/templates"
97
98
  QUERY_RESULTS_PATH = "/query/results"
@@ -162,6 +163,11 @@ module InterMine
162
163
  @list_manager = InterMine::Lists::ListManager.new(self)
163
164
  end
164
165
 
166
+ # Return the release string
167
+ def release
168
+ return @release ||= fetch(@root + RELEASE_PATH)
169
+ end
170
+
165
171
  # call-seq:
166
172
  # model() => Model
167
173
  #
@@ -1,3 +1,3 @@
1
1
  module Intermine
2
- VERSION = "0.98.04"
2
+ VERSION = "0.98.05"
3
3
  end
@@ -3,7 +3,28 @@ require File.dirname(__FILE__) + "/test_helper.rb"
3
3
  require "test/unit"
4
4
  require "intermine/service"
5
5
 
6
- class LiveTest < Test::Unit::TestCase
6
+ class LiveDemoTest < Test::Unit::TestCase
7
+
8
+ def setup
9
+ @service = Service.new("http://localhost:8080/intermine-test")
10
+ end
11
+
12
+ def testVersion
13
+ assert(@service.version >= 6)
14
+ end
15
+
16
+ def testRelease
17
+ assert_match(/test/i, @service.release)
18
+ end
19
+
20
+ def testCount
21
+ assert_equal(7, @service.query("Company").count)
22
+ assert_equal(3, @service.query("Department").where(:name => "Sales").count)
23
+ end
24
+
25
+ end
26
+
27
+ class LiveFlyMineTest < Test::Unit::TestCase
7
28
 
8
29
  def setup
9
30
  @service = Service.new("www.flymine.org/query")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intermine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 415
4
+ hash: 413
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 98
9
- - 4
10
- version: 0.98.04
9
+ - 5
10
+ version: 0.98.05
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Kalderimis