Node predicate = new Node(new URI("http://P" + p));
for (int o = 0; o < 10; o++) {
Node object = new Node(new URI("http://O" + o));
for (int c = 0; c < 1; c++) {
Node context = new Node(new URI("http://C" + c));
Statement statement = new Statement(subject,
predicate, object, context);
statementList.add(statement);
}
}
}
}
TCPClientModel model = new TCPClientModel(address, 5000, "test2");
System.out.println("adding " + statementList.size()+ " statements");
long startTime = System.currentTimeMillis();
int counter = 0;
for (Statement statement : statementList) {
model.addStatement(statement);
//counter++;
//if (counter % 100 == 0)
// System.out.print(".");
}
long endTime = System.currentTimeMillis();
double durationinseconds = (endTime - startTime) / 1000.0;
System.out.println("done adding "+ statementList.size()+ " statements in " +durationinseconds+ " seconds");
startTime = System.currentTimeMillis();
for (Statement statement : statementList){
SopranoStatementIterator it = model.listStatements(statement);
while (it.hasNext()){
it.next();
}
}
endTime = System.currentTimeMillis();
durationinseconds = (endTime - startTime) / 1000.0;
System.out.println("done querying "+ statementList.size()+ " statements in " +durationinseconds+ " seconds");
System.exit(0);
Node subject = new Node(new URI("http://S2"));
Node predicate = new Node(new URI("http://P3"));
Node object = new Node(new URI("http://O2"));
Node context = new Node(new URI("http://C6"));
Statement partial = new Statement(subject, predicate, object,
context);
System.out.println("querying 1 specific");
SopranoStatementIterator iterator = model.listStatements(partial);
counter = 0;
while (iterator.hasNext()) {
Statement st = iterator.next();
counter++;
System.out.println(st);
}
System.out.println("Done querying " + counter);
//System.out.println("querying 100 with only object set.");
//subject = new Node();
//predicate = new Node();
//object = new Node(new URI("http://O2"));
//context = new Node();
//partial = new Statement(subject, predicate, object, context);
//iterator = model.listStatements(partial);
//counter = 0;
//while (iterator.hasNext()) {
// Statement st = iterator.next();
// counter++;
// System.out.print(".");
//}
//System.out.println("Done querying " + counter);
System.out.println("querying all with nothing set.");
subject = new Node();
predicate = new Node();
object = new Node();
context = new Node();
partial = new Statement(subject, predicate, object, context);
startTime = System.currentTimeMillis();
iterator = model.listStatements(partial);
counter = 0;
while (iterator.hasNext()) {
Statement st = iterator.next();
// counter++;
// if (counter % 100 == 0) {
// System.out.print(".");
// }