3 Replies Latest reply on Jan 29, 2010 3:51 PM by 715399

    Check model existence in Oracle11g

      How can I check the model existence in Oracle11g using jena adapter 2.
      I want my application to display specific error message if the model is not exists in the database.

      For example I already have Cardiovascular and Pediatric model in the database.
      But when I want to query for other model i.e. OccupationalHealth my application will automatically create the OccupationalHealth model and its related table(s) . My question is how can I control the auto creation of model in Oracle 11g using jena adapter 2 library?

      Code sinppet :
      GraphOracleSem graph = null;
      ModelOracleSem modelSem = null;
      ResultSet newResultSet = null;
      QueryExecution qexec = null;

      graph = new GraphOracleSem(oracleConn, "Cardiovascular");
      modelSem = new ModelOracleSem(graph);

      qexec = QueryExecutionFactory.create(QueryFactory.create(query),
      resultSet = qexec.execSelect();

      Your help is much appreciated.

      Yours tryly,
        • 1. Re: Check model existence in Oracle11g
          Hi NLia,

          You might want to look at the OracleUtils.getAllReadableModels(Oracle oracle) function. It returns a list of all the models readable by the user who established the Oracle session.

          • 2. Re: Check model existence in Oracle11g
            Hi Vladimir,
            Thanks for your reply.
            Which version of Oracle Jena Adapter you were using?
            I'm using Jena Adapter 2 and the function that you referred to is not exist.

            • 3. Re: Check model existence in Oracle11g
              Hi NLia,

              I see. OracleUtils.getAllReadableModels is available in the latest version of the Jena Adaptor (11.2). I suggest upgrading your database and the Jena Adaptor version if possible, since it contains many new features and optimizations.

              One alternative is to query the semantic model views directly from your Java application. This statement: "SELECT 1 FROM MDSYS.SEM_MODEL$ WHERE MODEL_NAME=?" should do the trick. Please consult the official documentation for more information on the MDSYS.SEM_MODEL$ view.