This discussion is archived
6 Replies Latest reply: Feb 8, 2012 6:39 AM by JorgeB-Oracle RSS

How to find the Model size in Semantics

889820 Newbie
Currently Being Moderated
Hi All,

Please can you tell me how to find the model size in Semantics.

Thanks,
Indu
  • 1. Re: How to find the Model size in Semantics
    JorgeB-Oracle Journeyer
    Currently Being Moderated
    Hi,

    We can measure by

    1. The number of triples in the model:

    select count(*) from MDSYS.SEMM_<Model_name>;

    If it has an Entailment created:

    select count(*) from MDSYS.SEMI_<Entailment_name>;

    Add them both and that is the number of triples


    2. The space used

    a. Find out the model ID and Entailment ID

    select model_id from mdsys.sem_model$ where model_name='<Your_model_name>';

    Lets say it gives you ID 60

    b. Find out the ID for the Entailment

    set long 9000
    select text from dba_views where view_name='SEMI_<Entailment_name>';

    You will see something like ..partition(MODEL_69)

    In this case the ID for the Entailment is 69

    Run this select to find the space used:

    select sum(bytes)/1024/1024 MB from dba_segments where partition_name in ('MODEL_60','MODEL_69');

    e.g:
    MB
    ----------
    611.5

    That would be 611.5 MB

    Regards!
    Jorge
  • 2. Re: How to find the Model size in Semantics
    JorgeB-Oracle Journeyer
    Currently Being Moderated
    Hi,

    By the way, I forgot to account for RDF_VALUE$

    If your model was the only one in the Semantic Network we can just execute:

    SQL> select bytes/1024/1024 MB from dba_segments where segment_name='RDF_VALUE$';

    MB
    ----------
    51.5625

    But if there are other models, it is difficult to quantify as the values in RDF_VALUE$ are shared among models.

    Regards!
    Jorge
  • 3. Re: How to find the Model size in Semantics
    JorgeB-Oracle Journeyer
    Currently Being Moderated
    Hi,

    Instead of looking up the ID for the Entailment in DB_VIEWS you can better use MDSYS.SEM_NETWORK_INDEX_INFO

    For example:

    select name, type, id from MDSYS.SEM_NETWORK_INDEX_INFO;

    NAME TYPE ID
    ------------------------- ---------- ----------
    ...
    ...
    MYMODEL MODEL 60
    MYMODEL_INF ENTAILMENT 69


    *** Space about the B-tree indexes on models and entailments ***

    Indexes created in RDF_LINK$ for a specific model:


    SQL> select name, type, id, index_name from MDSYS.SEM_NETWORK_INDEX_INFO;

    NAME TYPE ID INDEX_NAME
    ------------------------- ---------- ---------- ------------------------------
    MYMODEL MODEL 60 RDF_LNK_PCSGM_IDX
    FAMILY100 MODEL 59 RDF_LNK_PSCGM_IDX
    FAMILY100 MODEL 59 RDF_LNK_PCSGM_IDX
    FAMILY2 MODEL 56 RDF_LNK_PCSGM_IDX
    FAMILY2 MODEL 56 RDF_LNK_PSCGM_IDX
    FAMILY MODEL 57 RDF_LNK_PCSGM_IDX
    FAMILY MODEL 57 RDF_LNK_PSCGM_IDX
    OTHERMODEL MODEL 58 RDF_LNK_PSCGM_IDX
    OTHERMODEL MODEL 58 RDF_LNK_PCSGM_IDX
    0 NETWORK 0 RDF_LNK_PCSGM_IDX
    0 NETWORK 0 RDF_LNK_PSCGM_IDX
    MYMODEL_INF ENTAILMENT 69 RDF_LNK_PCSGM_IDX
    MYMODEL_INF ENTAILMENT 69 RDF_LNK_PSCGM_IDX

    Then get the size from DBA_SEGMENTS

    select bytes/1024/1024 MB, partition_name from dba_segments where segment_name in ('RDF_LNK_PSCGM_IDX','RDF_LNK_PCSGM_IDX');


    Specifically for our model 60 and Entailment 69:

    select bytes/1024/1024 MB, partition_name from dba_segments where segment_name in ('RDF_LNK_PSCGM_IDX','RDF_LNK_PCSGM_IDX') and partition_name in ('MODEL_60','MODEL_69');

    MB PARTITION_NAME
    ---------- ------------------------------
    192 MODEL_60
    192 MODEL_60
    60.0625 MODEL_69
    62.375 MODEL_69

    You would add them all for the size of the indexes
  • 4. Re: How to find the Model size in Semantics
    JorgeB-Oracle Journeyer
    Currently Being Moderated
    For the latest where we get the size of the B-Tree indexes associated to the model/Entailemnt, there is another way to calculate without going to DBA_SEGMENTS which is using the Block_Size and Leaf_Blocks

    select sem.name, sem.type, sem.index_name, (dba_tbs.block_size*sem.leaf_blocks)/1024/1024 MB
    from mdsys.SEM_NETWORK_INDEX_INFO sem, dba_tablespaces dba_tbs
    where sem.tablespace_name=dba_tbs.tablespace_name;

    The sizes are very approximate to those we get from previous query on DBA_SEGMENTS

    Regards!
    Jorge
  • 5. Re: How to find the Model size in Semantics
    889820 Newbie
    Currently Being Moderated
    Hi Jorge,

    Thanks for Answer.

    I got all the query.

    Regards,
    Indu
  • 6. Re: How to find the Model size in Semantics
    JorgeB-Oracle Journeyer
    Currently Being Moderated
    Hi Indu,

    A couple more things:

    1. We still need one more query, to account for the storage of the Application Table

    This query gives you the application table name

    select table_name from mdsys.sem_model$
    where model_name='<Your_MODEL_NAME>';

    This will give you the size in MB

    select semmodel.table_name, dbaseg.bytes/1024/1024 MB
    from mdsys.sem_model$ semmodel, dba_segments dbaseg
    where semmodel.table_name=dbaseg.segment_name
    and semmodel.model_name='<Your_MODEL_NAME>';

    2. If the model is the only one in the Semantic Network you can get the space used by the RDF_VALUE$ table using this query

    select bytes/1024/1024 MB from dba_segments where segment_name = 'RDF_VALUE$';

    If there are several models, that space is shared among all of them.

    Regards!
    Jorge

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points