コード例 #1
0
  @Override
  public void sparqlConstruct(String query, OutputStream os) throws StreamException {
    try {
      Statement st = getConnection().createStatement();

      // TODO: evaluate
      logEnable(st, true, false);

      RecordStream rs =
          new ResultSetRecordStream(executeQuery(st, "SPARQL " + prefixes + " " + query));

      NtWriter nt = new NtWriter(os);

      Record r;
      while ((r = rs.getNext()) != null) {
        String s = "" + r.get("S");
        String p = "" + r.get("P");
        String o = "" + r.get("O");
        nt.writeStatement(s, p, o);
      }
      st.close();
    } catch (SQLException ex) {
      throw new StreamException(ex);
    } catch (IOException ex) {
      throw new StreamException(ex);
    }
  }
コード例 #2
0
 public void writeStatement(Object s, Object p, Object o) throws IOException {
   stmtCount++;
   writeStatement(s.toString(), p.toString(), o.toString());
 }