AGTemporalPointIntervalRelations.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGTemporalPointIntervalRelations {
@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)"
+ "(point-before-interval ?pt !ex:i36)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?i)"
+ "(point-starts-interval !ex:pt3 ?i)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?pt)"
+ "(point-during-interval ?pt !ex:i36)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?i)"
+ "(point-ends-interval !ex:pt6 ?i)";
AGUtils.doPrologSelectDistinct(ts, pquery);
pquery = "(?pt)"
+ "(point-after-interval ?pt !ex:i36)";
AGUtils.doPrologSelectDistinct(ts, pquery);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next