This discussion is archived
1 2 Previous Next 15 Replies Latest reply: Sep 7, 2012 12:55 PM by JorgeB-Oracle RSS

Incramental inferencing question

366556 Newbie
Currently Being Moderated
I'm running the following to create an entailment:

EXECUTE sem_apis.create_entailment ('M_IDX',sem_models('M', 'N'),
sem_rulebases('OWLPRIME'),null,null, 'INC=T');

And the following to add more data:

EXECUTE sem_apis.create_entailment('M_IDX', sem_models('M'),
sem_rulebases('OWLPRIME''), SEM_APIS.REACH_CLOSURE, null, null,
sem_models('M_NEW', 'N_NEW'));

However, I'm noticing when I just query the M or N models by themselves, the data from M_NEW or N_NEW respectively is not there. I was under the impression that the data from M_NEW and N_NEW gets copied and after the re-inferencing M_NEW will be empty and the data would move to M. Is that a wrong assumption?

Edited by: a1239090 on Aug 21, 2012 1:02 PM
  • 1. Re: Incramental inferencing question
    alwu Pro
    Currently Being Moderated
    Hi,

    It seems that the first create_entailment uses both M and N. For the second call, are you supposed to use this instead?

    EXECUTE sem_apis.create_entailment('M_IDX', sem_models('M','N'),
    sem_rulebases('OWLPRIME''), SEM_APIS.REACH_CLOSURE, null, options => *'INC=T'*,
    delta_in => sem_models('M_NEW', 'N_NEW'));

    Thanks,

    Zhe Wu

    Edited by: alwu on Aug 23, 2012 9:49 PM

    Edited by: alwu on Aug 23, 2012 9:49 PM
  • 2. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    So here are my calls so far:

    EXECUTE sem_apis.create_entailment ('M_IDX',sem_models('M', 'N'),
    sem_rulebases('OWLPRIME'),null,null, 'INC=T');

    execute sem_apis.create_virtual_model('vm_m', sem_models('M', 'N')), sem_rulebases('OWLPRIME'));

    EXECUTE sem_apis.create_entailment('M_IDX', sem_models('M','N'),
    sem_rulebases('OWLPRIME''), SEM_APIS.REACH_CLOSURE, null, options => 'INC=T',
    delta_in => sem_models('M_NEW', 'N_NEW'));

    So after these calls when I query vm_m model I'm getting all the data back as expected.
    When I query M_NEW model I get its data back. But when I query M model, it's empty.

    Does M model should contain all the data from M_NEW model after doing the third call?

    Thanks,
    A.
  • 3. Re: Incramental inferencing question
    alwu Pro
    Currently Being Moderated
    Yes M should contain the "delta."

    Please cut & paste here a small test case if you can. Does M contain data to begin with?

    Thanks,
    Zhe Wu
  • 4. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    Here are the steps

    1.
    EXECUTE sem_apis.create_entailment ('M_IDX',sem_models('M', 'N'),
    sem_rulebases('OWLPRIME'),null,null, 'INC=T');

    2.
    execute sem_apis.create_virtual_model('vm_m', sem_models('M', 'N')), sem_rulebases('OWLPRIME'));

    3.
    add a few triples to models M_NEW and N_NEW

    4.
    EXECUTE sem_apis.create_entailment('M_IDX', sem_models('M','N'),
    sem_rulebases('OWLPRIME''), SEM_APIS.REACH_CLOSURE, null, options => 'INC=T',
    delta_in => sem_models('M_NEW', 'N_NEW'));

    5.
    query vm_m virtual model, the query returns all the triples that I've added in step 3. plus inferenced triples

    6.
    query m model alone, the model is empty
    query n model alone, the model is empty

    7.
    query m_new model alone, it contains all the triples that I've added in step 3.

    8.
    query n_new model alone, it contains all the triples that I've added in step 3.

    So models m and n are empty.
  • 5. Re: Incramental inferencing question
    alwu Pro
    Currently Being Moderated
    Hi,

    Thanks. It helps.

    Could you please also run the following two queries before and after each of the steps you supplied. Please first drop the entailment to have a clean start.

    select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;

    Zhe Wu
  • 6. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    Hi,

    Running the counts:

    select count(1) from mdsys.rdfm_m; returns 0

    select count(1) from mdsys.rdfm_m_new; returns several hundred rows

    Are the rows found in vm_m virtual model (both inferenced and asserted) found in a table somewhere, or are they generated on the "fly" each time I ran a query against vm_m?

    here's an example:

    select *
    from table(sdo_rdf_match(
    '{ ?x ?o ?y }',
    sdo_rdf_models('vm_m'),
    null,
    null,
    null,
    null));

    Edited by: a1239090 on Aug 29, 2012 11:01 AM
  • 7. Re: Incramental inferencing question
    alwu Pro
    Currently Being Moderated
    Hi,

    Thanks for the additional info. It is not complete though.

    Could you please also run the following two queries before and after each of the steps you supplied. Please first drop the entailment to have a clean start.

    select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;

    Regarding virtual model, it is a database view (not a table, not a materialized view either).

    Zhe Wu
  • 8. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    I've done the following steps:

    1.dropped entailment
    2.select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;
    both came as 0
    3.create entailment
    4.select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;
    both came as 0
    5.create a vm_m model
    6.create entailment with the delta models (M_new, N_new)
    7.select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;
    still both came as 0

    Is there a way to create an entailment where the inferenced statements are persisted? We find that querying on large entailments containing ~7.5 million assertions (just doing a count * on that virtual model) some take a while.

    Thanks,
    A.
  • 9. Re: Incramental inferencing question
    alwu Pro
    Currently Being Moderated
    Hi,

    This is how I tested on a 11.2.0.3. Everything works as expected. Could you please run the same test in your setup?

    Thanks,

    Zhe Wu

    create table m_tpl(triple sdo_rdf_triple_s) compress;
    exec sem_apis.create_sem_model('m','m_tpl','triple');

    create table n_tpl(triple sdo_rdf_triple_s) compress;
    exec sem_apis.create_sem_model('n','n_tpl','triple');


    create table m_new_tpl(triple sdo_rdf_triple_s) compress;
    exec sem_apis.create_sem_model('m_new','m_new_tpl','triple');

    create table n_new_tpl(triple sdo_rdf_triple_s) compress;
    exec sem_apis.create_sem_model('n_new','n_new_tpl','triple');

    insert into m_tpl(triple) values(sdo_rdf_triple_s('m','<urn:C1>','rdfs:subClassOf','<urn:C2>'));

    EXECUTE sem_apis.create_entailment ('M_IDX',sem_models('M', 'N'), sem_rulebases('OWLPRIME'),null,null, 'INC=T');


    select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;
    select count(1) from mdsys.rdfi_m_idx;
    ==>
    SQL> select count(1) from mdsys.rdfm_m;

    COUNT(1)
    ----------
    1

    SQL> select count(1) from mdsys.rdfm_n;

    COUNT(1)
    ----------
    0

    SQL> select count(1) from mdsys.rdfi_m_idx;

    COUNT(1)
    ----------
    0


    insert into m_new_tpl(triple) values(sdo_rdf_triple_s('m_new','<urn:I>','rdf:type','<urn:C1>'));



    EXECUTE sem_apis.create_entailment('M_IDX', sem_models('M','N'), sem_rulebases('OWLPRIME'), SEM_APIS.REACH_CLOSURE, null, options => 'INC=T', delta_in => sem_models('M_NEW', 'N_NEW'));


    select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;
    select count(1) from mdsys.rdfi_m_idx;

    ==>

    SQL> select count(1) from mdsys.rdfm_m;

    COUNT(1)
    ----------
    2

    SQL> select count(1) from mdsys.rdfm_n;

    COUNT(1)
    ----------
    0

    SQL> select count(1) from mdsys.rdfi_m_idx;

    COUNT(1)
    ----------
    1
  • 10. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    Thank you for the example. This was very helpful for me to figure out what was happening in my case, where I have about 10 models and only 2 delta.

    I noticed that the assertions are not added correctly to the models.

    Here's a specific example.

    I have 10 models and construct the entailment as follows:

    EXECUTE sem_apis.create_entailment ('M_IDX',sem_models('M', 'N','a', 'b', 'c', 'd', 'e', 'f', 'h', 'i'),
    sem_rulebases('OWLPRIME'),null,null, 'INC=T');

    I add a few assertions to model M_NEW and then run this:

    EXECUTE sem_apis.create_entailment('M_IDX', sem_models('M', 'N','a', 'b', 'c', 'd', 'e', 'f', 'h', 'i'),
    sem_rulebases('OWLPRIME''), SEM_APIS.REACH_CLOSURE, null, options => 'INC=T',
    delta_in => sem_models('M_NEW', 'N_NEW'));

    what I'm finding now is that the assertions from model M_NEW weren't copied to M but went into a different model in this list: 'M', 'N','a', 'b', 'c', 'd', 'e', 'f', 'h', 'i'
    It seems that the order for inserting the triples into the first model is not maintained.

    Even in the example you provided me, this happens. Only model M gets the new assertions and not model N:
    try the following:

    insert into n_new_tpl(triple) values(sdo_rdf_triple_s('n_new','<urn:C1>','rdfs:subClassOf','<urn:C3>'));

    EXECUTE sem_apis.create_entailment('M_IDX', sem_models('M','N'), sem_rulebases('OWLPRIME'), SEM_APIS.REACH_CLOSURE, null, options => 'INC=T', delta_in => sem_models('M_NEW', 'N_NEW'));

    select count(1) from mdsys.rdfm_m;
    select count(1) from mdsys.rdfm_n;

    The count for m will be incremented and not for n. Is that a bug?

    Thanks,
    A.

    Edited by: a1239090 on Aug 31, 2012 11:51 AM
  • 11. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    please refer to my post for 8/30 at 12 p.m.
  • 12. Re: Incramental inferencing question
    alwu Pro
    Currently Being Moderated
    Hi,

    Only the first model, M in this case, should receive all the "delta." Please file a SR if that is not always the case.

    Thanks,

    Zhe
  • 13. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    Hi,

    I'm finding that this is not always the case. In my example I have about 10 models and I'm finding the third one from the end gets the new assertions and in other entailments other models (*not the first*) gets the assertions.

    Edited by: a1239090 on Sep 4, 2012 4:05 PM
  • 14. Re: Incramental inferencing question
    366556 Newbie
    Currently Being Moderated
    I've ended placing an SR for this issue.
1 2 Previous Next

Legend

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