AGLoadNtriples.java
package com.franz.ag.examples;
import com.franz.ag.*;
import org.openrdf.model.URI;
public class AGLoadNtriples {
@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("testnt", AGPaths.TRIPLE_STORES);
String ntripleFile = AGPaths.dataSources("test.nt");
System.out.println("Loading N-Triples " + ntripleFile);
ts.loadNTriples(ntripleFile);
System.out.println("Loaded " + ts.numberOfTriples() + " triples.");
Cursor cc = ts.getStatements(null, null, null);
AGUtils.showTriples(cc);
URI g = ts.createURI("http://example.org/kennedy");
long n = ts.loadNTriples(AGPaths.dataSources("kennedy.ntriples"), g);
System.out.println("Loaded " + n + " triples.");
cc = ts.getStatements(null, null, ts.createLiteral("Arnold"), g);
AGUtils.showTriples(cc);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next