Search in sources :

Example 21 with NotFoundException

use of org.apache.jena.shared.NotFoundException in project webofneeds by researchstudio-sat.

the class GoalUtils method loadSparqlQuery.

private static String loadSparqlQuery(String filePath) {
    InputStream is = GoalUtils.class.getResourceAsStream(filePath);
    StringWriter writer = new StringWriter();
    try {
        IOUtils.copy(is, writer, Charsets.UTF_8);
    } catch (IOException e) {
        throw new NotFoundException("failed to load resource: " + filePath);
    } finally {
        try {
            is.close();
        } catch (Exception e) {
        }
    }
    return writer.toString();
}
Also used : StringWriter(java.io.StringWriter) InputStream(java.io.InputStream) NotFoundException(org.apache.jena.shared.NotFoundException) IOException(java.io.IOException) IOException(java.io.IOException) NotFoundException(org.apache.jena.shared.NotFoundException)

Example 22 with NotFoundException

use of org.apache.jena.shared.NotFoundException in project webofneeds by researchstudio-sat.

the class GoalInstantiationTest method loadSparqlQuery.

private static String loadSparqlQuery(String filePath) {
    InputStream is = GoalInstantiationTest.class.getResourceAsStream(filePath);
    StringWriter writer = new StringWriter();
    try {
        IOUtils.copy(is, writer, Charsets.UTF_8);
    } catch (IOException e) {
        throw new NotFoundException("failed to load resource: " + filePath);
    } finally {
        try {
            is.close();
        } catch (Exception e) {
        }
    }
    return writer.toString();
}
Also used : StringWriter(java.io.StringWriter) InputStream(java.io.InputStream) NotFoundException(org.apache.jena.shared.NotFoundException) IOException(java.io.IOException) NotFoundException(org.apache.jena.shared.NotFoundException) IOException(java.io.IOException)

Aggregations

NotFoundException (org.apache.jena.shared.NotFoundException)22 InputStream (java.io.InputStream)15 FileManager (org.apache.jena.util.FileManager)5 Test (org.junit.Test)5 IOException (java.io.IOException)2 StringWriter (java.io.StringWriter)2 TypedInputStream (org.apache.jena.atlas.web.TypedInputStream)2 Model (org.apache.jena.rdf.model.Model)2 StreamRDF (org.apache.jena.riot.system.StreamRDF)2 FileNotFoundException (java.io.FileNotFoundException)1 BodyPublisher (java.net.http.HttpRequest.BodyPublisher)1 Path (java.nio.file.Path)1 TerminationException (jena.cmd.TerminationException)1 ContentType (org.apache.jena.atlas.web.ContentType)1 Dataset (org.apache.jena.query.Dataset)1 ResultSet (org.apache.jena.query.ResultSet)1 Lang (org.apache.jena.riot.Lang)1 RiotException (org.apache.jena.riot.RiotException)1 RiotNotFoundException (org.apache.jena.riot.RiotNotFoundException)1 TestLocationMapper (org.apache.jena.riot.stream.TestLocationMapper)1