9 Replies Latest reply on Nov 10, 2008 11:31 PM by Mannamal-Oracle

    How to obtain optional columns in RDF TABLE

    586185
      Hello;

      I have a RDF table with the following columns;
      <b>COLUMN_NAME     TYPE_NAME</B>
      ID     NUMBER
      TRIPLE     SDO_RDF_TRIPLE_S
      REVIEWEDON DATATIME
      REVIEWEBBY VARCHAR2

      When I make a SDO_QUERY I consult the information in TRIPLE DATA. How can I obtain from the result the other columns ?

      Regards

      ISidro
        • 1. Re: How to obtain optional columns in RDF TABLE
          Mannamal-Oracle
          The data in other columns can be obtained by doing a self-join with other the RDF table. Below is a sample query using the family demo example:

          SELECT x Male, t2.id ID
          FROM TABLE(SDO_RDF_MATCH(
          '(?x rdf:type :Male)',
          SDO_RDF_Models('family'),
          null,
          SDO_RDF_Aliases(SDO_RDF_Alias('','http://www.example.org/family/')),
          null)) t1, family_rdf_data t2 where t2.triple.get_subject() = t1.x;

          Melli
          • 2. Re: How to obtain optional columns in RDF TABLE
            586185
            Hello;

            Thank you for your response about this problem. This solution I think will go too slow, if I make the query throw sdo_rdf_match for a solution and them I do it again throw normal query to match que final results ....

            Example;

            SELECT t2.id ID, Brother <br>
            FROM TABLE(<br>
            SDO_RDF_MATCH( (':Joe' :brotherOf ?Brother)',<br>
            ...<br>
            )<br>
            ) t1, family_rdf_data t2 <br>
            where t2.triple.get_subject() = 'http://www.example.org/family/Joe'<br>
            and t2.triple.get_property() = 'http://www.example.org/family/brotherOf'<br>
            and to_char(t2.triple.get_object()) = t1.Brother;<br>

            In this examples, I do the sdo_rdf_match query to obtain the Objetct, and the do again because It could be more triples than matches with this object.

            Is there a posibility to obtain directly in the sdo_query_match the RDF_T_ID ?. I think it could be the correct solution.

            Regards;

            Isidro
            • 3. Re: How to obtain optional columns in RDF TABLE
              Mannamal-Oracle
              Yes getting RDF_T_ID through SDO_RDF_MATCH would be convenient, but the current interface does not support that. We are considering that for a future release.

              Melli
              • 4. Re: How to obtain optional columns in RDF TABLE
                657770
                has there been any update to this issue (e.g. being able to access, say, the triple ID, directly within a semantic query instead of performing a join on the triple table itself)?

                thanks,
                -reg
                • 5. Re: How to obtain optional columns in RDF TABLE
                  Sdas-Oracle
                  In the upcoming patchset of Oracle 11g, expected to be released shortly, we are planning to enable direct access to the IDs from semantic query which should satisfy this requirement.
                  • 6. Re: How to obtain optional columns in RDF TABLE
                    657770
                    sounds good. in the meantime, can anyone suggest any ways of optimizing a query similar to that posted earlier? my query looks similar to the one posted above...

                    SELECT t2.id ID, Brother
                    FROM TABLE(
                    SDO_RDF_MATCH( (':Joe' :brotherOf ?Brother)',
                    ...
                    )
                    ) t1, family_rdf_data t2
                    where t2.triple.get_subject() = 'http://www.example.org/family/Joe'
                    and t2.triple.get_property() = 'http://www.example.org/family/brotherOf'
                    and to_char(t2.triple.get_object()) = t1.Brother;

                    ...in my case, it seems the family_rdf_data table is (naturally) growing larger, and query times are growing. any suggestions on a better way to retrieve similar data?
                    • 7. Re: How to obtain optional columns in RDF TABLE
                      24743
                      Is this patch available now (if not: when) and does it also contain the OPTIONAL clause?

                      Christian
                      • 8. Re: How to obtain optional columns in RDF TABLE
                        Mannamal-Oracle
                        Yes, this patch (11.1.0.7) has been released, and is available for supported customers via metalink (metalink.oracle.com). Usage examples are part of the OOW08 presentations available online now at [http://www.oracle.com/openworld/2008/index.html] . Below is a simple example:

                        Basically 11.1.0.7 allows the ids of the subject, object, and predicate to be retrieved (instead of just the subject, predicate, object text strings), and these ids will enable you to construct the triple_id by concatenating the ids appropriately.

                        An example of retrieving an id:

                        SELECT y$rdfvid, count(*) member_count FROM table(sem_match( '(?x rdf:type ?y)', SEM_Models('r&lt;....&gt;t'),null,null,null,

                        The 11.1.0.7 patch does not include OPTIONAL but that is expected very shortly. I will post a note on this forum as soon as it is available.

                        Melli
                        • 9. Re: How to obtain optional columns in RDF TABLE
                          Mannamal-Oracle
                          Creating indexes on get_subject(), get_property(), get_object() will help. Examples are iin the Quick Start (section 1.8) in the documentation.