findRelations(queryObj = {}) {
    let sourceAssets;
    if (queryObj && typeof queryObj.from !== 'undefined') {
      if (queryObj.from && queryObj.from.isAsset) {
        sourceAssets = [queryObj.from];
      } else if (queryObj.from && Array.isArray(queryObj.from)) {
        sourceAssets = [];
        for (const fromEntry of queryObj.from) {
          if (fromEntry.isAsset) {
            sourceAssets.push(fromEntry);
          } else {
            sourceAssets.push(...this.findAssets(fromEntry));
          }
        }
        sourceAssets = _.uniq(sourceAssets);
      } else {
        sourceAssets = this.findAssets(queryObj.from);
      }
    } else {
      sourceAssets = this._assets;
    }
    const candidateRelations = [];
    for (const sourceAsset of sourceAssets) {
      if (sourceAsset.isPopulated) {
        candidateRelations.push(...sourceAsset.outgoingRelations);
      }
    }
    const result = [];
    const compiledQuery = compileQuery(queryObj);
    for (const relation of candidateRelations) {
      if (compiledQuery(relation)) {
        result.push(relation);
      }
    }
    return result;
  }
Query relations in the graph.

Example usage:

    const allRelationsInGraph = ag.findRelations();

    const allHtmlScriptRelations = ag.findRelations({
        type: 'HtmlScript'
    });

    const htmlAnchorsPointingAtLocalImages = ag.findRelations({
        type: 'HtmlAnchor',
        to: {isImage: true, url: {$regex: /^file:/}}
    });

@param {Object} [queryObj={}] Query to match Relations against. Will match all relations if not provided.
@return {Relation[]} The found relations.