示例#1
0
  private boolean readExpectedBooleanQueryResult() throws Exception {
    BooleanQueryResultFormat bqrFormat =
        BooleanQueryResultParserRegistry.getInstance().getFileFormatForFileName(resultFileURL);

    if (bqrFormat != null) {
      InputStream in = new URL(resultFileURL).openStream();
      try {
        return QueryResultIO.parse(in, bqrFormat);
      } finally {
        in.close();
      }
    } else {
      Set<Statement> resultGraph = readExpectedGraphQueryResult();
      return DAWGTestResultSetUtil.toBooleanQueryResult(resultGraph);
    }
  }
示例#2
0
  private TupleQueryResult readExpectedTupleQueryResult() throws Exception {
    TupleQueryResultFormat tqrFormat = QueryResultIO.getParserFormatForFileName(resultFileURL);

    if (tqrFormat != null) {
      InputStream in = new URL(resultFileURL).openStream();
      try {
        TupleQueryResultParser parser = QueryResultIO.createParser(tqrFormat);
        parser.setValueFactory(dataRep.getValueFactory());

        TupleQueryResultBuilder qrBuilder = new TupleQueryResultBuilder();
        parser.setTupleQueryResultHandler(qrBuilder);

        parser.parse(in);
        return qrBuilder.getQueryResult();
      } finally {
        in.close();
      }
    } else {
      Set<Statement> resultGraph = readExpectedGraphQueryResult();
      return DAWGTestResultSetUtil.toTupleQueryResult(resultGraph);
    }
  }