AGLoadRDF.java
package com.franz.ag.examples;
import com.franz.ag.*;
import org.openrdf.model.URI;
public class AGLoadRDF {
@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("loadRDF", AGPaths.TRIPLE_STORES);
String rdf = AGPaths.dataSources("rdf-axioms.rdf");
System.out.println("Loading RDF from " + rdf);
Long n = ts.loadRDF(rdf);
System.out.println("Loaded " + n + " triples.");
Cursor cc = ts.getStatements(null, null, null);
AGUtils.showTriples(cc);
URI g = ts.createURI("http://example.org/wilburwine");
n = ts.loadRDF(AGPaths.dataSources("wilburwine.rdf"), g);
System.out.println("Loaded " + n + " triples.");
cc = ts.getStatements(null, null, null, g);
AGUtils.showTriplesWithLimit(cc, 20);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next