6 Replies Latest reply on Feb 7, 2011 5:06 PM by JorgeB-Oracle

    Delete the RDF Triple by Sub or predicate or object in where clause

    792262
      Hi,

      Is it possible to delete a triple based on Subject or predicate or object in where clause condition?

      If possible please let me know the syntax and example.

      I am trying with the normal delete statement its ended up with error.

      I am not sure about the below delete statement but its working

      DELETE FROM articles_rdf_data a WHERE
      a.triple.get_subject()='<http://nature.example.com/Article1>';

      Regards,
      Kavitha.

      Edited by: 789259 on Jan 18, 2011 1:31 AM
        • 1. Re: Delete the RDF Triple by Sub or predicate or object in where clause
          Sdas-Oracle
          The syntax you used is correct:
          DELETE FROM articles_rdf_data a WHERE
          a.triple.get_subject()='<http://nature.example.com/Article1>'

          Please note that you can always use member functions of SDO_RDF_TRIPLE_S such as get_subject(), get_property(), and get_obj_value() as an expression that returns the value of the corresponding component of an RDF triple. So, these expressions can be freely used in WHERE clause, SELECT clause, etc.

          Example using get_subject() AND get_property():
          DELETE FROM articles_rdf_data a WHERE
          a.triple.get_subject()='<http://nature.example.com/Article1>' AND
          a.triple.get_property()='<http://purl.org/dc/elements/1.1/creator>'

          If this does not answer your question, please let us know and also include details of any failed DML statement that you have tried.
          • 2. Re: Delete the RDF Triple by Sub or predicate or object in where clause
            792262
            Hi,

            Thank for the update. I have one more question

            If i remove the triple from the application table (Custom table) by delete statement will the corresponding entries in MDMSYS objects are removed or will that stay?


            Note: Unfortunately i don't have privilege to check those in MDSYS schema (Due to Admin restriction)

            Thanks

            Regards,
            Kavitha.
            • 3. Re: Delete the RDF Triple by Sub or predicate or object in where clause
              Sdas-Oracle
              Yes, when you delete a triple from the application table, it gets deleted from the underlying store as well (assuming no duplicates). You can also verify this by running SEM_MATCH query against the corresponding semantic model before and after the deletion. (To query a semantic model you must have SELECT privilege for the corresponding database view.)
              • 4. Re: Delete the RDF Triple by Sub or predicate or object in where clause
                792262
                Hi,

                I removed the triple from application table unfortunately it didnt remove the corresponding entry in the mdsys.rdf_value$ table.

                The existing entry in the MDSYS objects will affect the performance of the query?

                Please let me know how to remove the corresponding entries in the underlying mdsys objects also.

                Regards,
                Kavitha.
                • 5. Re: Delete the RDF Triple by Sub or predicate or object in where clause
                  792262
                  few more clarifications required
                  • 6. Re: Delete the RDF Triple by Sub or predicate or object in where clause
                    JorgeB-Oracle
                    Hi,

                    Complementing the response from Souri, when you remove a triple it gets removed from some MDSYS objects that represent the model you are deleting from, however, it does not get removed from the main table RDF_VALUE$.

                    The values in RDF_VALUE$ could be shared among multiple models (e.g., if they use the same URIs), so, the values are note removed from this table.

                    There's no API (procedure) to purge model-specific values from RDF_VALUE$.

                    If you are sure you won't need the values anymore (meaning you have purged all semantic models and application tables already), then owner (mdsys) or dba could truncate the MDSYS.RDF_VALUE$, but this is not recommended at all. In that case though, you might as well just drop and re-create the sem network.

                    Hope that clarifies.
                    Regards!
                    Jorge
                    1 person found this helpful