Class: InterMine::PathQuery::Template
- Inherits:
-
Query
- Object
- Query
- InterMine::PathQuery::Template
show all
- Defined in:
- lib/intermine/query.rb
Constant Summary
Constants inherited
from Query
Query::HIGHEST_CODE, Query::LOWEST_CODE
Instance Attribute Summary collapse
Attributes inherited from Query
#constraints, #joins, #list_append_uri, #list_upload_uri, #logic, #model, #name, #root, #service, #sort_order, #title, #views
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Query
#add_constraint, #add_join, #add_prefix, #add_sort_order, #add_views, #all, #all_rows, #coded_constraints, #eql?, #first, #first_row, #get_constraint, #inspect, is_valid_code, #next_code, #outerjoin, #path, #remove_constraint, #results, #results_reader, #rows, #set_logic, #sortOrder=, #subclass_constraints, #subclasses, #to_s, #used_codes, #view=, #where
Constructor Details
#initialize(model, root = nil, service = nil) ⇒ Template
Returns a new instance of Template.
Instance Attribute Details
Returns the value of attribute comment.
1502
1503
1504
|
# File 'lib/intermine/query.rb', line 1502
def
@comment
end
|
#longDescription ⇒ Object
Returns the value of attribute longDescription.
1502
1503
1504
|
# File 'lib/intermine/query.rb', line 1502
def longDescription
@longDescription
end
|
Class Method Details
.parser(model) ⇒ Object
1510
1511
1512
|
# File 'lib/intermine/query.rb', line 1510
def self.parser(model)
return TemplateLoader.new(model)
end
|
Instance Method Details
#active_constraints ⇒ Object
1525
1526
1527
|
# File 'lib/intermine/query.rb', line 1525
def active_constraints
return coded_constraints.select {|con| con.switchable != "off"}
end
|
#clone ⇒ Object
1566
1567
1568
1569
1570
|
# File 'lib/intermine/query.rb', line 1566
def clone
other = super
other.instance_variable_set(:@constraints, @constraints.map {|c| c.clone})
return other
end
|
#count(params = {}) ⇒ Object
1561
1562
1563
1564
|
# File 'lib/intermine/query.rb', line 1561
def count(params = {})
runner = (params.empty?) ? self : get_adjusted(params)
runner.results_reader.get_size
end
|
#each_result(params = {}, start = 0, size = nil) ⇒ Object
1556
1557
1558
1559
|
# File 'lib/intermine/query.rb', line 1556
def each_result(params = {}, start=0, size=nil)
runner = (params.empty?) ? self : get_adjusted(params)
runner.results_reader(start, size).each_result {|r| yield r}
end
|
#each_row(params = {}, start = 0, size = nil) ⇒ Object
1551
1552
1553
1554
|
# File 'lib/intermine/query.rb', line 1551
def each_row(params = {}, start=0, size=nil)
runner = (params.empty?) ? self : get_adjusted(params)
runner.results_reader(start, size).each_row {|r| yield r}
end
|
#editable_constraints ⇒ Object
1521
1522
1523
|
# File 'lib/intermine/query.rb', line 1521
def editable_constraints
return coded_constraints.select {|con| con.editable}
end
|
#params ⇒ Object
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
|
# File 'lib/intermine/query.rb', line 1529
def params
p = {"name" => @name}
actives = active_constraints
actives.each_index do |idx|
con = actives[idx]
count = (idx + 1).to_s
p["constraint" + count] = con.path.to_s
p["op" + count] = con.template_param_op
if con.respond_to? :value
p["value" + count] = con.value
elsif con.respond_to? :values
p["value" + count] = con.values
elsif con.respond_to? :loopPath
p["loopPath" + count] = con.loopPath.to_s
end
if con.respond_to? :extra_value and !con..nil?
p["extra" + count] = con.
end
end
return p
end
|
#to_xml ⇒ Object
1514
1515
1516
1517
1518
1519
|
# File 'lib/intermine/query.rb', line 1514
def to_xml
doc = REXML::Document.new
t = doc.add_element 'template', {"name" => @name, "title" => @title, "longDescription" => @longDescription, "comment" => @comment}.reject {|k,v| v.nil?}
t.add_element super
return t
end
|