use of com.thoughtworks.studios.shine.ShineRuntimeException in project gocd by gocd.
the class SesameGraph method dump.
public void dump(Writer writer) {
try {
if (contextResource.length == 0) {
RepositoryResult<org.openrdf.model.Resource> results = conn.getContextIDs();
while (results.hasNext()) {
org.openrdf.model.Resource context = results.next();
writer.append("Dumping context:" + context + "\n");
conn.export(new RDFXMLWriter(writer), context);
}
dumpTriplesNotInContext(writer);
} else {
for (int i = 0; i < contextResource.length; i++) {
writer.append("Dumping context:" + contextResource[i].stringValue() + "\n");
conn.export(new RDFXMLWriter(writer), contextResource);
}
}
} catch (Exception e) {
throw new ShineRuntimeException(e);
}
}
use of com.thoughtworks.studios.shine.ShineRuntimeException in project gocd by gocd.
the class SesameGraph method selectFirst.
public BoundVariables selectFirst(String sparqlSelect) {
BoundVariables boundVariables;
TupleQueryResult tupleQueryResult = getTupleQueryResult(sparqlSelect);
try {
if (!tupleQueryResult.hasNext()) {
return null;
}
boundVariables = new SesameBoundVariables(tupleQueryResult.getBindingNames(), tupleQueryResult.next());
if (tupleQueryResult.hasNext()) {
tupleQueryResult.close();
throw new MoreThanOneResultFoundException(sparqlSelect);
}
} catch (QueryEvaluationException e) {
throw new ShineRuntimeException("Could not parse query: <<" + sparqlSelect + ">>", e);
}
return boundVariables;
}
use of com.thoughtworks.studios.shine.ShineRuntimeException in project gocd by gocd.
the class SesameGraph method createURIReference.
public URIReference createURIReference(RDFType type, String uri) {
ArgumentUtil.guaranteeNotNull(type, "Type may not be null.");
ArgumentUtil.guaranteeNotNull(uri, "URI may not be null.");
ArgumentUtil.guaranteeFalse("URI may not be a blank node!", uri.startsWith("_:"));
URI sesameNativeURI = conn.getValueFactory().createURI(uri);
try {
conn.add(sesameNativeURI, RDF.TYPE, conn.getValueFactory().createURI(type.getURIText()), contextResource);
} catch (RepositoryException e) {
throw new ShineRuntimeException(e);
}
return new SesameURIReference(sesameNativeURI);
}
use of com.thoughtworks.studios.shine.ShineRuntimeException in project gocd by gocd.
the class NUnitRDFizer method importFile.
public Graph importFile(final String parentURI, Document document) throws GrddlTransformException {
final DocumentResult result = new DocumentResult();
final DocumentSource source = new DocumentSource(document);
try {
return xsltTransformerRegistry.transformWithCorrectClassLoader(XSLTTransformerRegistry.XUNIT_NUNIT_TO_JUNIT_XSL, new XSLTTransformerExecutor<Graph>() {
@Override
public Graph execute(Transformer transformer) throws TransformerException, GrddlTransformException {
transformer.transform(source, result);
return jUnitRDFizer.importFile(parentURI, result.getDocument());
}
});
} catch (TransformerException e) {
throw new ShineRuntimeException(e);
}
}
use of com.thoughtworks.studios.shine.ShineRuntimeException 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);
}
}
Aggregations