5 Replies Latest reply on May 12, 2008 11:09 AM by 545538

    Insert error

    545538
      -- 1. select
      SELECT x_,x_$RDFVTYP FROM TABLE(SEM_MATCH(' (?x_ ann:resourceUri ann:TestA)',SEM_Models('NewCRTest_XSL9'),null,SEM_ALIASES(SEM_ALIAS('ann','http://www.ontosearch.com/2007/12/annotation-ns#')),null))

      -- 2. add
      INSERT INTO NewCRTest_XSL9 (triple) VALUES (sdo_rdf_triple_s('NewCRTest_XSL9','<http://www.ontosearch.com/2007/12/annotation-ns#Test>','<http://www.ontosearch.com/2007/12/annotation-ns#resourceUri>','<http://www.ontosearch.com/2007/12/annotation-ns#TestA>'));
      COMMIT;

      -- 3. Empty
      SELECT x_,x_$RDFVTYP FROM TABLE(SEM_MATCH(' (?x_ ann:resourceUri ann:TestA)',SEM_Models('NewCRTest_XSL9'),null,SEM_ALIASES(SEM_ALIAS('ann','http://www.ontosearch.com/2007/12/annotation-ns#')),null))

      -- 4. Not empty
      SELECT /**/ x_,x_$RDFVTYP FROM TABLE(SEM_MATCH(' (?x_ ann:resourceUri ann:TestA)',SEM_Models('NewCRTest_XSL9'),null,SEM_ALIASES(SEM_ALIAS('ann','http://www.ontosearch.com/2007/12/annotation-ns#')),null))

      First and last query difer only hint!

      Please help!
        • 1. Re: Insert error
          545538
          Scenario:

          set echo on
          exec sem_apis.create_sem_network('rdf_dat');

          PL/SQL procedure successfully completed
          create table NewCRTest_XSL9 (triple SDO_RDF_TRIPLE_S);

          Table created
          exec sem_apis.create_sem_model('NewCRTest_XSL9','NewCRTest_XSL9','triple');

          PL/SQL procedure successfully completed
          SELECT y_,y_$RDFVTYP,y_$RDFLTYP FROM TABLE(SEM_MATCH(' (<http://localhost#Ab> <http://localhost#property> ?y_)',SEM_Models('NewCRTest_XSL9'),null,null,null));

          Y_ Y_$RDFVTYP Y_$RDFLTYP
          -------------------------------------------------------------------------------- ---------- --------------------------------------------------------------------------------
          INSERT INTO NewCRTest_XSL9 (triple) VALUES (sdo_rdf_triple_s('NewCRTest_XSL9','<http://localhost#Ab>','<http://localhost#property>','"c"^^xsd:string'));

          1 row inserted
          COMMIT;

          Commit complete
          SELECT y_,y_$RDFVTYP,y_$RDFLTYP FROM TABLE(SEM_MATCH(' (<http://localhost#Ab> <http://localhost#property> ?y_)',SEM_Models('NewCRTest_XSL9'),null,null,null));

          Y_ Y_$RDFVTYP Y_$RDFLTYP
          -------------------------------------------------------------------------------- ---------- --------------------------------------------------------------------------------
          SELECT /**/ y_,y_$RDFVTYP,y_$RDFLTYP FROM TABLE(SEM_MATCH(' (<http://localhost#Ab> <http://localhost#property> ?y_)',SEM_Models('NewCRTest_XSL9'),null,null,null));

          Y_ Y_$RDFVTYP Y_$RDFLTYP
          -------------------------------------------------------------------------------- ---------- --------------------------------------------------------------------------------
          c LIT http://www.w3.org/2001/XMLSchema#string
          • 2. Re: Insert error
            alwu-Oracle
            Instead of variable name "y_" could you please try "y"

            Does it help?
            • 3. Re: Insert error
              545538
              No, No, this not help.
              Helped clear shared_pool after insert, but it is weary bed.
              • 4. Re: Insert error
                alwu-Oracle
                After re-reading your test case, I realized that it is a known bug that has already been fixed.

                A workaround is run the following before you execute the same query after you do the insertion.

                grant select on mdsys.rdfm_NewCRTest_XSL9 to sys;

                Basically, the above DDL will invalidate your existing cursor of your query which contains URIs that do not exist (before you do the insertion) in the database. Flush shared pool has the same effect. However, flush shared pool has a global side effect and requires privilege.

                Another workaround is to change the query text slightly. For example, add a comment like you did.
                • 5. Re: Insert error
                  545538
                  Thank you!
                  This is work!

                  set echo on
                  exec sem_apis.create_sem_network('rdf_dat');

                  PL/SQL procedure successfully completed
                  create table NewCRTest_XSL9 (triple SDO_RDF_TRIPLE_S);

                  Table created
                  exec sem_apis.create_sem_model('NewCRTest_XSL9','NewCRTest_XSL9','triple');

                  PL/SQL procedure successfully completed
                  SELECT y_,y_$RDFVTYP,y_$RDFLTYP FROM TABLE(SEM_MATCH(' (<http://localhost#Ab> <http://localhost#property> ?y_)',SEM_Models('NewCRTest_XSL9'),null,null,null));

                  Y_ Y_$RDFVTYP Y_$RDFLTYP
                  -------------------------------------------------------------------------------- ---------- --------------------------------------------------------------------------------
                  INSERT INTO NewCRTest_XSL9 (triple) VALUES (sdo_rdf_triple_s('NewCRTest_XSL9','<http://localhost#Ab>','<http://localhost#property>','"c"^^xsd:string'));

                  1 row inserted
                  grant select on mdsys.rdfm_NewCRTest_XSL9 to sys;

                  Grant succeeded
                  COMMIT;

                  Commit complete
                  SELECT y_,y_$RDFVTYP,y_$RDFLTYP FROM TABLE(SEM_MATCH(' (<http://localhost#Ab> <http://localhost#property> ?y_)',SEM_Models('NewCRTest_XSL9'),null,null,null));

                  Y_ Y_$RDFVTYP Y_$RDFLTYP
                  -------------------------------------------------------------------------------- ---------- --------------------------------------------------------------------------------
                  c LIT http://www.w3.org/2001/XMLSchema#string
                  SELECT /**/ y_,y_$RDFVTYP,y_$RDFLTYP FROM TABLE(SEM_MATCH(' (<http://localhost#Ab> <http://localhost#property> ?y_)',SEM_Models('NewCRTest_XSL9'),null,null,null));

                  Y_ Y_$RDFVTYP Y_$RDFLTYP
                  -------------------------------------------------------------------------------- ---------- --------------------------------------------------------------------------------
                  c LIT http://www.w3.org/2001/XMLSchema#string