use of org.openrdf.repository.RepositoryException in project gocd by gocd.
the class SesameGraph method remove.
public void remove(Resource tripleSubject, RDFProperty triplePredicate, Integer integer) {
AbstractSesameResource sesameSubject = (AbstractSesameResource) tripleSubject;
URI sesameNativePredicate = getSesameNativeProperty(triplePredicate);
try {
conn.remove(sesameSubject.getSesameNativeResource(), sesameNativePredicate, conn.getValueFactory().createLiteral(String.valueOf(integer), XMLSchema.INTEGER), contextResource);
} catch (RepositoryException e) {
throw new ShineRuntimeException(e);
}
}
use of org.openrdf.repository.RepositoryException in project gocd by gocd.
the class SesameGraph method createTempGraph.
public Graph createTempGraph() {
try {
if (!conn.isOpen()) {
throw new IllegalStateException("Cannot create a temp graph on a closed graph!");
}
Repository inMemRepos = InMemoryRepositoryFactory.emptyRepository();
String contextURI = null;
if (contextResource.length > 0) {
contextURI = contextResource[0].stringValue();
}
Graph tempGraph = new SesameGraph(inMemRepos.getConnection(), contextURI);
tempGraphs.add(tempGraph);
return tempGraph;
} catch (RepositoryException ex) {
throw new ShineRuntimeException("Unable to create temp graph!", ex);
}
}
use of org.openrdf.repository.RepositoryException in project gocd by gocd.
the class InMemoryRepositoryFactory method emptyRepository.
public static Repository emptyRepository() {
try {
Repository repo = new SailRepository(new MemoryStore());
repo.initialize();
return repo;
} catch (RepositoryException ex) {
throw new ShineRuntimeException(ex);
}
}
use of org.openrdf.repository.RepositoryException in project gocd by gocd.
the class SesameGraph method addStatement.
public void addStatement(Resource subject, RDFProperty predicate, Resource object) {
AbstractSesameResource sesameSubject = (AbstractSesameResource) subject;
URI sesameNativePredicate = getSesameNativeProperty(predicate);
AbstractSesameResource sesameObject = (AbstractSesameResource) object;
try {
conn.add(sesameSubject.getSesameNativeResource(), sesameNativePredicate, sesameObject.getSesameNativeResource(), contextResource);
} catch (RepositoryException e) {
throw new ShineRuntimeException("Could not add statement << [" + subject + "] [" + predicate + "] [" + object + "] >>", e);
}
}
use of org.openrdf.repository.RepositoryException in project gocd by gocd.
the class SesameGraph method addStatement.
public void addStatement(Resource subject, RDFProperty predicate, String object) {
AbstractSesameResource sesameSubject = (AbstractSesameResource) subject;
URI sesameNativePredicate = getSesameNativeProperty(predicate);
try {
conn.add(sesameSubject.getSesameNativeResource(), sesameNativePredicate, conn.getValueFactory().createLiteral(String.valueOf(object), XMLSchema.STRING), contextResource);
} catch (RepositoryException e) {
throw new ShineRuntimeException("Could not add statement << [" + subject + "] [" + predicate + "] [" + object + "] >>", e);
}
}
Aggregations