9 Replies Latest reply on Mar 10, 2011 12:46 AM by alwu-Oracle

    owlprime entailment with OLS

    jjengel
      Is there a recommended approach for generating labels for inferred triples when using triple-level ols?

      The triples on my table are:

      'http://example.com/name/John', 'http://example.com/rel/fatherOf','http://example.com/name/Mary'
      'http://example.com/name/Jack', 'http://example.com/rel/brotherOf','http://example.com/name/John'
      'http://example.com/name/John', 'http://www.w3.org/2002/07/owl#sameAs','http://example.com/name/JohnQ'
      'http://example.com/name/JohnQ','http://www.w3.org/2002/07/owl#sameAs','http://example.com/name/Omar'

      When I create my entailment using this statement

      EXECUTE sem_apis.create_entailment('owltst_idx', sem_models('owltst'), sem_rulebases('OWLPRIME'));

      I can see 4 rows created in semi_owltst_idx

      However when I have triple level ols policy applied to the semantic data, no rows get created when running the above
      entailment create. I am assuming there needs to be some value for label_gen parameter in the
      create_entailment procedure. Since I have triple level ols I believe I cannot use labelgen_subject,
      labelgen_object or labelgen_predicate.

      I have tried to create the customSPORA label function from the documentation however I cannot get it to
      compile yet.

      With triple level OLS do you have to create a function to generate the labels for inferred triples? Otherwise how can I get
      SEMI_OWLTEST_IDX to populate with values when OLS is enabled on semantic data?

      thanks
        • 1. Re: owlprime entailment with OLS
          alwu-Oracle
          Hi,

          How did you create the security policy? Did you use sem_rdfsa.TRIPLE_LEVEL_ONLY option?

          Thanks,

          Zhe Wu
          • 2. Re: owlprime entailment with OLS
            jjengel
            Yes. triple level only
            • 3. Re: owlprime entailment with OLS
              alwu-Oracle
              Hi,

              Can you please run the following command in your user session?
              select count(1) from mdsys.rdfm_owltst;

              I think you will get 0 as the count.

              The reason is that the model was created/populated before the OLS policy
              is applied. So those existing triples don't have labels assigned.

              To assign proper labels, as session user
              SQL> grant all on <app_tab> to fgac_admin;

              Then switch to admin, assume you want to assign the same labels to all triples in this model.

              connect fgac_admin/fgac_admin;
              SQL> update <username>.<app_tab> set ctxt1 = char_to_label('<policy_name>', '<desired_label_string>');
              SQL> commit;

              Now your session user should be able to see some triples based on his/her access privilege.
              Inference should work as expected at this point.

              Thanks
              Zhe Wu
              • 4. Re: owlprime entailment with OLS
                jjengel
                Zhe,

                I have 4 rows in rdfm_owltst regardless of whether ctxt1 is populated or not.

                I load the tables with these 4 rows of data and then I update them to set the ctxt1 value (ols label).

                When I query using the application table owner I get all the rows whether I select directly on the app table or using sem_match.

                select s,p,o from table(SEM_MATCH('(?s ?p ?o)', SEM_MODELS('OWLTST'), null,null,null));

                Same thing goes for another user with the correct privileges on the app table and the model. Results are filtered correctly by OLS depending on the session label I set.

                My issue is when I go to create the entailment

                EXECUTE sem_apis.create_entailment('owltst_idx', sem_models('owltst'), sem_rulebases('OWLPRIME'));

                Nothing gets populated in the RDFI_OWLTST_IDX view when the the triple level policy is enabled. If the ols table policy is removed (not disabled), the create_entailment statement runs and populates rdfi_owltst_idx with several rows however the ctxt1 column is null.

                With rows in rdfi_owltst_idx (and after updating ctxt1 with a value) I can use the sem_match query as such

                select s,p,o from table(SEM_MATCH('(?s ?p ?o)', SEM_MODELS('OWLTST'), sem_rulebases('OWLPRIME',null,null));

                and I can see the inferred triples.

                When ctxt1 is null on rdfi_owltst_idx I do not see the inferred triples.

                What is the correct procedure to create the entailment and have it populate ctxt1? Does the ols table policy have to be removed? Chapter 5 has several options LABELGEN_RULE, LABELGEN_SUBJECT, LABELGEN_PREDICATE, LABELGEN_OBJECT, LABELGEN_DOMINIATING, or antecedent labels. Which one is correct when using triple level only ols?

                The documentation does not seem clear on how to generate a label for an inferred triple when using triple level only ols.

                thanks
                • 5. Re: owlprime entailment with OLS
                  alwu-Oracle
                  Hi,

                  Could you please drop the policy and redo (also cut and paste) the exact steps so that I can reproduce?

                  Thanks,

                  Zhe Wu
                  • 6. Re: owlprime entailment with OLS
                    jjengel
                    Zhe,

                    I sent you an email with two .txt attachments that outline my steps. Formatting inside here was an issue
                    • 7. Re: owlprime entailment with OLS
                      jjengel
                      An update to this thread that took place over email. My email had several questions and Zhe responded in line (in bold)

                      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
                      I mentioned in my previous email the way I am loading and accessing the triples.

                      * The model owner has full OLS privileges and loads the triples that are already classified with various differing classifications.
                      * The way I load the data (by calling char_to_label('CLASSIFICATION',ols_label)) will generate different ctxt1 values for each row depending on the classification of the row (ols_label).
                      * The model owner will create the entailment and as I understand now, all rows in the entailment index will have a single ctxt1 label based on this users user label.
                      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------

                      Note that the inference process will assign the user's label to the generated triples. And you know this already.

                      Let me explain the design principle behind it.

                      Say a user (with certain privilege) can read a subset of triples of a graph. The user can
                      then take out these triples that he/she can read, load them into an external, open source inference engine, and
                      generate inferred new triples. The user can take the generated triples and insert them back
                      into Oracle. Obviously, these newly inserted triples will get the user's label.

                      The above describes one way to perform inference. Oracle has a native
                      inference engine which perform inference inside the database. However,
                      label assignment for generated triples is the same for both approaches.

                      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
                      * For others users to access the triples (including inferred triples), the model owner will grant select privileges on RDFM_OWLTST and RDFI_OWLTST_IDX.

                      What I am failing to understand is how, in a multi user system will OLS filter the inferred triples? If the model owner is the only user who can create an entailment and the ctxt1 column is inherited from this users session label how can I get accurate inferred triples for other users that have a different OLS user label than the model owner who created the entailment?
                      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------

                      Actually in this case, two entailments should be generated.

                      Model owner can grant access to the application table and model to users A, and B.

                      A creates an empty rulebase RBA. B creates an empty rulebase RBB.

                      Now A performs inference using something like
                      conn A/A
                      EXECUTE sem_apis.create_entailment('owltst_A_idx', sem_models('owltst'), sem_rulebases('OWLPRIME','RBA'));

                      And B performs inference using something like
                      conn B/B
                      EXECUTE sem_apis.create_entailment('owltst_B_idx', sem_models('owltst'), sem_rulebases('OWLPRIME','RBB'));

                      Because A and B are different users (say with different access privilege), they will see
                      different set of triples. Consequently, they will generate different inferred results.

                      The empty rulebases RBA and RBB are used to differentiate the signatures of the two entailments.

                      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
                      * The model owner has the user label of TS:US_SPCL:US
                      * 2 triples in the app table are UNCLASSIFIED

                      1. 'http://example.com/name/John', 'http://www.w3.org/2002/07/owl#sameAs','http://example.com/name/JohnQ'
                      2. 'http://example.com/name/JohnQ','http://www.w3.org/2002/07/owl#sameAs','http://example.com/name/Omar'

                      * The model owner with the user label of TS:US_SPCL:US creates the OWLPRIME entailment and the 4 inferred rows in rdfi_owltst_idx inherit the TS:US_SPCL:US as ctxt1 label
                      * Another user with the user label of S:US_SPCL:US queries using the entailment created by the model owner is unable to see the inferred rows even though the rows are UNCLASSIFIED

                      Does my example make sense?
                      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------

                      Yes. Think of inference as a read followed by write procedure.
                      • 8. Re: owlprime entailment with OLS
                        687900
                        Hey Zhe,

                        Jeff pointed out this thread to me, so I'm playing a little catch-up. Our application will have thousands of users with a hundreds of unique OLS labels. We normally have a single DB login which then applies the application user's label to the current session.

                        If inferred triples get the user's label, then we would have to compute the inferences for each of the hundreds of different unique labels, which has scalability problems. And even then, we lose all information about what the label should be given the set of labels of the triples used in the inference.

                        Flattening everything to the session's label means we might as well not be using OLS.

                        Is there any way of configuring the inferencing mechanism to use some function to combine the labels of the base triples to determine the label to apply on the inferred triple?

                        Brian
                        • 9. Re: owlprime entailment with OLS
                          alwu-Oracle
                          Hi,

                          I'd like to know more details about your application. You mentioned "... what the label should be given the set of labels of the triples used in the inference..." I want to point out that it is possible there are multiple deduction paths to a single inferred triple and tracking all possible deduction paths is very costly.

                          Please feel free to email me. Jeff has my contact information.

                          Thanks,

                          Zhe Wu