function buildTree(breedingAPIEndpoint) {
  let client = new BreedingAPIClient(breedingAPIEndpoint)

  // Fetch BrAPI ontologies, variables and create tree node out of them
  let ontologiesRequest = client.fetchOntologies().then(createOntologyNodes)
  let variablesRequest = client.fetchVariables().then(createVariableNodes)

  let allNodes = $.when(ontologiesRequest, variablesRequest)
    .then((ontologyNodes, variableNodes) => ontologyNodes.concat(variableNodes))
    .catch(() => variablesRequest)

  return allNodes.then(nodes => Arrays.distinctBy(nodes, n => n['id']))
}
/**
 * Asynchronously loads jstree nodes from Breeding API ontologies & variables
 * @return deferred list of tree node
 */
Asynchronously loads jstree nodes from Breeding API ontologies & variables
@return deferred list of tree node
Asynchronously loads jstree nodes from Breeding API ontologies & variables @return deferred list of tree node
function buildTree(breedingAPIEndpoint) {
  let client = new BreedingAPIClient(breedingAPIEndpoint)
  let ontologiesRequest = client.fetchOntologies().then(createOntologyNodes)
  let variablesRequest = client.fetchVariables().then(createVariableNodes)
  let allNodes = $.when(ontologiesRequest, variablesRequest)
    .then((ontologyNodes, variableNodes) => ontologyNodes.concat(variableNodes))
    .catch(() => variablesRequest)
  return allNodes.then(nodes => Arrays.distinctBy(nodes, n => n['id']))
}
function buildTree ( breedingAPIEndpoint ) { let client = new BreedingAPIClient ( breedingAPIEndpoint ) let ontologiesRequest = client . fetchOntologies ( ) . then ( createOntologyNodes ) let variablesRequest = client . fetchVariables ( ) . then ( createVariableNodes ) let allNodes = $ . when ( ontologiesRequest , variablesRequest ) . then ( ( ontologyNodes , variableNodes ) => ontologyNodes . concat ( variableNodes ) ) . catch ( ( ) => variablesRequest ) return allNodes . then ( nodes => Arrays . distinctBy ( nodes , n => n [ 'id' ] ) ) }
Asynchronously loads jstree nodes from Breeding API ontologies & variables
 @return deferred list of tree node
Asynchronously loads jstree nodes from Breeding API ontologies & variables @return deferred list of tree node
// Fetch BrAPI ontologies, variables and create tree node out of them