<commit_before>package eu.freme.broker.eservices;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hp.hpl.jena.rdf.model.Model;

import eu.freme.conversion.rdf.RDFConstants;
import eu.freme.conversion.rdf.RDFConversionService;
import eu.freme.eservices.eentity.api.EEntityAPI;
import eu.freme.eservices.eentity.exceptions.ExternalServiceFailedException;

@RestController
public class DBPediaSpotlight extends BaseRestController {

	@Autowired
	EEntityAPI entityAPI;

	@Autowired
	RDFConversionService rdfConversionService;

	@RequestMapping(value = "/e-entity/dbpedia-spotlight", method = {
			RequestMethod.POST, RequestMethod.GET })
	public ResponseEntity<String> execute(
			@RequestParam(value = "text", defaultValue = "") String text,
			@RequestHeader(value = "Accept", defaultValue = "") String acceptHeader) {

		String rdf;
		try {
			rdf = entityAPI.callDBPediaSpotlight(text);
		} catch (ExternalServiceFailedException e) {
			e.printStackTrace();
			return externalServiceFailedResponse();
		}

		// get output format
		RDFConstants.RDFSerialization outputFormat = getOutputSerialization(acceptHeader);
		try {
			Model model = rdfConversionService.unserializeRDF(rdf,
					RDFConstants.RDFSerialization.TURTLE);
			String serialization = rdfConversionService.serializeRDF(model,
					outputFormat);
			return new ResponseEntity<String>(serialization, HttpStatus.OK);
		} catch (Exception e) {
			e.printStackTrace();
			return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
		}
	}
}<commit_msg>freme-project/e-Services#3 move e-link rest endpoint to broker<commit_after>package eu.freme.broker.eservices;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.hp.hpl.jena.rdf.model.Model;

import eu.freme.conversion.rdf.RDFConstants;
import eu.freme.conversion.rdf.RDFConversionService;
import eu.freme.eservices.eentity.api.EEntityService;
import eu.freme.eservices.eentity.exceptions.ExternalServiceFailedException;

@RestController
public class DBPediaSpotlight extends BaseRestController {

	@Autowired
	EEntityService entityAPI;

	@Autowired
	RDFConversionService rdfConversionService;

	@RequestMapping(value = "/e-entity/dbpedia-spotlight", method = {
			RequestMethod.POST, RequestMethod.GET })
	public ResponseEntity<String> execute(
			@RequestParam(value = "text", defaultValue = "") String text,
			@RequestHeader(value = "Accept", defaultValue = "") String acceptHeader) {

		String rdf;
		try {
			rdf = entityAPI.callDBPediaSpotlight(text);
		} catch (ExternalServiceFailedException e) {
			e.printStackTrace();
			return externalServiceFailedResponse();
		}

		// get output format
		RDFConstants.RDFSerialization outputFormat = getOutputSerialization(acceptHeader);
		try {
			System.out.println(rdf);
			Model model = rdfConversionService.unserializeRDF(rdf,
					RDFConstants.RDFSerialization.TURTLE);
			String serialization = rdfConversionService.serializeRDF(model,
					outputFormat);
			return new ResponseEntity<String>(serialization, HttpStatus.OK);
		} catch (Exception e) {
			e.printStackTrace();
			return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
		}
	}
}
{'fraction_non_alphanumeric': 0.0997743795437453, 'fraction_numerical': 0.000250689395838556, 'mean_word_length': 5.939130434782609, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3521141', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1171, 'n_words': 197}