Class: Query
Defined in: | src/query.coffee |
Constant Summary
- JOIN_STYLES =
-
['INNER', 'OUTER']
- BIO_FORMATS =
-
['gff3', 'fasta', 'bed']
- NULL_OPS =
-
['IS NULL', 'IS NOT NULL']
- ATTRIBUTE_VALUE_OPS =
-
["=", "!=", ">", ">=", "<", "<=", "CONTAINS", "LIKE", "NOT LIKE"]
- MULTIVALUE_OPS =
-
['ONE OF', 'NONE OF']
- TERNARY_OPS =
-
['LOOKUP']
- LOOP_OPS =
-
['=', '!=']
- LIST_OPS =
-
['IN', 'NOT IN']
- OP_DICT =
-
{ '=': '=', '==': '==', 'eq': '=', 'eqq': '==', '!=': '!=', 'ne': '!=', '>': '>', 'gt': '>', '>=': '>=', 'ge': '>=', '<': '<', 'lt': '<', '<=': '<=', 'le': '<=', 'contains': 'CONTAINS', 'CONTAINS': 'CONTAINS', 'does not contain': 'DOES NOT CONTAIN', 'DOES NOT CONTAIN': 'DOES NOT CONTAIN', 'like': 'LIKE', 'LIKE': 'LIKE', 'not like': 'NOT LIKE', 'NOT LIKE': 'NOT LIKE', 'lookup': 'LOOKUP', 'IS NULL': 'IS NULL', 'is null': 'IS NULL', 'IS NOT NULL': 'IS NOT NULL', 'is not null': 'IS NOT NULL', 'ONE OF': 'ONE OF', 'one of': 'ONE OF', 'NONE OF': 'NONE OF', 'none of': 'NONE OF', 'in': 'IN', 'not in': 'NOT IN', 'IN': 'IN', 'NOT IN': 'NOT IN', 'WITHIN': 'WITHIN', 'within': 'WITHIN', 'OVERLAPS': 'OVERLAPS', 'overlaps': 'OVERLAPS', 'DOES NOT OVERLAP': 'DOES NOT OVERLAP', 'does not overlap': 'DOES NOT OVERLAP', 'OUTSIDE': 'OUTSIDE', 'outside': 'OUTSIDE', 'ISA': 'ISA', 'isa': 'ISA' }
Class Method Summary
- + (Object) fromXML(xml) Load the first query found in the XML.
Instance Method Summary
- - (Query) on(events, callback, context) Bind a callback to an event.
- - (void) bind(args...) alias for #on
- - (void) off(events, callback, context) Remove a particular event handler, or a more general collection.
- - (void) unbind(args...) alias for #off
- - (Query) once(events, callback, context) Bind an event to be executed once, and then unbound.
- - (void) emit(args...) Alias for #trigger
- - (Query) trigger(events, rest...) Trigger a given set of events.
- - (void) constructor(properties, service, undefined = {}) Constructor Construct a new Query object from a set of properties.
- - (Query) removeFromSelect(unwanted = []) Remove the given paths from the select list.
- - (void) removeConstraint(con, silent = false)
- - (void) addToSelect(views = []) Add an element to the select list.
- - (void) select(views) Bound Replace the existing select list with the one passed as an argument.
- - (void) adjustPath(path) Bound Interpret an argument as resolve the canonical path it refers to.
- - (void) getPossiblePaths(depth = 3)
- - (void) getPathInfo(path)
- - (void) getSubclasses()
- - (void) getType(path) Get the type of a path.
- - (void) getViewNodes() Get all the nodes present in the view.
- - (void) isInView(path) Check to see whether a path is in the view.
- - (?) isConstrained(path, includeAttrs = false) Check to see whether a path is constrained to a value.
- - (void) canHaveMultipleValues(path) Return true is the path passed as an argument could possibly represent multiple values (this is true when any of the nodes that the path descends from represents a collection of values.
- - (void) getQueryNodes() Get all the nodes present to the query, whether they are in the views, or the constraints.
- - (void) isInQuery(p)
- - (void) isRelevant(path)
- - (void) expandStar(path) Bound Interpret a path that might end in '' or '*' as the set of default paths it represent.
- - (void) isOuterJoin(p)
- - (void) hasView(v)
- - (Promise<Number>) count(cont) Get a promise to yield a count.
- - (void) appendToList(target, cb) Add the results of this query to a list on the server.
- - (Query) selectPreservingImpliedConstraints(paths = []) Get a clone of this query with the given paths selected.
- - (Query) makeListQuery() Get a clone of this query that can be used for list operations.
- - (void) saveAsList(options, cb)
- - (Promise<Array<Object>, Object>) summarise(path, limit, cont) Get a summary for a single column in the results.
- - (Promise<Array<Object>, Object>) summarize(args...) Get a summary for a single column in the results.
- - (Promise<Array<Object>, Object>) filterSummary(path, term, limit, cont = (function() {})) Get a summary for a single column in the results, filtered by a given value.
- - (Query) clone(cloneEvents) Get an unconnected, deep clone of this query.
- - (Query) next() Get the query for the next page of results.
- - (Query) previous() Get the query for the previous page of results.
- - (void) getSortDirection(sorted)
- - (void) isOuterJoined(path)
- - (void) getOuterJoin(path)
- - (void) _parse_sort_order(input)
- - (void) addOrSetSortOrder(so)
- - (void) addSortOrder(so)
- - (void) orderBy(oes)
- - (void) addJoins(joins)
- - (void) addJoin(join)
- - (void) setJoinStyle(path, style = 'OUTER')
- - (void) addConstraints(constraints)
- - (void) addConstraint(constraint) Bound
- - (void) getSorting()
- - (void) getConstraintXML()
- - (void) getJoinXML()
- - (void) toXML()
- - (void) toJSON()
- - (void) fetchCode(lang, cb)
- - (void) setName(name)
- - (void) save(name, cb) Save a query to the server, overwriting any query of the same name.
- - (void) store(name, cb) Store this query for the first time, avoiding name collisions.
- - (void) saveAsTemplate(name, cb)
- - (void) getCodeURI(lang)
- - (void) getExportURI(format = 'tab', options = {})
- - (Boolean) needsAuthentication() Return true if this query will require user authentication to run correctly.
- - (Promise<int>) fetchQID(cb) Get a query id for referencing this query in subsequent requests.
- - (void) __bio_req(types, n)
- - (void) _fasta_req()
- - (void) _gff3_req()
Class Method Details
+ (Object) fromXML(xml)
Load the first query found in the XML.
to `new Query(json)`.
Constructor Details
- (void) constructor(properties, service, undefined = {})
Construct a new Query object from a set of properties.
All options are optional. Alternative names permitted are separated by bars.
to be used for given paths.
when expanding `*` paths.
paths to use to determine the sort-order.
Instance Method Details
- (Query) on(events, callback, context)
Bind a callback to an event.
An implementation of the EventEmitter API, allowing clients to subscribe to events on Querys.
- (void) bind(args...)
alias for #on
- (Query) off()
- (Query) off(events)
- (Query) off(events, handler)
- (Query) off(events, handler, context)
Remove a particular event handler, or a more general collection.
- (void) unbind(args...)
alias for #off
- (Query) once(events, callback, context)
Bind an event to be executed once, and then unbound.
- (void) emit(args...)
Alias for #trigger
- (Query) trigger(events, rest...)
Trigger a given set of events.
- (Query) removeFromSelect(unwanted = [])
Remove the given paths from the select list.
list of selected columns.
- (void) removeConstraint(con, silent = false)
- (void) addToSelect(views = [])
Add an element to the select list.
- (void) select(views) (bound)
Replace the existing select list with the one passed as an argument.
- (void) adjustPath(path) (bound)
Interpret an argument as resolve the canonical path it refers to. For example, if the root of this query is known, then this method will check that the path has the same root, and add it if it is absent.
- (void) getPossiblePaths(depth = 3)
- (void) getPathInfo(path)
- (void) getSubclasses()
- (void) getType(path)
Get the type of a path.
- (void) getViewNodes()
Get all the nodes present in the view. A node is defined as the PathInfo object representing the class or reference that the attributes selected in the view belong to.
- (void) isInView(path)
Check to see whether a path is in the view. This method responds correctly whether the argument is a full path string, a headless path string, or a PathInfo object. If the path represents an attribute path then it is a simple index look up of the view. If the argument represents a reference path, then this method returns true if any of the views descends from that path.
- (?) isConstrained(path, includeAttrs = false)
Check to see whether a path is constrained to a value. If the includeAttrs parameter is true, then this method will return true if any of the attributes of the class referenced by this path are constrained to a value. Type constraints are not considered in this analysis.
- (void) canHaveMultipleValues(path)
Return true is the path passed as an argument could possibly represent multiple values (this is true when any of the nodes that the path descends from represents a collection of values.
- (void) getQueryNodes()
Get all the nodes present to the query, whether they are in the views, or the constraints.
- (void) isInQuery(p)
- (void) isRelevant(path)
- (void) expandStar(path) (bound)
Interpret a path that might end in '' or '*' as the set of default paths it represent.
- (void) isOuterJoin(p)
- (void) hasView(v)
- (Promise<Number>) count(cont)
Get a promise to yield a count.
- (void) appendToList(target, cb)
Add the results of this query to a list on the server.
@returns [Promise] A promise to yield the updated list information.
- (Query) selectPreservingImpliedConstraints(paths = [])
Get a clone of this query with the given paths selected.
The clone may have constraints added to it to preserve the implied constraints that result from the default inner-join status of paths.
We ensure we aren't changing the query by removing implicit join constraints; these implicit constraints are replaced with explicit constraints. This only works with joins on objects that have ids; you will have to handle simple objects yourself.
- (Query) makeListQuery()
Get a clone of this query that can be used for list operations.
A suitable query will have a single item in its select list, and that will refer to an object id. The cloned query is guaranteed to not include elements that would otherwise be excluded by implied inner joins on deleted view paths.
- (void) saveAsList(options, cb)
- (Promise<Array<Object>, Object>) summarise(path, limit, cont)
Get a summary for a single column in the results.
A summary consists of rows of summary information, and a statistics object, which always includes a uniqueValues property, which is the number of different values in the column.
- (Promise<Array<Object>, Object>) summarize(args...)
Get a summary for a single column in the results.
A summary consists of rows of summary information, and a statistics object, which always includes a uniqueValues property, which is the number of different values in the column.
- (Promise<Array<Object>, Object>) filterSummary(path, term, limit, cont = (function() {}))
Get a summary for a single column in the results, filtered by a given value.
A summary consists of rows of summary information, and a statistics object, which always includes a uniqueValues property, which is the number of different values in the column.
This method also allows the caller to have the server return only items which match the given filter.
- (Query) clone(cloneEvents)
Get an unconnected, deep clone of this query.
Any changes to the clone will not affect the original query.
will also be cloned.
- (Query) next()
Get the query for the next page of results.
- (Query) previous()
Get the query for the previous page of results.
- (void) getSortDirection(sorted)
- (void) isOuterJoined(path)
- (void) getOuterJoin(path)
- (void) _parse_sort_order(input)
- (void) addOrSetSortOrder(so)
- (void) addSortOrder(so)
- (void) orderBy(oes)
- (void) addJoins(joins)
- (void) addJoin(join)
- (void) setJoinStyle(path, style = 'OUTER')
- (void) addConstraints(constraints)
- (void) addConstraint(constraint) (bound)
- (void) getSorting()
- (void) getConstraintXML()
- (void) getJoinXML()
- (void) toXML()
- (void) toJSON()
- (void) fetchCode(lang, cb)
- (void) setName(name)
- (void) save(name, cb)
Save a query to the server, overwriting any query of the same name.
- (void) store(name, cb)
Store this query for the first time, avoiding name collisions.
- (void) saveAsTemplate(name, cb)
- (void) getCodeURI(lang)
- (void) getExportURI(format = 'tab', options = {})
- (Boolean) needsAuthentication()
Return true if this query will require user authentication to run correctly.
This currently means that this method returns true if the query:
- Contains any LIST constraints.
- (Promise<int>) fetchQID(cb)
Get a query id for referencing this query in subsequent requests.
Note that this id represents a snapshot of the query at the time of the request. Any changes to the query should require a new id to be fetched.
Duplicate queries posted to the same service will receive the same id back. So go wild*
[* do not really go wild]
- (void) __bio_req(types, n)
- (void) _fasta_req()
- (void) _gff3_req()