@@ -0,0 +1,2729 @@
+package won.node.service.linkeddata.generate;%0A%0Aimport java.net.URI;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0Aimport java.util.stream.Stream;%0A%0Aimport org.apache.jena.rdf.model.Model;%0Aimport org.apache.jena.rdf.model.ModelFactory;%0Aimport org.apache.jena.rdf.model.Resource;%0Aimport org.apache.jena.vocabulary.RDFS;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0Aimport org.springframework.util.StopWatch;%0A%0Aimport won.protocol.util.CheapInsecureRandomString;%0A%0A@Ignore%0Apublic class RdfManipulationSpeedTest %7B%0A    CheapInsecureRandomString rnd = new CheapInsecureRandomString();%0A%0A    /**%0A     * Shows: adding to model is relatively stable, performance degrades somewhat.%0A     */%0A    @Test%0A    public void testAddToModel() %7B%0A        StopWatch sw = new StopWatch();%0A        for (int i = 0; i %3C 1000; i += 10) %7B%0A            Model m = ModelFactory.createDefaultModel();%0A            Resource main = m.getResource(%22uri:/main%22);%0A            int count = i * 1000;%0A            List%3CURI%3E uris = generateURIs(count);%0A            sw.start();%0A            addToModel(m, main, uris);%0A            sw.stop();%0A            long millis = sw.getLastTaskTimeMillis();%0A            System.out.println(%22Adding %22 + count + %22 uris takes %22 + millis + %22 millis, that's %22%0A                            + (double) millis / ((double) count / 1000) + %22 per 1000 uris%22);%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testUriCreate() %7B%0A        StopWatch sw = new StopWatch();%0A        sw.start();%0A        int count = 1000000;%0A        for (int i = 0; i %3C count; i++) %7B%0A            generateURI();%0A        %7D%0A        sw.stop();%0A        long millis = sw.getLastTaskTimeMillis();%0A        System.out.println(%22Creating %22 + count + %22 uris takes %22 + millis + %22 millis, that's %22%0A                        + (double) millis / ((double) count / 1000) + %22 per 1000 uris%22);%0A        sw.start();%0A        for (int i = 0; i %3C count; i++) %7B%0A            generateURIString();%0A        %7D%0A        sw.stop();%0A        millis = sw.getLastTaskTimeMillis();%0A        System.out.println(%22Creating %22 + count + %22 uri strings takes %22 + millis + %22 millis, that's %22%0A                        + (double) millis / ((double) count / 1000) + %22 per 1000 uris%22);%0A    %7D%0A%0A    private Model addToModel(Model m, Resource main, List%3CURI%3E uris) %7B%0A        uris.forEach(uri -%3E m.add(main, RDFS.member, m.getResource(uri.toString())));%0A        return m;%0A    %7D%0A%0A    private List%3CURI%3E generateURIs(int num) %7B%0A        return Stream.generate(() -%3E generateURI()).limit(num).collect(Collectors.toList());%0A    %7D%0A%0A    private URI generateURI() %7B%0A        return URI.create(%22uri:/new-uri/%22 + rnd.nextString(30));%0A    %7D%0A%0A    private String generateURIString() %7B%0A        return %22uri:/new-uri/%22 + rnd.nextString(30);%0A    %7D%0A%7D%0A

Add small test for checking speed of RDF manipulation