Hello,
I'm programmatically filling up Stardog with some data that should be used for testing (the whole app is basically a test, this is a simulation), and it goes something like this:
for (int i = 0; i < 15000; i++) {
BNode hrBnode = factory.createBNode();
int heartrate = <some calculation>
Literal value = factory.createLiteral(heartrate);
Literal time = factory.createLiteral(dt.toDate());
m.add(factory.createStatement(patient, hasHeartrate, hrBnode));
m.add(factory.createStatement(hrBnode, hasValue, value));
m.add(factory.createStatement(hrBnode, observationTime, time));
dt = dt.plusSeconds(1);
if(i % 1000 ==0 )
System.out.println(String.valueOf(i));
}
connection.begin();
connection.add(m);
connection.commit();
connection.close();
The issue is that the Literal time = factory.createLiteral(dt.toDate()); is very, very slow. I can litteraly measure the latency with it in seconds. I've ran it through the profiler an it consumes over 71% of the CPU time. When I put some stub instead (for example createLiteral(long l)) it goes much, much faster. The issue is I will probably have to use the createLiteral(Date d) in production. I can fall back to the (long l) version but then I lose time zone information and articulated time comparison, it comes down to numbers, and that's not a really good idea.
Has anyone noticed this before? Any other advice about the idea in full?
Tnx in advance.