5 Replies Latest reply on Nov 5, 2016 12:32 AM by alwu-Oracle

    Tracing all the tuples that are inserted as part of a transaction

    user474398

      I find it easy to find all the tables and data that was inserted as part of a transaction in RDBMS

       

      But in RDF model, I am not able to find all the tuples that were inserted (based on the ontology) due to a change in a business transaction.

      Unfortunately we are not tracing all the tuples that are part of the model before we call the jena API to insert in the model.

      So how can I find what what was inserted based on the ontolofy and timestamp in MDSYS tables.

       

      Can someone please point me to some low level documentation for RDF models where some timestamps are stored and so we can work our way backward.

       

      Thanks,

      Priya

        • 1. Re: Tracing all the tuples that are inserted as part of a transaction
          alwu-Oracle

          Hi Priya,

           

          The triples/quads are stored in an internal table (partitioned) called MDSYS.RDF_LINK$. For performance reasons, we do not associate timestamps with each insert/deletion.

           

          Having said that, you may be able to figure out a "diff" with flashback/scn [1], assuming you have the necessary privileges and sufficient UNDO.

           

          Thanks,

           

          Zhe Wu

           

          [1] https://docs.oracle.com/database/121/ADFNS/adfns_flashback.htm#ADFNS01004

          1 person found this helpful
          • 2. Re: Tracing all the tuples that are inserted as part of a transaction
            user474398

            Thank you Zhe!

             

            We also like to understand the total tuples count in our database for rdf_value$ and rdf_link$ views.

             

            We have three RDF_MODELs (in MDSS.rdf_model$) - ontology, instances of ontology data and spatial.

             

            Here are the counts of the corresponding tuples for all models:

            select count(*) from DATA_TPL; --386,224,043

            select count(*) from ONTOLOGY_TPL; --28281

            select count(*) from SPATIAL_TPL; --274899

             

            However counts for rdf_value$ and rdf_link$ are as below:

            select count(*) from MDSYS.rdf_value$; --81,572,658

            select count(*) from MDSYS.RDF_LINK$; --174,645,616

             

            For some reason I thought either the RDF_LINK$ or RDF_VALUE$ counts should match up to the counts of all three tpl when added together.

            Why the counts of RDF_LINK$ and RDF_VALUE$ are not adding up to what we have in *TPL tables and what do each view represent.

             

            Thanks,

            Priya

            • 3. Re: Tracing all the tuples that are inserted as part of a transaction
              alwu-Oracle

              Hi Priya,

               

              This is because you have duplicates in the _TPL table. Internally, to maintain the set semantics of an RDF graph (or an RDF dataset), we take out duplicates (triples/quads). That's why RDF_LINK$ (or the RDFM_ views of RDF_LINK$ partitions) may have less number of rows.

               

              We do maintain a COST column in MDSYS.RDF_LINK$ to keep track of how many duplicates there are for each unique triple/quad.

               

              SQL> select /*+ parallel(4) */ sum(cost) from mdsys.rdf_link$;

              SQL> select /*+ parallel(4) */ sum(cost) from mdsys.rdfm_<model_name>;

               

              Hope it helps,

               

              Zhe Wu

              1 person found this helpful
              • 4. Re: Tracing all the tuples that are inserted as part of a transaction
                user474398

                Thank you Zhe!

                 

                 

                I still don't understand the difference between RDF_LINK vs RDF_VIEW.

                 

                 

                Is my understanding correct that RDF_LINK$ count should match with TPL count if there are no duplicates in the TPL table.

                 

                 

                Thanks,

                Priya

                • 5. Re: Tracing all the tuples that are inserted as part of a transaction
                  alwu-Oracle

                  Hi Priya,

                   

                  Let me explain. MDSYS.RDF_LINK$ is the underlying table storing all triples/quads that exist in the semantic network. It is partitioned so that each separate RDF model (asserted or inferred) can occupy a separate partition.

                   

                  MDSYS.RDF_LINK$ itself is a private table in MDSYS. Regular users are NOT able to access it. Views (like MDSYS.RDFM_<model_name>) can be created on top of one or multiple partitions. Access to the views can be granted to regular users.

                   

                  You are right when there is no duplicates, # of rows in _TPL should match that in MDSYS.RDFM_<model_name>

                   

                  Hope it helps,

                   

                  Zhe Wu