<commit_before>package com.pineone.icbms.sda.sf;

import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Literal;

import com.pineone.icbms.sda.comm.dto.ResponseMessage;
import com.pineone.icbms.sda.comm.util.Utils;
public class SparqlHalyardQueryImpl extends QueryCommon implements QueryItf {
	
	private final Log log = LogFactory.getLog(this.getClass());

	@Override
	public List<Map<String, String>> runQuery(String query, String[] idxVals) throws Exception {
		String serviceURI = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.halyard.sparql.endpoint");
		String madeQl = "";
		String lines[] = null; 
		String header[] = null;

		log.info("runQuery of halyard sparql start ======================>");
		
		madeQl = makeFinal(query, idxVals);
		query = Utils.getSparQlHeader() + madeQl.toString();
		log.debug("final query of halyard sparql ==========>\n" + query);
		
		query = serviceURI + URLEncoder.encode(query, "UTF-8");
		
		log.info("-------------------------------------------------");;
		log.info(query);
		log.info("-------------------------------------------------");				

		ResponseMessage rm = null;
		try {
			rm = Utils.requestData(query);
		} catch (Exception e) {
			throw e;
		}
		
		List<Map<String, String>> list = new ArrayList<Map<String, String>>();
		
		if(rm.getContents().length() >= 2) {
			lines = rm.getContents().split("\n");
			header = lines[0].split(",");							// header분리
		} 
		
		// 첫번째는 header이므로 1부터 시작함
		for(int m = 1; m < lines.length; m++) {
			String row[] = lines[m].split(",");					// 각각의 row를 분리
			for(int n = 0; n < header.length; n++) {			
				Map<String, String> map = new LinkedHashMap<String, String>();
				map.put(header[n].trim(), row[n].trim());
				list.add(map);
			}
		}
		log.info("runQuery of halyard sparql end ======================>");
		return list;
	}
}<commit_msg>Halyard select쿼리 결과 리턴 수정<commit_after>package com.pineone.icbms.sda.sf;

import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jena.query.QueryExecution;
import org.apache.jena.query.QueryExecutionFactory;
import org.apache.jena.query.QuerySolution;
import org.apache.jena.query.ResultSet;
import org.apache.jena.rdf.model.Literal;

import com.pineone.icbms.sda.comm.dto.ResponseMessage;
import com.pineone.icbms.sda.comm.util.Utils;
public class SparqlHalyardQueryImpl extends QueryCommon implements QueryItf {
	
	private final Log log = LogFactory.getLog(this.getClass());

	@Override
	public List<Map<String, String>> runQuery(String query, String[] idxVals) throws Exception {
		String serviceURI = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.halyard.sparql.endpoint");
		String madeQl = "";
		String lines[] = null; 
		String header[] = null;

		log.info("runQuery of halyard sparql start ======================>");
		
		madeQl = makeFinal(query, idxVals);
		query = Utils.getSparQlHeader() + madeQl.toString();
		log.debug("final query of halyard sparql ==========>\n" + query);
		
		query = serviceURI + URLEncoder.encode(query, "UTF-8");
		
		log.info("-------------------------------------------------");;
		log.info(query);
		log.info("-------------------------------------------------");				

		ResponseMessage rm = null;
		try {
			rm = Utils.requestGet(query);
		} catch (Exception e) {
			throw e;
		}
		
		List<Map<String, String>> list = new ArrayList<Map<String, String>>();
		
		if(rm.getContents().length() >= 2) {
			lines = rm.getContents().split("\n");
			header = lines[0].split(",");							// header분리
		} 
		
		// 첫번째는 header이므로 1부터 시작함
		Map<String, String> map = new LinkedHashMap<String, String>();
		for(int m = 1; m < lines.length; m++) {
			String row[] = lines[m].split(",");					// row를 컬럼으로 분리
			for(int n = 0; n < header.length; n++) {			
				map.put(header[n].trim(), row[n].trim());
			}
			list.add(map);
		}
	
		log.info("runQuery of halyard sparql end ======================>");
		return list;
	}
}
{'fraction_non_alphanumeric': 0.207922959072007, 'fraction_numerical': 0.0026263952724885093, 'mean_word_length': 3.344106463878327, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '832620', 'n_tokens_mistral': 1719, 'n_tokens_neox': 1577, 'n_words': 312}