AGLoadUsingRapper.java
package com.franz.agbase.examples;
import com.franz.agbase.*;
public class AGLoadUsingRapper {
public static int port = 4567;
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.setPort(port);
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
AllegroGraph ts = ags.renew("Wine", AGPaths.TRIPLE_STORES);
try {
long start = System.nanoTime();
long n = ts.loadRDFXML(AGPaths.dataSources("wilburwine.rdf"), "", null, true, false);
long delta = System.nanoTime() - start;
System.out.println("Done loading " + n + " triples in " + (delta/1000000000.0) + " seconds.");
TriplesIterator it = ts.getStatements(null, null, null);
AGUtils.showTriples(it, 20);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("unable-to-find-rapper-error")) {
throw new AllegroGraphException("Rapper was not found. Please ensure you have Rapper installed and that it is accessible to the server.");
} else {
throw new AllegroGraphException(e.getMessage());
}
}
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next