AGCreateURI.java
package com.franz.ag.examples;
import com.franz.ag.*;
import org.openrdf.model.URI;
public class AGCreateURI {
    
@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("createuri", AGPaths.TRIPLE_STORES);
        
        
        URI subject = ts.createURI("http://example.org/Dog");  
        URI predicate = ts.createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");  
        URI object = ts.createURI("http://www.w3.org/2002/07/owl#Class");
        
        AGUtils.showURI(subject);
        AGUtils.showURI(predicate);
        AGUtils.showURI(object);
        
        ts.addStatement(subject, predicate, object);
        
        
        URI u = (URI)ts.addURI("http://www.w3.org/2002/07/owl#Class");
        AGUtils.showURI(u);
        
        
        URI v = (URI)ts.addPart("<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>");
        AGUtils.showURI(v);
        
        ts.closeTripleStore();
        ags.disable();
    }
}
Up | 
Next