franz inc logo  
  download learning center franz inc search franz inc resources franz inc          

allegrograph
racer
tbc
services
support
  Learning Center
  Documentation
  Updates
     Info
  FAQ
about

RSS Feeds

AllegroServe at opensource.franz.com

AGCloseTripleStore.java

package com.franz.ag.examples;

import com.franz.ag.*;

public class AGCloseTripleStore {

    /**
     * Demonstrates basics of closing a triple store
     * 
     * @param args unused
     * @throws AllegroGraphException
     */
    public static void main(String[] args) throws AllegroGraphException {
        
        // Connect to the server, which must already be running.
        AllegroGraphConnection ags = new AllegroGraphConnection();
        try {
            ags.enable();
        } catch (Exception e) {
            throw new AllegroGraphException("Server connection problem.", e);
        }

        // Create a fresh triple store.
        AllegroGraph ts = ags.renew("newstore", AGPaths.TRIPLE_STORES);
        System.out.println("New triple store opened with " + ts.numberOfTriples() + " triples.");

        // Close the triple store
        System.out.println("Closing the triple store.");
        ts.closeTripleStore();

        // It's an error to access a closed triple store
        System.out.println("Attempting to get the closed store's triple count.");
        try {
            ts.numberOfTriples();
        } catch (IllegalStateException e) {
            System.out.println("Expected Error: " + e.getMessage());
        }
        
        // Disconnect from the server
        System.out.println("Disconnecting from the server.");
        ags.disable();
        System.out.println("Done.");
        
    }
    
}

Up | Next

 

© 2008 Franz Inc - Privacy Statement
[ Consulting Services | Franz | TopQuadrant | Racer Systems ]