AGLoadWithPredicateMapping.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGLoadWithPredicateMapping {
@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("datamapping", AGPaths.TRIPLE_STORES);
String[] map = new String[9];
map[0] = "http://franz.com/ns/allegrograph/3.0/temporal/time";
map[1] = "date-time";
map[2] = "predicate";
map[3] = "http://franz.com/ns/allegrograph/3.0/temporal/starttime";
map[4] = "date-time";
map[5] = "predicate";
map[6] = "http://franz.com/ns/allegrograph/3.0/temporal/endtime";
map[7] = "date-time";
map[8] = "predicate";
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/");
Cursor cc = ts.getStatements(null, "!t:starttime", null);
AGUtils.showTriples(cc);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next