<commit_before>package part.offline.control;

import data.City;
import data.Entity;
import data.control.FileInput;
import data.database.connection.WikiNerConnector;

public class DBWriterUnit extends Thread{
	
	private String fileName;
	private String entitySplitSymbol;
	private String coordsSplitSymbol;
	private WikiNerConnector connector;
	private FileInput in;
	private int id;
	private Status status;
	
	public DBWriterUnit(int id, String fileName, WikiNerConnector connector, String entitySplitSymbol, String coordsSplitSymbol) {
		this.connector = connector;
		this.coordsSplitSymbol = coordsSplitSymbol;
		this.entitySplitSymbol = entitySplitSymbol;
		this.setFileName(fileName);
		this.id = id;
		//this.status = status;
		
		try {
			this.in = new FileInput(fileName);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void run(){
		String[] city;
		String[] entities;		
		Entity temp;
		int cityID, entityID;
		String[] dataArr = in.loadCompleteFile();
		
		for (int i = 0; i < dataArr.length; i++) {
			//status.setWorkForEachDone(i, id);
			entities = dataArr[i].split(entitySplitSymbol);
			city = entities[0].split(coordsSplitSymbol);
			
			cityID = connector.writeCity(new City(city[0], city[1], city[2]));
			
			for (int j = 1; j < entities.length; j++) {
				temp = new Entity(entities[j], entities[++j], entities[++j]);
				entityID = connector.writeEntity(temp);
				
				connector.writeConnection(cityID, entityID, temp.getCount());
			}
		}
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;<commit_msg>try catch in dbwriter eingefügt<commit_after>package part.offline.control;

import data.City;
import data.Entity;
import data.control.FileInput;
import data.database.connection.WikiNerConnector;

public class DBWriterUnit extends Thread{
	
	private String fileName;
	private String entitySplitSymbol;
	private String coordsSplitSymbol;
	private WikiNerConnector connector;
	private FileInput in;
	private int id;
	private Status status;
	
	public DBWriterUnit(int id, String fileName, WikiNerConnector connector, String entitySplitSymbol, String coordsSplitSymbol) {
		this.connector = connector;
		this.coordsSplitSymbol = coordsSplitSymbol;
		this.entitySplitSymbol = entitySplitSymbol;
		this.setFileName(fileName);
		this.id = id;
		//this.status = status;
		
		try {
			this.in = new FileInput(fileName);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void run(){
		String[] city;
		String[] entities;		
		Entity temp;
		int cityID, entityID;
		String[] dataArr = in.loadCompleteFile();
		
		for (int i = 0; i < dataArr.length; i++) {
			//status.setWorkForEachDone(i, id);
			try{
				entities = dataArr[i].split(entitySplitSymbol);
				city = entities[0].split(coordsSplitSymbol);
			
				cityID = connector.writeCity(new City(city[0], city[1], city[2]));
				
				for (int j = 1; j < entities.length; j++) {
					temp = new Entity(entities[j], entities[++j], entities[++j]);
					entityID = connector.writeEntity(temp);
				
					connector.writeConnection(cityID, entityID, temp.getCount());
				}
		
			}catch(Exception e){
				e.printStackTrace();
			}
		}
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
{'fraction_non_alphanumeric': 0.1155688622754491, 'fraction_numerical': 0.003592814371257485, 'mean_word_length': 4.155864197530864, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '5319645', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1040, 'n_words': 261}