import com.franz.agraph.repository.AGRepository;
import com.franz.agraph.repository.AGRepositoryConnection;
import com.franz.agraph.repository.AGValueFactory;
import com.franz.agraph.repository.AGModel;
String serverURL = "http://localhost:10035";
String repositoryID = "myRepository";
String username = "myUsername";
String password = "myPassword";
AGRepository repo = new AGRepository(serverURL, repositoryID, username, password);
AGRepositoryConnection conn = repo.getConnection();
AGValueFactory vf = conn.getRepository().getValueFactory();
String graphURI = "http://example.com/myGraph";
AGModel graph = new AGModel(conn, vf, graphURI);
String subjectURI = "http://example.com/subject";
String predicateURI = "http://example.com/predicate";
String objectURI = "http://example.com/object";
graph.add(vf.createURI(subjectURI), vf.createURI(predicateURI), vf.createURI(objectURI));
String queryString = "SELECT ?s ?p ?o WHERE { ?s ?p ?o }";
TupleQuery tupleQuery = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
TupleQueryResult result = tupleQuery.evaluate();
while (result.hasNext()) {
BindingSet bindingSet = result.next();
System.out.println(bindingSet);
}
conn.close();
repo.shutDown()