6 Replies Latest reply on Aug 23, 2010 2:02 PM by Matperry-Oracle

    Partitioning on CREATE_RDF_MODEL

    792262
      Hi,

      How to apply the partition table within CREATE_RDF_MODEL?

      If possible please provide me the syntax.

      Regards,
      Kavitha.
        • 1. Re: Partitioning on CREATE_RDF_MODEL
          alwu-Oracle
          Hi,

          Each semantic model has a corresponding partition in an internal table.

          Are you trying applying partitioning for your application table? You can do something like this for example. It partitions the application table based on predicate ID.

          create table part (triple sdo_rdf_triple_s)
          partition by hash (triple.RDF_P_ID) partitions 32;

          Thanks,

          Zhe Wu
          1 person found this helpful
          • 2. Re: Partitioning on CREATE_RDF_MODEL
            792262
            Hi,

            I am trying to create the Range partition or system partition to the table.

            example:

            CREATE TABLE TST_TBL
            (ID NUMBER, TRIPLE MDSYS.SDO_RDF_TRIPLE_S)
            PARTITION BY SYSTEM
            (
            PARTITION part_1,
            PARTITION part_2,
            PARTITION part_3
            );


            We are using sparql query to retrieve the RDF data from the table.

            SELECT s1 , s2 , s3
            FROM TABLE
            (sem_match
            ('(?s1 ?s2 ?s3)',
            sem_models ('TST_MDL'),
            NULL,
            Null,
            Null
            )
            )
            ORDER BY s1, s2;


            The above query is referring the model.

            If we create Range Partition or System partition to the table How it will be referred in the SPARQL query?

            Thanks,
            Kavitha.
            • 3. Re: Partitioning on CREATE_RDF_MODEL
              Sdas-Oracle
              The SPARQL query (via SEM_MATCH) would remain the same irrespective of any partitioning scheme change for the application table.
              • 4. Re: Partitioning on CREATE_RDF_MODEL
                alwu-Oracle
                Hi,

                Application table is used for a few cases.

                Jena Adapter (and Sesame Adapter) will access this table for delete purposes.

                Sesame Adapter will query it for context information if a SPARQL query has GRAPH construct.

                Cheers,

                Zhe Wu
                1 person found this helpful
                • 5. Re: Partitioning on CREATE_RDF_MODEL
                  792262
                  Hi,

                  Please find the below steps

                  CREATE TABLE TST_SMA_CURR_RDF_PTN
                  (ID NUMBER, TS NUMBER, TRIPLE MDSYS.SDO_RDF_TRIPLE_S)
                  PARTITION BY SYSTEM
                  (
                  PARTITION part_1,
                  PARTITION part_2,
                  PARTITION part_3

                  );

                  EXECUTE SEM_APIS.CREATE_RDF_MODEL('TST_SMA_CURR_RDF_PTN_MDL', 'TST_SMA_CURR_RDF_PTN', 'triple');

                  INSERT INTO TST_SMA_CURR_RDF_PTN PARTITION (part_1) VALUES (1,23,
                  SDO_RDF_TRIPLE_S ('TST_SMA_CURR_RDF_PTN_MDL','http://nature.example.com/Article1',
                  'http://purl.org/dc/elements/1.1/title','All about XYZ'));

                  INSERT INTO TST_SMA_CURR_RDF_PTN PARTITION (part_2) VALUES (2,24,
                  SDO_RDF_TRIPLE_S ('TST_SMA_CURR_RDF_PTN_MDL','http://nature.example.com/Article1',
                  'http://purl.org/dc/elements/1.1/creator',
                  'Jane Smith'));

                  INSERT INTO TST_SMA_CURR_RDF_PTN PARTITION (part_3) VALUES (3,25,
                  SDO_RDF_TRIPLE_S ('TST_SMA_CURR_RDF_PTN_MDL','http://nature.example.com/Article1',
                  'http://purl.org/dc/elements/1.1/creator',
                  'Jane Smith'));

                  INSERT INTO TST_SMA_CURR_RDF_PTN PARTITION (part_1) VALUES (4,26,
                  SDO_RDF_TRIPLE_S ('TST_SMA_CURR_RDF_PTN_MDL','http://nature.example.com/Article1',
                  'http://purl.org/dc/elements/1.1/creator',
                  'Jane Smith'));

                  In normal queries we can mention the partition

                  SELECT a.triple.get_triple()
                  FROM TST_SMA_CURR_RDF_PTN PARTITION (part_3) a;

                  But i am unable to mention any partition in Sparql query

                  Example:

                  SELECT s1 , s2 , s3
                  FROM TABLE
                  (sem_match
                  ('(?s1 ?s2 ?s3)',
                  sem_models ('TST_SMA_CURR_RDF_PTN_MDL'),
                  NULL,
                  Null,
                  Null
                  )
                  )
                  ORDER BY s1, s2;

                  Its always retrieving the data from the first partition (part_1)

                  If we want to get the data from partition (part_3) how to refer it in the SPARQL query.

                  Regards,
                  Kavitha.
                  • 6. Re: Partitioning on CREATE_RDF_MODEL
                    Matperry-Oracle
                    Hi,

                    A SEM_MATCH / SPARQL query does not access the application table (TST_SMA_CURR_RDF_PTN in your example). Instead, a SEM_MATCH query accesses the MDSYS.RDF_VALUE$ and MDSYS.RDF_LINK$ system tables. These system tables are partitioned so that each semantic model is one partition in MDSYS.RDF_LINK$.

                    The application table is used for DML operations on a semantic model. The application table is not used during SPARQL query execution (the only exception is for named graph queries with Sesame adapter), so any partitioning on the application table will have no effect on SEM_MATCH query execution. It is therefore not possible to specify a partition from the application table in a SEM_MATCH / SPARQL query.

                    If you want to partition your semantic data in a certain way, you could create one model for each desired partition. For example,

                    CREATE TABLE TST_SMA_CURR_RDF_PTN1
                    (ID NUMBER, TS NUMBER, TRIPLE MDSYS.SDO_RDF_TRIPLE_S);

                    CREATE TABLE TST_SMA_CURR_RDF_PTN2
                    (ID NUMBER, TS NUMBER, TRIPLE MDSYS.SDO_RDF_TRIPLE_S);

                    CREATE TABLE TST_SMA_CURR_RDF_PTN3
                    (ID NUMBER, TS NUMBER, TRIPLE MDSYS.SDO_RDF_TRIPLE_S);

                    EXECUTE SEM_APIS.CREATE_RDF_MODEL('TST_SMA_PTN1_MDL', 'TST_SMA_CURR_RDF_PTN1', 'triple');
                    EXECUTE SEM_APIS.CREATE_RDF_MODEL('TST_SMA_PTN2_MDL', 'TST_SMA_CURR_RDF_PTN2', 'triple');
                    EXECUTE SEM_APIS.CREATE_RDF_MODEL('TST_SMA_PTN3_MDL', 'TST_SMA_CURR_RDF_PTN3', 'triple');

                    INSERT INTO TST_SMA_CURR_RDF_PTN1 VALUES (1,23,
                    SDO_RDF_TRIPLE_S ('TST_SMA_PTN1_MDL','http://nature.example.com/Article1',
                    'http://purl.org/dc/elements/1.1/title','All about XYZ'));

                    INSERT INTO TST_SMA_CURR_RDF_PTN2 VALUES (2,24,
                    SDO_RDF_TRIPLE_S ('TST_SMA_PTN2_MDL','http://nature.example.com/Article1',
                    'http://purl.org/dc/elements/1.1/creator',
                    'Jane Smith'));

                    INSERT INTO TST_SMA_CURR_RDF_PTN3 VALUES (3,25,
                    SDO_RDF_TRIPLE_S ('TST_SMA_PTN3_MDL','http://nature.example.com/Article1',
                    'http://purl.org/dc/elements/1.1/creator',
                    'Jane Smith'));

                    INSERT INTO TST_SMA_CURR_RDF_PTN1 VALUES (4,26,
                    SDO_RDF_TRIPLE_S ('TST_SMA_PTN1_MDL','http://nature.example.com/Article1',
                    'http://purl.org/dc/elements/1.1/creator',
                    'Jane Smith'));

                    Then you could query the TST_SMA_PTN3_MDL semantic model to access the third partition.

                    SELECT s1 , s2 , s3
                    FROM TABLE
                    (sem_match
                    ('(?s1 ?s2 ?s3)',
                    sem_models ('TST_SMA_PTN3_MDL'),
                    NULL,
                    Null,
                    Null
                    )
                    )
                    ORDER BY s1, s2;

                    Thanks,
                    Matt