1

I want to connect Android to an owl file using the code below, but this line

model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_TRANS_INF)

throws an exception.

public class OntoQuery {
    private Model model;

    public OntoQuery(String inputFileName) {
        model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_TRANS_INF);
        InputStream in = FileManager.get().open(inputFileName);
        if(in == null) {
            throw new IllegalArgumentException("File: " + inputFileName + " not found");
        } else {
            model.read(in, "RDF/XML");
        }
    }

    public String executeQuery(String queryString) throws UnsupportedEncodingException {
        Query query = QueryFactory.create(queryString);
        QueryExecution qe = QueryExecutionFactory.create(query, this.model);
        Throwable var5 = null;

        String fieldValue;
        try {
            ResultSet results = qe.execSelect();
            ByteArrayOutputStream go = new ByteArrayOutputStream();
            ResultSetFormatter.out(go, results, query);
            fieldValue = new String(go.toByteArray(), "UTF-8");
        } catch (Throwable var15) {
            var5 = var15;
            throw var15;
        } finally {
            if(qe != null) {
                if(var5 != null) {
                    try {
                        qe.close();
                    } catch (Throwable var14) {
                        //var5.addSuppressed(var14);
                    }
                } else {
                    qe.close();
                }
            }
        }

        return fieldValue;
    }
}
TofferJ
  • 4,678
  • 1
  • 37
  • 49
eman
  • 33
  • 1
  • 5
  • It would be helpful if you can post the error message. – TofferJ Aug 14 '17 at 21:03
  • This is error message( unfortunately, App name has stopped) TofferJ – eman Aug 14 '17 at 21:26
  • Connect your device to your computer and look at the Logcat output (https://developer.android.com/studio/debug/am-logcat.html, https://developer.android.com/studio/command-line/logcat.html) – TofferJ Aug 14 '17 at 21:36
  • 01-01 01:24:06.720 8870-8870/com.example.eman.ecrime E/Trace: error opening trace file: No such file or directory (2) 01-01 01:24:09.290 8870-8870/com.example.eman.ecrime E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering – eman Aug 14 '17 at 21:57

0 Answers0