AGTemporalPointPointRelations.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGTemporalPointPointRelations {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
AllegroGraph ts = ags.renew("temporal", AGPaths.TRIPLE_STORES);
String[] map = new String[3];
map[0] = "http://www.w3.org/2000/01/XMLSchema#dateTime";
map[1] = "date-time";
map[2] = "datatype";
ts.addDataMapping(map);
AGUtils.loadNTriplesWithTiming(ts, AGPaths.dataSources("temporal.nt"));
AGUtils.indexAllTriplesWithTiming(ts);
ts.registerNamespace("ex", "http://example.org/");
ts.registerNamespace("t", "http://franz.com/ns/allegrograph/3.0/temporal/");
String pquery = "(?pt ?dt)" + "(q ?pt !t:time ?dt)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?pt)"
+ "(point-simultaneous ?pt !ex:pt3)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?pt)"
+ "(point-before ?pt !ex:pt3)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?pt)"
+ "(point-before !ex:pt3 ?pt)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?pt)"
+ "(point-after ?pt !ex:pt6)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?pt)"
+ "(point-after !ex:pt6 ?pt)";
AGUtils.doPrologSelectDistinct(ts, pquery);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next