Method: InterMine::PathQuery::Query#to_xml

Defined in:
lib/intermine/query.rb

#to_xmlObject

Return an XML document node representing the XML form of the query.

This is the canonical serialisable form of the query.



338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/intermine/query.rb', line 338

def to_xml
    doc = REXML::Document.new

    if @sort_order.empty?
        so = SortOrder.new(@views.first, "ASC")
    else
        so = @sort_order.join(" ")
    end

    query = doc.add_element("query", {
        "name" => @name, 
        "model" => @model.name, 
        "title" => @title, 
        "sortOrder" => so,
        "view" => @views.join(" "),
        "constraintLogic" => @logic
    }.delete_if { |k, v | !v })
    @joins.each { |join| 
        query.add_element("join", join.attrs) 
    }
    subclass_constraints.each { |con|
        query.add_element(con.to_elem) 
    }
    coded_constraints.each { |con|
        query.add_element(con.to_elem) 
    }
    return doc
end