AGOpenTripleStore.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGOpenTripleStore {
@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);
}
System.out.println("Access: open a store, creating if necessary.");
AllegroGraph ts = ags.access("existingstore", AGPaths.TRIPLE_STORES);
ts.closeTripleStore();
System.out.println("Open: open an existing store, error otherwise.");
ts = ags.open("existingstore", AGPaths.TRIPLE_STORES);
System.out.println("Triple store opened with " + ts.numberOfTriples() + " triples.");
ts.closeTripleStore(true);
System.out.println("Open an existing store read-only.");
ts = new AllegroGraph(AGPaths.TRIPLE_STORES + "existingstore");
ts.setAttribute("read-only", new Boolean(true));
ags.open(ts);
try {
ts.indexAllTriples();
} catch (Exception e) {
System.out.println(e.getLocalizedMessage());
}
System.out.println("Disconnecting from the server.");
ags.disable();
System.out.println("Done.");
}
}
Up |
Next