Skip to content

Commit

Permalink
chore: cleanup TRS code
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Berezovskyi <andriib@kth.se>
  • Loading branch information
berezovskyi committed Nov 23, 2024
1 parent 46b6b05 commit 3b7805c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
6 changes: 0 additions & 6 deletions trs/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@

<dependencyManagement>
<dependencies>
<dependency>
<!-- TODO update to org.eclipse.rdf4j:rdf4j-repository-sparql:jar:2.5.1 -->
<groupId>org.openrdf.sesame</groupId>
<artifactId>sesame-repository-sparql</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-repository-sparql</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import java.io.IOException;
import java.net.URI;

import org.apache.jena.rdf.model.Model;
import org.apache.jena.update.UpdateExecutionFactory;
import org.apache.jena.update.UpdateFactory;
Expand All @@ -28,6 +29,7 @@
import org.eclipse.rdf4j.query.TupleQueryResult;
import org.eclipse.rdf4j.query.Update;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.RepositoryException;
import org.eclipse.rdf4j.repository.sparql.SPARQLRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -431,16 +433,13 @@ static public void processQuery_sesame(String query, RepositoryConnection conn)
public static RepositoryConnection getRepoConnection(String queryEndpoint, String user, String pwd) {
SPARQLRepository repo = new SPARQLRepository(queryEndpoint);
if (user != null && pwd != null && !user.isEmpty() && !pwd.isEmpty()) {
repo.setUsernameAndPassword("okacimi", "nohheis4ae");
repo.setUsernameAndPassword(user, pwd);
}
repo.initialize();
repo.init();
try {
RepositoryConnection conn = repo.getConnection();
if (conn == null) {
logger.error("error getting sparql repo connection !");
}
return conn;
} catch (Exception e) {
} catch (RepositoryException e) {
logger.error("error getting sparql repo connection !", e);
return null;
}
Expand All @@ -461,18 +460,14 @@ public static RepositoryConnection getRepoConnection(String queryEndpoint, Strin
public static RepositoryConnection getRepoConnection(String queryEndpoint, String updateEndPoint, String user,
String pwd) {
SPARQLRepository repo = new SPARQLRepository(queryEndpoint, updateEndPoint);
if (user != null && pwd != null && !user.isEmpty() && !pwd.isEmpty() && !user.isEmpty()) {
if (user != null && pwd != null && !user.isEmpty() && !pwd.isEmpty()) {
repo.setUsernameAndPassword(user, pwd);
}
repo.initialize();
repo.init();
try {
RepositoryConnection conn = repo.getConnection();

if (conn == null) {
logger.error("error getting sparql repo connection !");
}
return conn;
} catch (Exception e) {
} catch (RepositoryException e) {
logger.error("error getting sparql repo connection !", e);
return null;
}
Expand Down

0 comments on commit 3b7805c

Please sign in to comment.