code: public static InstancesLoadResult loadInstances( File instancesFile, File rootDirectory, Graphs graph, String applicationName ) {
  
  		InstancesLoadResult result = new InstancesLoadResult();
  		INST: {
  			if( ! instancesFile.exists()) {
  				RoboconfError error = new RoboconfError( ErrorCode.PROJ_MISSING_INSTANCE_EP );
  				error.setDetails( expected( instancesFile.getAbsolutePath()));
  				result.loadErrors.add( error );
  				break INST;
  			}
  
  			FromInstanceDefinition fromDef = new FromInstanceDefinition( rootDirectory );
  			Collection<Instance> instances = fromDef.buildInstances( graph, instancesFile );
  			result.getParsedFiles().addAll( fromDef.getProcessedImports());
  			if( ! fromDef.getErrors().isEmpty()) {
  				result.loadErrors.addAll( fromDef.getErrors());
  				break INST;
  			}
  
  			Collection<ModelError> errors = RuntimeModelValidator.validate( instances );
  			result.loadErrors.addAll( errors );
  			result.objectToSource.putAll( fromDef.getObjectToSource());
  			result.getRootInstances().addAll( instances );
  		}
  
  		for( Instance rootInstance : result.rootInstances )
  			rootInstance.data.put( Instance.APPLICATION_NAME, applicationName );
  
  		return result;
  	}
docs: Loads instances from a file.
  @param instancesFile the file definition of the instances (can have imports)
  @param rootDirectory the root directory that contains instance definitions, used to resolve imports
  @param graph the graph to use to resolve instances
  @param applicationName the application name
  @return a non-null result