private static void identifyCriticalSecurityGoal(RequirementGraph req_model, ActorAssociationGraph actor_model) throws FileNotFoundException,
	UnsupportedEncodingException, IOException, ScriptException {
				
		String ex_req_model_file = req_model.generateExhaustiveFormalExpression();
		// normally the actor association model keeps unchanged, so no need to rewrite it.
		String actor_model_file = "dlv/models/actor_association_model.dl ";
		if(actor_model.getElements().size()!=0){ 
			actor_model_file = actor_model.generateFormalExpressionToFile();	
		}

		String inference_rule = "";
		if (req_model.getLayer().equals(InfoEnum.Layer.BUSINESS.name())) {
			inference_rule = "dlv/dlv -silent -nofacts "
					+ "dlv/rules/simplification_bus.rule dlv/rules/simplification_general.rule "
					+ "dlv/models/business_process_model.dl dlv/models/asset_model.dl " 
					+ ex_req_model_file + " " + actor_model_file;
		} else if (req_model.getLayer().equals(InfoEnum.Layer.APPLICATION.name())) {
			inference_rule = "dlv/dlv -silent -nofacts " 
					+ "dlv/rules/simplification_app.rule dlv/rules/simplification_general.rule "
					+ "dlv/rules/sec_goal_ownership.rule dlv/models/temp_app_fact.dl "// infer security goal ownership from upper layers.
					+ "dlv/models/software_architecture_model.dl " + "dlv/models/asset_model.dl "
					+ ex_req_model_file + " " + actor_model_file;
		} else if (req_model.getLayer().equals(InfoEnum.Layer.PHYSICAL.name())) {
			inference_rule = "dlv/dlv -silent -nofacts "
					+ "dlv/rules/simplification_phy.rule dlv/rules/simplification_general.rule "
					+ "dlv/models/deployment_model.dl dlv/models/asset_model.dl " 
					+ ex_req_model_file + " " + actor_model_file;
		} else {
			CommandPanel.logger.severe("Error refinement type!");
		}

		Runtime rt = Runtime.getRuntime();
		Process pr = rt.exec(inference_rule);

		BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
		String line = null;

		while ((line = input.readLine()) != null) {
			// line = input.readLine();
			line = line.substring(1, line.length() - 1);
			String[] result = line.split(", ");
			for (String s : result) {
				// highlight the critical one
				if (s.startsWith("is_critical")) {
					// parse facts
					s = s.replaceAll("is\\_critical\\(", "");
					s = s.replaceAll("\\)", "");
					SecurityGoal critical_sec_goal = (SecurityGoal) req_model.findExhaustiveSecurityGoalByFormalName(s);
					if(critical_sec_goal!=null){
						critical_sec_goal.setCriticality(true);
					}else{
						CommandPanel.logger.severe("critical secuirty goal error!");
					}
				}
				// show the not determined one.
				else if (s.startsWith("non_deterministic")) {
					// parse facts
					s = s.replaceAll("non\\_deterministic\\(", "");
					s = s.replaceAll("\\)", "");
					SecurityGoal critical_sec_goal = (SecurityGoal) req_model.findExhaustiveSecurityGoalByFormalName(s);
					critical_sec_goal.setNon_deterministic(true);
				}
			}
		}		
	}