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