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),
                         model);
resultSet = qexec.execSelect();
Your help is much appreciated.
Yours tryly,
NLia

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.
Cheers,
Vladimir

Similar Messages

  • Checking for existence of a record in csv file

    Hey all, I have two csv files residing on the server that I will be processing using the UTL_FILE package. One of these files (File A) has only one column and the other one (File B) has over ten. The data in file A is the same as the one in column 2 of File B. File A is mainly there for a lookup purpose whereas File B is the one that has all the data that will be processed. The following example should describe better:
    File A[b]
    Number
    "TR_56575"
    "TY_76756"
    etc
    File B
    Column1, Number, Column3, Column4
    "Mine","TR_56575","uhsht","76744"
    "Yours","TY_76756","nghdjd","45645"
    What I have to do is check whether a Number in File B exists anywhere in File A. If it does then I just skip that record and move on to the next. So basically, I wanted to find out if there is any way to compare the two columns on the server side. I know there is a dbms_lob.fileexists function to check the existence of a file on a server, just wanted to see if there is an extension to that or something that checks the existence of a string in file. Any feedback would be appreciated. Thanks.

    Yeah I thought about that. It would be the ideal way to go, however in this case, I already have a Pl/Sql procedure that grabs File B and just processes it from the server. It works fine and everything but now that this extra logic and file is added where I have to check the existence of a corresponding record in File A, I'm just looking for something to add in my code to just make the comparison on the fly and the rest would be the same.

  • I had downloaded Mountain OX and installed it on my macbook air.  The notes app is now not working.  I get the following message erminating app due to uncaught exception 'MFSQLiteException', reason: 'checking for existence of object' abort() called termin

    i had downloaded Mountain OX and installed it on my macbook air.  The notes app is now not working.  I get the following message
    "Terminating app due to uncaught exception 'MFSQLiteException', reason: 'checking for existence of object'
    abort() called
    terminate called throwing an exception"
    Can someone help me with solving the problem.

    i had downloaded Mountain OX and installed it on my macbook air.  The notes app is now not working.  I get the following message
    "Terminating app due to uncaught exception 'MFSQLiteException', reason: 'checking for existence of object'
    abort() called
    terminate called throwing an exception"
    Can someone help me with solving the problem.

  • Check Index Existence - Trex SOLMAN Solution Database Issue

    Hi Experts,
    I have done all the configuration part for having solution database functionality in SAP SOLMAN system. Our basis team has also installed TREX successfully.
    But while checking in transaction CRMC_SAF_TOOL, everything is green except Check ndex Existence.
    We are getting the below error messages:
    Failed [Check=Index Existence ,Knowledge Base=SDB ,Language=E]
    Failed [0 ]
    Failed [No. of Documents=1-]
    On discussion with Basis Team, I came to know that Indexes are getting created at putty level and while going to the indexes (Menu - Goto- Indexex (F8) in CRMC_SAF_TOOL, everything is seems to be fine and successful. No error there.
    Please suggest where I am going wrong as I am still not able to search in IS02.
    Thanks & Regards,
    Madhu

    Hello,
    Sometimes this error is seen when an older version of Trex being used.
    Are you on a current version of Trex? If not you may want to consider upgrading to a current version?
    Additionally, sometimes documents saved via content management cannot be indexed,
    as no url can be determined for them.
    4. knowledgebase SDB_ATTACHMENT:
       The URL's do not get determined and this is why nothing would be
       put to TREX.
       Herefore, please follow the following note:
       685521 Logon data for /sap/bc/contentserver service
    This may explain the HTTP:/no. DOcuments =1- error ???
    So please ensure you have set the URL for the content server as per Note 685521
    Regards,
    Paul

  • Check table existence method

    I have the following Java method that is suppose to determine whether a given table exists or not:
    public boolean tableExists(String table) {
    String defstmt = "select TABLE_NAME from ALL_TABLES where (TABLE_NAME = '" + table + "')";
    System.err.println("tableExists: stmt = " + defstmt);
    tc.executeSEL(defstmt);
    ResultSet rs = tc.getRS();
    String tname = new String();
    try {
    while (rs.next()) {
    rs.getString(tname);
    System.err.println("tableExists.try: tname = " + tname);
    rs.close();
    return true;
    catch (SQLException ex) {
    System.err.println("tableExists.catch: tname not found");
    try {
    rs.close();
    catch (SQLException ex1) {
    return false;
    Since this one didn't appear to work reliabily a friend suggested the following:
    public boolean tableExists(String table) {
    boolean exists = false;
    String defstmt = "select TABLE_NAME from ALL_TABLES where (TABLE_NAME = '" + table + "')";
    System.err.println("tableExists: stmt = " + defstmt);
    if (tc.executeSEL(defstmt)) {
    ResultSet rs = tc.getRS();
    try {
    exists = rs.first();
    // This returns false if the rs is empty
    // This should be sufficient if the query will return zero rows or one row.
    // If there's a possibility that the query could return more than one row
    // (for example if multiple schema data is in there and a table name
    // might be duplicated), then this section will need to be more picky.
    System.err.println("tableExists.try: tname found");
    catch (SQLException ex) {
    System.err.println("tableExists.catch: tname not found");
    try {
    rs.close();
    catch (SQLException ex1) {
    return exists;
    Bottom line; neither method seems to be able to determine whether the table exists. Someone out there got any suggestions?
    Thanks in advance
    RCulp

    The method "tc.executeSEL" is in a class "TableConnector" which I use to hold connection data and execute SQL statements. A new instance of the "TableConnector" class is created for each table prior to the check for existence. The method itself is boolean, returning true or false if the SQL runs successfully:
    public boolean executeSEL(String inpstmt) {
    rs = null;
    try {
    Connection conn = ConnectionData.getConnectionData().openConnection();
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    rs = stmt.executeQuery(inpstmt);
    return true;
    //debugdumpRS(rs);
    catch (SQLException ex) {
    System.err.println("SEL Statement = " + inpstmt);
    System.err.println("Error code = " + ex.getErrorCode());
    System.err.println("Error message = " + ex.getMessage());
    System.err.println("SQL state = " + ex.getSQLState());
    return false;
    /*FINALLY CAN NOT BE USED HERE; ERASES THE RESULT SET
    finally {
    if (stmt != null) {
    try {
    stmt.close();
    catch (SQLException ex) {
    System.err.println("Error code = " + ex.getErrorCode());
    System.err.println("Error message = " + ex.getMessage());
    The TableConnector class also has a get method for the ResultSet:
    public ResultSet getRS() {
    return rs;
    I'll try your suggestion and post the result.
    Thanks
    RCulp

  • Check directory existence

    I am developing an application in Oracle Forms 6i.
    What the syntax for checking the existence of a specified directory for example
    'd:\oracle'

    Hello,
    Another way is to use a Host() command
    Host('cmd /c dir /b f:\*.* > c:\test.lst');Then open the local c:\test.lst to read the content.
    <p>
    You can also do the same without writing any file with this Java Bean.
    </p>
    Francois

  • Is there any FUNCTION I can use to check the existence of a USER?

    Hi,
    Is there any FUNCTION I can use to check the existence of a USER? I dont want to write a function by myself to access usr01 directly.
    Thanks in advance.

    You can use FM USER_EXISTENCE_CHECK
    Thanks
    Seshu

  • How to check (programmatic) existence of a method in a class implementation

    Hi
    I need to check the existence of method in a class in a programmatic way and call it only when it is available otherwise proceed with subsequent steps in my ABAP OO Program. Is there way to do it? This is needed in a customer exit situation and each task is implemented with method and not all tasks would have methods implemented.
    Any feedback is greatly appreciated.
    Thanks

    When you try to call the method dynamically and ifthe method doesn't exist, system would complain by raising the exception cx_sy_dyn_call_illegal_method. You can Catch this exception when you call the method.
    CLASS lcl_test DEFINITION.
      PUBLIC SECTION.
        METHODS:
          check_exist.
    ENDCLASS.                    "lcl_test DEFINITION
    DATA: lo_test TYPE REF TO lcl_test.
    DATA: lv_method TYPE char30.
    lv_method = 'GET_DATA'.
    CREATE OBJECT lo_test.
    TRY.
        CALL METHOD lo_test->(lv_method).
      CATCH cx_sy_dyn_call_illegal_method.
    ENDTRY.
    CLASS lcl_test IMPLEMENTATION.
      METHOD check_exist.
      ENDMETHOD.                    "check_exist
    ENDCLASS.
    Regards,
    Naimesh Patel

  • How to check the existence of DB400 library from java

    Hi all,
    I actunally need to validate a DB400 library via java. so is there any way to check the existence of DB400 library from java side.
    Thanks in advance.

    Hi Sarvan,
    You might not even need a function to tell you if a record exists or not.
    Here in below example i do a check with exists .you will find couple of other ways too..
    create table t as select * from emp where deptno=10now i set salary of every person present in table 'T' to 1111 in emp table.
    update emp e
    set sal=1111
    where exists
            (select 1
              from t
              where t.empno=e.empno) Remember that plain SQL will always outperform PLSQL.
    Hope it helps
    CKLP
    Edited by: CKLP on Sep 26, 2011 3:41 AM

  • How to check the existence of file without any error dialog?

    Hi everybody,
    I am trying update some labview programs from LV6.1 to LV7.1, I used the
    function "File/Dictionary Info" to check if the file
    exists or not (if the size=0 then file does not exist), and it ran well with
    LV6.1, but now it shows every time a labview error dialog
    about "LabView: file not found..." with 7.1, if this file dosn't exist.
    Sometimes I feel that it is really stupid to show the dialog, because I
    can write handling by myself, if the error should be handled, and
    I don't want all the process is interrupted because of such dialogs. Is
    there any way to shut the dialog down or check the existence of
    file smoothly?
    Thanks a lot!
    L.Wang

    Hello,
    The dialog is probably appearing because you have Auto Error Handling turned on.  This feature is turned on by default in LabVIEW 7.0.  You should go to VI Properties (Ctrl-I) > Execution and deselect "Enable automatic error handling".  Also you should go to Tools > Options > New and Changed in LabVIEW 7.x and deselect "Enable automatic error handling in new VIs".  If you never want to see one of those dialogs again, you can also deselect "Enaeble automatic error handling dialogs"...I wouldn't recommend this, however, as you would never know if one of your VIs had this setting enabled...you would only find out once somebody else tried to use your VI on another LabVIEW install.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Procedure to check the existence of Indexes

    I have a procedure whcih drops all the indexes, when the same procedure is executed again, it gives error "object does not exists" (obviously)
    I want to avoid this error, how can I check the existence of index inside the procedure, so that the procedure will check if the index exists before deleting the index?
    Is there a ready-made procedure available for such scenario?
    Thanks in advance

    The other approach is to catch the exception in your script, i.e.
    BEGIN
      EXECUTE IMMEDIATE 'DROP INDEX <<index name>>';
    EXCEPTION
      WHEN OTHERS THEN
        -- Drop failed.  Do something to record the failure.
        NULL;
    END;Now, most of the time, you'll want to catch a few specific exceptions and you'll want to do something when you catch them (i.e. generate a log entry).
    Justin

  • Programmatically check the existence of objects in the system

    Hi,
    Is there a way to programmatically check the existence of objects? The idea is I'll accept a list of names of objects and their object types and then programmatically check their existence in the system?
    Can you point me to a resource on how to do it?
    Thanks in advance.
    --Carl

    Hi.
    All custom objects (z, y) being referred to a program. May it be z or y table, data element, domain, sapscript form, function module/group.
    The goal is actually to be able to transport a program from a source machine to a target machine. The objects being referred to from the program must also be transported, of course, for it to run properly. Thus, the need to check the objects' existence.
    Thanks.
    --Carl

  • Check for existence of a record

    I have a table XX_TEMP. Let us say the columns are inventory_item, organization_id and description
    The values are:
    Inventory_item
    Organization
    Description
    200
    m1
    Sample
    200
    m2
    Not Sample
    400
    m4
    check
    700
    m5
    Test
    I just want to check the existence of an item in the table, I have written two queries and would like to know which one is better in terms of performance:
    Q1:
    select count(1) from xx_temp where inventory_item=200 and rownum=1;
    Q2:
    select count(1) from dual where exists (select 1 from xx_temp where inventory_item=200);
    Both Q1 and Q2 return the same result. In fact, I was surprised with the result from Q1 as I expected that the rownum would be evaluated after the where condition. I expected Q1 to return 2
    I thought that the below query:
    select count(1) from xx_temp where inventory_item=200;
    and Q1 would return the same result as rownum would be evaluated at end. In effect, I've 2 questions:
    1. Isn't rownum calculated at the end?
    2. What is the best way in terms of performance to check for an existence of record?

    Internally this is how it works:
    select count(*) from xx_temp where inventory_item=200 and rownum=1;
      COUNT(*)
             1
    1 row selected.
    Execution Plan
       0       SELECT STATEMENT Optimizer Mode=ALL_ROWS (Cost=4 Card=1 Bytes=13)
       1    0    SORT AGGREGATE (Card=1 Bytes=13)
       2    1      COUNT STOPKEY
       3    2        TABLE ACCESS FULL XX_TEMP (Cost=4 Card=2 Bytes=26)
    Statistics
              5  user calls
              0  physical read total multi block requests
              0  physical read total bytes
              0  cell physical IO interconnect bytes
              0  commit cleanout failures: block lost
              0  IMU commits
              0  IMU Flushes
              0  IMU contention
              0  IMU bind flushes
              0  IMU mbu flush
              1  rows processed
    Plan
    1 Every row in the table XX_TEMP  is read.
    2 Processing was stopped when the specified number of rows from step 1 were processed.
    3 The rows were sorted to support a group operation (MAX,MIN,AVERAGE, SUM, etc).
    4 Rows were returned by the SELECT statement.
    COUNT STOPKEY knows how many rows you want and will just keep calling its child function under it in the execution plan tree to get more and more rows, until the required amount of rows have been returned. Here it stopped at 1 iteration.
    And to answer your second question : as to which is the fastest way to to check  for an existence of record :
    Answer would be it depends on your requirement.  possible answers are :  Rowid --  fastest way to check for a row.   similar answers can be Index etc.. but all this is relative to what you work with.
    Cheers,
    Manik.

  • [svn:bz-trunk] 23143: Certain code needs to check the existence of the class validation validator  (some brokers and other listeners) during message broker init, however the validator was not being created till the very end of the method .

    Revision: 23143
    Revision: 23143
    Author:   [email protected]
    Date:     2011-10-27 06:31:02 -0700 (Thu, 27 Oct 2011)
    Log Message:
    Certain code needs to check the existence of the class validation validator (some brokers and other listeners) during message broker init, however the validator was not being created till the very end of the method.  Promote it to be at the top instead of at the bottom.
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/config/MessagingConfiguration.java

    Revision: 23143
    Revision: 23143
    Author:   [email protected]
    Date:     2011-10-27 06:31:02 -0700 (Thu, 27 Oct 2011)
    Log Message:
    Certain code needs to check the existence of the class validation validator (some brokers and other listeners) during message broker init, however the validator was not being created till the very end of the method.  Promote it to be at the top instead of at the bottom.
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/config/MessagingConfiguration.java

  • Check  File Existence and display  alert message

    Hi,
    I have a servlet which uploads file to server. Below is my code and is working file. Now, I want to check if the file uploading by the user is already exists. If so , I have to display a message to user "The file you are trying to upload already exists. Do you want to overwrite" with YES or NO actions.
    How can I display this alert message from user.
    //item.write(tosave);
              FileItemFactory factory = new DiskFileItemFactory();
              boolean isMultipart = FileUpload.isMultipartContent(request);
              System.out.println(isMultipart);
              Map fileDetails = new HashMap();
              ServletFileUpload upload = new ServletFileUpload(factory);
              List items = upload.parseRequest(request);
              Iterator iter = items.iterator();
              while (iter.hasNext()) {
                   item = (FileItem) iter.next();
                        if (item.isFormField()) {
                                       String fieldName = item.getFieldName();     
                                       String fieldValue = item.getString();
                                       fileDetails.put("fileName",item.getString());
                        else {
                                  fileDetails.put("path",item.getName());
                                  cfile=new File(item.getName());
                                  onlyFileName = cfile.getName();
                   if (! folder.exists()) folder.mkdirs();
                   if(cfile.exists()){  //THIS CHECK THE FILE EXISTENCE.  HOW CAN I DISPLAY ALERT MESSAGE TO USER HERE.
                        System.out.println("File Already Exists Path is ");     
    Can anyone suggest me on this.

    It won't work like that because JavaScript will run either before the form is submitted or after the page has been generated. In either case, you can't really communicate between the server side code and client side code.
    What you can do is use Ajax to communicate with a servlet that checks for the duplicate file and responds accordingly. You can then perform the appropriate action on the page. This should be very simple to setup, take a look at this basic tutorial [1].
    [1] http://www.w3schools.com/ajax/default.asp
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
    ----------------------------------------------------------------

Maybe you are looking for

  • Office 2013 templates Group Policies

    There is a GPO related to Enterprise template locations in Office 2013 that is not clear at all and poorly documented. The path to the GPO is:  MS Office 2013 > Shared Paths > Enterprise templates path What is the purpose and how this path can be use

  • Error occurred  for the accounting cockpit

    Hi. When I tried to change the tab to "accounting" , there is error message display as the next. "Error occurred  in the accounting- see the accounting cockpit (cproject)" By the T-code "COCPCPR", I found the internal order with the error meeages. "N

  • Problem with Direct OC, i assume

    So recently during playing some games, such as Heroes of Newerth and Wow for the most part ive been experiencing some random spiking(especially around parts where some animations happen fast) in the games and when i tab out and check processes on *sy

  • Unable to download 11.1.102.63 .MSI (both x86 and x64) from distribution site

    I am unable to download the 11.1.102.63 .MSI from http://www.adobe.com/products/flashplayer/fp_distribution3.html (both x64 and x86). I always recieve .62. I have cleared my cache and had the networking team clear the cache at the firewall level and

  • Please Help me in my project

    i am doing our capstone project, and i was stuck in thinking what will the title of my project, i don't even know what will be the focus of my project, i mean the topic... please help my guys any help will do and suggestions ... please