3 Replies Latest reply on Mar 15, 2010 9:48 PM by 715399

    semantic model size


      I'm working with oracle 11g and Jena Adaptor for Oracle Database 11g Release 2.

      I'm trying a simple test that add triples:
      public void testAddTriples() throws Exception {

           Oracle oracle = new Oracle(jdbcUrl, null, null);
           GraphOracleSem graph = new GraphOracleSem(oracle, MODEL_NAME);

           for (int i=0;i<1000;i++) {
                Node sub = Node.createURI("http://test/s_" + i);
                Node pre = Node.createURI("http://test/p_" + i);
                Node obj = Node.createURI("http://test/o_" + i);
                Triple triple1 = Triple.create(sub, pre, obj);


      After running the previous test for several times, I have realized that depending on the method used to remove the triples the space of the tablespace is released or not.

      For instance, if I use the method "model.removeAll()" and then check the free space of the tablespace, I can see that the free space is greater than before, but, in the other hand, If I use the method "model.remove(model.listStatements())" the free space doesn't change... so when I run again the test "testAddTriples()" the disk space keep on growing.

      Any idea?

      Thanks in advance.

      Edited by: user9344030 on 15-mar-2010 10:19
        • 1. Re: semantic model size

          Model.removeAll() does a truncate (DDL operation) behind the scenes, whereas model.remove(model.listStatements()) does a DML. This might explain why free space is reclaimed immediately in the tablespace with model.removeAll().

          • 2. Re: semantic model size
            Hello, we have similar issue with our project. Two questions about this:

            First, if you need to run some jena code with a user with no ddl privileges over the model, and just can use model.remove(model.listStatements()), is there any way to force the release of that space in the tablespace?

            And second, when we execute many times a test very similar to the one above, we notice the space used by the tablespace grows indefinitely. The number of rows in the table of the model continues to grow, even when the triples stored in each execution are exactly the same!! We know the cleanup can be forced calling SEM_APIS.REMOVE_DUPLICATES, but is there another way of having Oracle do this automatically?

            Thank you
            • 3. Re: semantic model size

              If you mean that your tablespace has grown from adding new triples and you want to reduce the size of the datafiles after removing those triples, then you could shrink the tablespace as discussed here:

              About the second question, the number of rows in the application table grows because duplicates are allowed in the application table. Note that you will not get any duplicates back when you query them using SEM_MATCH of Jena Adapter - this is because of the RDF semantics - however, they are stored in the application table nevertheless. If you want to avoid storing duplicates, you could create a unique index on the application table.