3 Replies Latest reply on May 10, 2010 7:56 AM by 766393

    Renaming / Dropping model leaves table behind

    766393
      Hi,

      When using OracleUtils to rename a model, the table the model is based on stays the same.
      I am not sure whether this is the expected behaviour but it raises an issue.

      Lets say a model was created via ModelOracleSem before with the name "Test". A table "Test_tpl" was also created.
      Then you call :
      OracleUtils.renameModel(oracle, "Test", "Test2");

      The model is successfully renamed, but the underlying table stays "test_tpl".
      The problem is that if you try to create a new model named "Test" via ModelOracleSem.createOracleSemModel it fails with the following output :
      java.sql.SQLException: No such RDF model: TEST
           at oracle.spatial.rdf.client.jena.GraphOracleSem.retrieveModelId(GraphOracleSem.java:1889)
           at oracle.spatial.rdf.client.jena.GraphOracleSem.<init>(GraphOracleSem.java:1074)
           at oracle.spatial.rdf.client.jena.GraphOracleSem.<init>(GraphOracleSem.java:705)
           at oracle.spatial.rdf.client.jena.GraphOracleSem.<init>(GraphOracleSem.java:528)
           at oracle.spatial.rdf.client.jena.ModelOracleSem.createOracleSemModel(ModelOracleSem.java:75)

      I used the following workaround :

      OracleUtils.renameModel(oracle, oldModelName, newModelName);
      oracle.executeSQL("RENAME " + oldModelName + "_TPL TO " + newModelName + "_TPL");

      But how can I be sure that the underlying table is indeed oldModelName_TPL ?

      Thanks
      Regards

      Julien
        • 1. Re: Renaming / Dropping model leaves table behind
          766393
          By the way, should I also rename the _NS table ?                                                                                                                                                                                                               
          • 2. Re: Renaming / Dropping model leaves table behind
            715399
            Hi Julien,

            That's the expected behavior. The main reason is that, in general, there is no clear correlation between application table name and model name. However, in Jena Adapter, unless specified differently in the GraphOracleSem constructor, the table name is given as [modelName]_TPL (same thing with namespace table name: [modelName]_NS).

            So, if you're using Jena Adapter, your workaround is fine - I'd recommend renaming the namespace table as well.


            Also, you could use GraphOracleSem.getApplicationTableName() function before renaming to be certain.

            Regards,
            Vladimir
            • 3. Re: Renaming / Dropping model leaves table behind
              766393
              Perfect, thanks.