8 Replies Latest reply on Apr 16, 2010 5:15 PM by Matperry-Oracle

    Error creating index on RDF model

    681909
      I am running the create index as shown in 1.9 of the Semantic Developers Guide. I have 4 Oracle semantic models. All of our access is via sparql, with most of the 'WHERE' logic focused on the object part of the triples. We do a lot of querying on specific value and a lot of REGEX, primarily on the object values. So, it seems to me to be a good idea to build an index on the object part of the triples. However, this:

      create index POINT_OBJ_IDX on POINT (TO_CHAR(TRIPLE.GET_OBJECT())) throws this error:

      ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual:
      4223, maximum: 4000)

      Of the 4 models, 2 the index create works fine and the other 2 throw the error.

      Is there any way I can query the model or inspect using some other method that will show me which triple(s) are causing this error when building the index?
        • 1. Re: Error creating index on RDF model
          Matperry-Oracle
          Hi,

          Actually, indexes on the application table (e.g. POINT) are not relevant for SPARQL queries through Jena Adapter or through SEM_MATCH. Indexes used during SPARQL query execution (Semantic Network Indexes) are described in Section 1.8 of the docs:
          http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11828/sdo_rdf_concepts.htm#CIHBEBIB

          If you posted some typical queries, we could possibly suggest some ways to speed up the execution. As always, for best performance, make sure to run SEM_PERF.GATHER_STATS() before running any SPARQL queries:
          http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11828/sem_perf_ref.htm#CHEBGBCI

          You can find the too long objects with the following query:

          SELECT *
          FROM POINT
          WHERE DBMS_LOB.GETLENGTH(TRIPLE.GET_OBJECT()) > 4000;

          Hope this helps,
          Matt
          • 2. Re: Error creating index on RDF model
            681909
            Matt,
            Thanks for the feedback. triple.get_object() is an invalid identifier for some reason:

            SQL> select triple.get_object() from point;
            ERROR at line 1:
            ORA-00904: "TRIPLE"."GET_OBJECT": invalid identifier

            However, "select triple from point" returns everything;
            • 3. Re: Error creating index on RDF model
              Matperry-Oracle
              Sorry about that. I guess we need an alias for the application table. Try this query instead :

              SELECT *
              FROM POINT p
              WHERE DBMS_LOB.GETLENGTH(p.TRIPLE.GET_OBJECT()) > 4000;
              • 4. Re: Error creating index on RDF model
                681909
                I have noticed that none of the triple methods work on any model. triple.get_subject(), triple.get_object(), and triple.get_property() all throw the same error:
                ORA-00904: invalid identifier. Yet the triple itself seems to look valid. Here is a brief example:

                TRIPLE(RDF_C_ID, RDF_M_ID, RDF_S_ID, RDF_P_ID, RDF_O_ID)
                --------------------------------------------------------------------------------
                SDO_RDF_TRIPLE_S(2.8738E+18, 106, 7.9116E+18, 2.6669E+18, 2.8738E+18)
                SDO_RDF_TRIPLE_S(4.7204E+18, 106, 6.4209E+18, 5.7585E+18, 4.7204E+18)
                SDO_RDF_TRIPLE_S(4.8529E+18, 106, 6.4209E+18, 7.1202E+18, 4.8529E+18)
                SDO_RDF_TRIPLE_S(5.7286E+18, 106, 6.4209E+18, 2.6669E+18, 5.7286E+18)
                SDO_RDF_TRIPLE_S(6.6261E+18, 106, 4.4018E+18, 5.7585E+18, 6.6261E+18)
                SDO_RDF_TRIPLE_S(2.3820E+18, 106, 4.4018E+18, 7.1202E+18, 2.3820E+18)
                SDO_RDF_TRIPLE_S(2.8738E+18, 106, 4.4018E+18, 2.6669E+18, 2.8738E+18)
                SDO_RDF_TRIPLE_S(7.4981E+18, 106, 9.1014E+18, 5.7585E+18, 7.4981E+18)
                SDO_RDF_TRIPLE_S(2.3820E+18, 106, 9.1014E+18, 7.1202E+18, 2.3820E+18)
                SDO_RDF_TRIPLE_S(2.8738E+18, 106, 9.1014E+18, 2.6669E+18, 2.8738E+18)
                • 5. Re: Error creating index on RDF model
                  Matperry-Oracle
                  You need to give the application table an alias (e.g. FROM application_table a) in queries that access methods of the triple column and then use the alias when invoking these methods (e.g. a.triple.get_object() not just triple.get_object()).
                  • 6. Re: Error creating index on RDF model
                    681909
                    Mat,
                    Thanks SO much for you help on this. It's always the little stuff!

                    Russ
                    • 7. Re: Error creating index on RDF model
                      681909
                      Mat,
                      So, help me to understand the indexing task. I have several application table (POINT for example) any of which may contains a few million triples. We access (query) the data using sparql exclusively. A query can be almost anything...doing joins, looking for a specific object, or looking for values with a specific text pattern. REGEX is very heavily used to obtain hit lists with specific attributes. Can you suggest the best approach for indexing? The regex is always against values in the object position. I realize that regex will likely result in a table scan (or it sure looks that way), but we really need to find a way to speed up the query performance because that is the single biggest 'bang for the buck' to our business user.

                      Thanks in advance...Russ
                      • 8. Re: Error creating index on RDF model
                        Matperry-Oracle
                        Hi Russ,

                        Please contact me directly at matthew dot perry at oracle dot com, and we can discuss your requirements offline. Please include some of the following information:

                        The HW/SW configuration (# of cores, OS, App server, version of Oracle Database, etc)
                        Size (# of triples, # of concurrent users)
                        Features used (Jena or Sesame or SQL)

                        In addition, it will be a great help to us if you could send a brief description of your application, why you selected the RDF/OWL model, and whether your application is already in production.

                        Thanks,
                        Matt