<commit_before>package de.unibonn.iai.eis.linda.example;

import java.io.ByteArrayOutputStream;


import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;

import de.unibonn.iai.eis.linda.helper.SPARQLHandler;

/**
 * @author gsingharoy
 *
 *This is a sample class to understand how to manipulate RDF using Jena
 *
 *Will be removed later
 *
 */


public class SPARQLExample {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		System.out.print(exampleResultSet("text"));
	}

	public static String exampleResultSet(String type){
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		String queryString=
				"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+
				"SELECT ?subject ?label "+
				"WHERE { ?subject rdfs:label ?label. "+
				"FILTER(langMatches(lang(?label), \"EN\"))} LIMIT 10 ";

		ResultSet results = SPARQLHandler.executeDBPediaQuery(queryString);
		if(results != null){
			ResultSetFormatter.out(baos, results);
	    	return baos.toString();
		}
		else{
			return "";
		}
	}
}
<commit_msg>added checks for different conversions<commit_after>package de.unibonn.iai.eis.linda.example;

import java.io.ByteArrayOutputStream;


import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;

import de.unibonn.iai.eis.linda.helper.SPARQLHandler;

/**
 * @author gsingharoy
 *
 *This is a sample class to understand how to manipulate RDF using Jena
 *
 *Will be removed later
 *
 */


public class SPARQLExample {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		System.out.print(exampleResultSet("text"));
	}

	public static String exampleResultSet(String type){
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		String queryString=
				"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+
						"SELECT ?subject ?label "+
						"WHERE { ?subject rdfs:label ?label. "+
						"FILTER(langMatches(lang(?label), \"EN\"))} LIMIT 10 ";

		ResultSet results = SPARQLHandler.executeDBPediaQuery(queryString);
		if(type.equals("text")){
			if(results != null){
				ResultSetFormatter.out(baos, results);
				return baos.toString();
			}
			else{
				return "";
			}
		}
		else if(type.equals("csv")){
			return "CSV Converstion to be implemented soon";
		}
		else if(type.equals("html")){
			return "HTML Converstion to be implemented soon";
		}
		else if(type.equals("xml")){
			return "XML Converstion to be implemented soon";
		}
		else if(type.equals("json")){
			return "JSON Converstion to be implemented soon";
		}
		else{
			return "No Converstion type '"+type+"' recognized.";
		}
		
	}
}

{'fraction_non_alphanumeric': 0.13710596278009873, 'fraction_numerical': 0.006836308393467528, 'mean_word_length': 3.8687615526802217, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 1}, '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': '5397455', 'n_tokens_mistral': 1015, 'n_tokens_neox': 889, 'n_words': 200}