Home | Trees | Indices | Help |
|
---|
|
object --+ | Query --+ | Template
Templates are ways of saving queries and allowing others to run them simply. They are the main interface to querying in the webapp
example:
service = Service("http://www.flymine.org/query/service") template = service.get_template("Gene_Pathways") for row in template.results(A={"value":"eve"}): process_row(row) ...
A template is a subclass of query that comes predefined. They are typically retrieved from the webservice and run by specifying the values for their existing constraints. They are a concise and powerful way of running queries in the webapp.
Being subclasses of query, everything is true of them that is true of a query. They are just less work, as you don't have to design each one. Also, you can store your own templates in the web-app, and then access them as a private webservice method, from anywhere, making them a kind of query in the cloud - for this you will need to authenticate by providing log in details to the service.
The most significant difference is how constraint values are specified for each set of results.
See Also: Template.results
|
|||
|
|||
dict |
|
||
string |
|
||
Template |
|
||
intermine.webservice.ResultIterator |
|
||
list |
|
||
int |
|
||
Inherited from Inherited from |
|
|||
|
|||
Inherited from |
|
|||
editable_constraints Template.editable_constraints -> list(intermine.constraints.Constraint) |
|||
Inherited from Inherited from |
|
ConstructorInstantiation is identical that of queries. As with queries, these are best obtained from the intermine.webservice.Service factory methods.
|
Returns the query parameters needed for the webserviceTemplate.to_query_params() -> dict(string, string) Overrides the method of the same name in query to provide the parameters needed by the templates results service. These are slightly more complex:
|
Returns the path section pointing to the REST resourceTemplate.get_results_path() → str Internally, this just calls a constant property in intermine.service.Service This overrides the method of the same name in Query
|
Gets a template to runTemplate.get_adjusted_template(con_values) → Template When templates are run, they are first cloned, and their values are changed to those desired. This leaves the original template unchanged so it can be run again with different values. This method does the cloning and changing of constraint values
|
Get an iterator over result rowsThis method returns the same values with the same options as the method of the same name in Query (see intermine.query.Query). The main difference in in the arguments. The template result methods also accept a key-word pair set of arguments that are used to supply values to the editable constraints. eg: template.results( A = {"value": "eve"}, B = {"op": ">", "value": 5000} ) The keys should be codes for editable constraints (you can inspect these with Template.editable_constraints) and the values should be a dictionary of constraint properties to replace. You can replace the values for "op" (operator), "value", and "extra_value" and "values" in the case of ternary and multi constraints.
|
Get a list of result rowsThis method performs the same as the method of the same name in Query, and it shares the semantics of Template.results().
|
Return the total number of rows this template returnsObtain the number of rows a particular query will return, without having to fetch and parse all the actual data. This method makes a request to the server to report the count for the query, and is sugar for a results call.
|
|
editable_constraintsReturn the list of constraints you can editTemplate.editable_constraints -> list(intermine.constraints.Constraint) Templates have a concept of editable constraints, which is a way of hiding complexity from users. An underlying query may have five constraints, but only expose the one that is actually interesting. This property returns this subset of constraints that have the editable flag set to true.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Jul 28 14:59:29 2011 | http://epydoc.sourceforge.net |