Class: Model
Defined in: | src/model.coffee |
Overview
A representation of the metadata for an InterMine. This class allows the user to inspect what kinds of data a mine is configured with, allowing us to verify existing queries, as well as constructing queries automatically by walking the data-model.
Instance Method Summary
- - (void) constructor() Constructor Constructor.
- - (PathInfo) getPathInfo(path, subcls) Bound Construct a PathInfo object representing the given path, given the specified subclass constraints.
- - (Array<String>) getSubclassesOf(cls) Bound Get a list that contains all the names of the subclasses of this class, as well as itself.
- - (Array<String>) getAncestorsOf(cls) Bound Get the list of classes that the given class descends from.
- - (String) findSharedAncestor(classA, classB) Bound Get the closest shared ancestor of these two classes.
- - (String) findCommonType(xs = []) Bound Find the common type of a list of classes or class names, or null if there is no one common type.
Constructor Details
- (void) constructor()
Constructor.
@param options The data used to construct this model.
Instance Method Details
- (PathInfo) getPathInfo(path, subcls) (bound)
Construct a PathInfo object representing the given path, given the specified subclass constraints.
- (Array<String>) getSubclassesOf(cls) (bound)
Get a list that contains all the names of the subclasses of this class, as well as itself. For an inheritance pattern such as:
A B C
| \ /
D E F G
\ / \ / \
| | \
H I J
\ / \ |
K L M
The subclasses of B will be [B, G, I, K, L, J, M] or [B, G, J, M, I, K, L], depending on the order in which the classes are iterated over.
- (Array<String>) getAncestorsOf(cls) (bound)
Get the list of classes that the given class descends from. The list does not include the class itself. For an inheritance pattern such as:
A B C
| \ /
D E F G
\ / \ / \
| | \
H I J
\ / \ |
K L M
The list of ancestors of K will be [H, I, D, E, A, F, G, B, C]
Get the closest shared ancestor of these two classes. For an inheritance pattern such as:
A B C
| \ /
D E F G
\ / \ / \
| | \
H I J
\ / \ |
K L M
The closest shared ancestor of K and M is G, while the closest shared ancestor of K and L is I. The closest shared ancestor of H and I is null.
- (String) findCommonType(xs = []) (bound)
Find the common type of a list of classes or class names, or null if there is no one common type.