while (!stopFetching && results.hasNext()) { final OWLBindingSet bindingSet = results.next(); String[] crow = new String[numcols];
public static void printResult(OutputStream out, TupleOWLResultSet result) throws Exception { BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(out, "utf8")); /* * Printing the header */ int columns = result.getColumnCount(); for (int c = 0; c < columns; c++) { String value = result.getSignature().get(c); wr.append(value); if (c + 1 < columns) wr.append(","); } wr.newLine(); while (result.hasNext()) { final OWLBindingSet bindingSet = result.next(); for (int c = 0; c < columns; c++) { String value = ToStringRenderer.getInstance().getRendering(bindingSet.getOWLObject(c + 1)); wr.append(value); if (c + 1 < columns) wr.append(","); } wr.newLine(); } wr.flush(); result.close(); }
private boolean nextEmptyEntity(IRI entity, int arity) { String query =getQuery(arity, entity); //execute next query try (OWLStatement stm = questConn.createStatement()){ try (TupleOWLResultSet rs = stm.executeSelectQuery(query)) { if (!rs.hasNext()) { nextConcept = entity; log.debug( "Empty " + entity ); hasNext = true; return true; } return false; } } catch (OWLException e) { e.printStackTrace(); } return false; }
private void fetchRows(int size) throws OWLException, InterruptedException { if (results == null) { return; } for (int rows_fetched = 0; results.hasNext() && !stopFetching && (isFetchingAll() || rows_fetched < size); rows_fetched++) { String[] crow = new String[numcols]; final OWLBindingSet bindingSet = results.next(); for (int j = 0; j < numcols; j++) { if(stopFetching) break; OWLPropertyAssertionObject constant = bindingSet.getOWLPropertyAssertionObject(j + 1); if (constant != null) { crow[j] = ToStringRenderer.getInstance().getRendering(constant); } else { crow[j] = ""; } } if(!stopFetching){ SwingUtilities.invokeLater(new RowAdder(crow)); } } isFetching = false; }