@@ -0,0 +1,2459 @@
+/**%0A * %0A */%0Apackage com.github.podd.restlet.test;%0A%0Aimport org.openrdf.model.Statement;%0Aimport org.openrdf.model.URI;%0Aimport org.openrdf.repository.Repository;%0Aimport org.openrdf.repository.RepositoryConnection;%0A%0A/**%0A * This class contains static methods to help debug contents of an RDF repository%0A * %0A * @author kutila%0A *%0A */%0Apublic class RdfUtils%0A%7B%0A    %0A    /**%0A     * Helper method prints the contents of the given context of a Repository%0A     */%0A    public static void printContents(Repository repository, final URI context) throws Exception%0A    %7B%0A        final RepositoryConnection conn = repository.getConnection();%0A        conn.begin();%0A        %0A        System.out.println(%22==================================================%22);%0A        System.out.println(%22Graph = %22 + context);%0A        System.out.println();%0A        final org.openrdf.repository.RepositoryResult%3CStatement%3E repoResults =%0A                conn.getStatements(null, null, null, false, context);%0A        while(repoResults.hasNext())%0A        %7B%0A            final Statement stmt = repoResults.next();%0A            System.out.println(%22   %7B%22 + stmt.getSubject() + %22%7D   %3C%22 + stmt.getPredicate() + %22%3E  %7B%22 + stmt.getObject()%0A                    + %22%7D%22);%0A        %7D%0A        System.out.println(%22==================================================%22);%0A        %0A        conn.rollback();%0A        conn.close();%0A    %7D%0A    %0A    /**%0A     * Helper method prints the contents of the given context of a Repository%0A     */%0A    public static void printContexts(Repository repository) throws Exception%0A    %7B%0A        final java.util.HashSet%3CString%3E contextSet = new java.util.HashSet%3CString%3E();%0A        %0A        final RepositoryConnection conn = repository.getConnection();%0A        conn.begin();%0A        final org.openrdf.repository.RepositoryResult%3CStatement%3E repoResults =%0A                conn.getStatements(null, null, null, true);%0A        while(repoResults.hasNext())%0A        %7B%0A            final Statement stmt = repoResults.next();%0A            contextSet.add(stmt.getContext().stringValue());%0A        %7D%0A        %0A        System.out.println(%22==================================================%22);%0A        System.out.println(%22Contexts in Repository:  %22);%0A        for(final String context : contextSet)%0A        %7B%0A            System.out.println(context);%0A        %7D%0A        System.out.println(%22==================================================%22);%0A        %0A        conn.rollback();%0A        conn.close();%0A    %7D%0A    %0A    %0A%7D%0A

add helper class for debugging RDF repository contents