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

Constructor Details

# (void) constructor({name, classes})

Constructor.

@param options The data used to construct this model.

Options Hash: (options):

  • name ( String ) The name of this model.
  • classes ( Object<String, Object> ) A description of the classes.

Instance Method Details

# (PathInfo) getPathInfo(path, subcls) Bound

Construct a PathInfo object representing the given path, given the specified subclass constraints.

Parameters:

  • path ( #toString ) The path to represent.
  • subcls ( Object<String, String> ) The subclass constraints. (optional)

Returns:

  • ( PathInfo ) — A representation of the path.

# (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.

Parameters:

  • cls ( String|Table ) The class to get subclasses of.

Returns:

  • ( Array<String> ) — The names of this class and all its subclasses.

# (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]

Parameters:

  • cls ( String|Table ) The class whose ancestry is to be retrieved.

Returns:

  • ( Array<String> ) — A list of names of classes this class inherits from.

# (String) findSharedAncestor(classA, classB) Bound

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.

Parameters:

  • classA ( String|Table ) The first class
  • classB ( String|Table ) The second class

Returns:

  • ( String ) — The name of the closest shared ancestor

# (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.

Parameters:

  • xs ( Array<String|Table> ) the classes.

Returns:

  • ( String ) — The name of the common superclass, or null.

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: