removed redundand lines of code

This commit is contained in:
Alessia Bardi 2020-08-07 12:44:36 +02:00
parent b3f5f38c02
commit 69ca7eaade
1 changed files with 3 additions and 9 deletions

View File

@ -46,7 +46,6 @@ public class GraphDBClient {
private static final Log log = LogFactory.getLog(GraphDBClient.class);
public static final String PROVENANCE_NS = "http://www.d-net.research-infrastructures.eu/provenance/";
public static final int NUM_RECORDS_THRESHOLD = 10;
@Autowired
private RunSPARQLQueryService runSPQRLQuery;
@ -95,7 +94,6 @@ public class GraphDBClient {
con.add(IOUtils.toInputStream(getRDFBlock(record), "UTF-8"), recordURI, RDFFormat.RDFXML, graph);
con.commit();
// log.debug("statement added");
con.close();
}
catch (RDF4JException e) {
log.error("error adding statement ...", e);
@ -260,12 +258,11 @@ public class GraphDBClient {
public String updateSparql(final String queryValue) throws AriadnePlusPublisherException{
try {
String result = new String("");
String result= "";
RemoteRepositoryManager manager = new RemoteRepositoryManager(this.graphDBServerUrl);
manager.init();
manager.setUsernameAndPassword(getWriterUser(), getWriterPwd());
Repository repository = manager.getRepository(getRepository());
ValueFactory factory = repository.getValueFactory();
try (RepositoryConnection con = repository.getConnection()) {
con.begin();
@ -281,7 +278,6 @@ public class GraphDBClient {
log.debug("query result: "+result);
con.commit();
log.debug("query executed");
con.close();
}
catch (RDF4JException e) {
log.error("error executing query ...", e);
@ -297,7 +293,7 @@ public class GraphDBClient {
public String feedFromURL(final String dataUrl, final String context) throws AriadnePlusPublisherException{
try {
String result = new String("");
String result = "";
RemoteRepositoryManager manager = new RemoteRepositoryManager(this.graphDBServerUrl);
manager.init();
manager.setUsernameAndPassword(getWriterUser(), getWriterPwd());
@ -305,13 +301,11 @@ public class GraphDBClient {
ValueFactory factory = repository.getValueFactory();
try (RepositoryConnection con = repository.getConnection()) {
con.begin();
String baseUri = null;
IRI contextIRI = factory.createIRI(getGraphDBBaseURI(), context);
con.add(new URL(dataUrl), baseUri, RDFFormat.TURTLE, contextIRI);
con.add(new URL(dataUrl), null, RDFFormat.TURTLE, contextIRI);
result.concat("data added from url: "+dataUrl+" into graph "+context);
con.commit();
log.debug("add data from Url executed");
con.close();
}
catch (RDF4JException e) {
log.error("error executing query ...", e);