Added test to clear a graph
This commit is contained in:
parent
e082bb7722
commit
162189a207
|
@ -4,16 +4,25 @@
|
|||
package eu.dnetlib.ariadneplus;
|
||||
|
||||
import eu.dnetlib.ariadneplus.elasticsearch.BulkUpload;
|
||||
import eu.dnetlib.ariadneplus.publisher.AriadnePlusPublisherException;
|
||||
import eu.dnetlib.ariadneplus.reader.ResourceManager;
|
||||
import eu.dnetlib.ariadneplus.reader.RunSPARQLQueryService;
|
||||
import eu.dnetlib.ariadneplus.reader.json.ParseRDFJSON;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.eclipse.rdf4j.RDF4JException;
|
||||
import org.eclipse.rdf4j.model.IRI;
|
||||
import org.eclipse.rdf4j.model.Resource;
|
||||
import org.eclipse.rdf4j.model.ValueFactory;
|
||||
import org.eclipse.rdf4j.query.GraphQuery;
|
||||
import org.eclipse.rdf4j.query.GraphQueryResult;
|
||||
import org.eclipse.rdf4j.query.QueryLanguage;
|
||||
import org.eclipse.rdf4j.query.QueryResults;
|
||||
import org.eclipse.rdf4j.repository.Repository;
|
||||
import org.eclipse.rdf4j.repository.RepositoryConnection;
|
||||
import org.eclipse.rdf4j.repository.RepositoryResult;
|
||||
import org.eclipse.rdf4j.repository.manager.RemoteRepositoryManager;
|
||||
import org.eclipse.rdf4j.repository.util.Repositories;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
@ -802,4 +811,23 @@ public class GraphDbReaderAndESIndexTest {
|
|||
repository.shutDown();
|
||||
manager.shutDown();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearGraphTest() throws Exception {
|
||||
RemoteRepositoryManager manager = new RemoteRepositoryManager("http://graphdb-test.ariadne.d4science.org:7200");
|
||||
//RemoteRepositoryManager manager = new RemoteRepositoryManager("https://graphdb-test.ariadne.d4science.org");
|
||||
manager.init();
|
||||
manager.setUsernameAndPassword("XXX", "XXX");
|
||||
Repository repository = manager.getRepository("XXX");
|
||||
ValueFactory factory = repository.getValueFactory();
|
||||
IRI defaultGraph = factory.createIRI("http://www.ontotext.com/", "explicit");
|
||||
try (RepositoryConnection connection = repository.getConnection()) {
|
||||
Repositories.consume(repository, conn -> conn.clear(defaultGraph));
|
||||
}
|
||||
catch (RDF4JException e) {
|
||||
throw new AriadnePlusPublisherException(e);
|
||||
}
|
||||
repository.shutDown();
|
||||
manager.shutDown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue