AGAddStatements.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGAddStatements {
    
@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("addstatements", AGPaths.TRIPLE_STORES);
        
        
        ts.addStatement("<http://example.org/Dog>",  
                "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",  
                "<http://www.w3.org/2002/07/owl#Class>"); 
        
        
        
        
        ts.addStatements(  
        new String[]{  
            "<http://example.org/Cat>",  
            "<http://example.org/Dog>",  
            "<http://example.org/Giraffe>",  
            "<http://example.org/Lion>" },  
        new String[]{  
            "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",  
            "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",  
            "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>",  
            "<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>" },  
        new String[]{  
            "<http://www.w3.org/2002/07/owl#Class>",  
            "<http://www.w3.org/2002/07/owl#Class>",  
            "<http://www.w3.org/2002/07/owl#Class>",  
            "<http://www.w3.org/2002/07/owl#Class>" }  
        );                             
        
        
        
        
        ts.addStatements(  
            new String[]{  
                "<http://example.org/Cat>",  
                "<http://example.org/Dog>",  
                "<http://example.org/Giraffe>",  
                "<http://example.org/Lion>" },  
            new String[]{"<http://www.w3.org/2000/01/rdf-schema#subClassOf>"},  
            new String[]{"<http://example.org/Mammal>"}  
        ); 
        
        System.out.println("Added " + ts.numberOfTriples() + " triples to the store.");
        
        
        ts.closeTripleStore();
        ags.disable();
    }
}
Up | 
Next