3 Replies Latest reply on Apr 28, 2009 2:06 PM by alwu-Oracle

    Working with forward-chaining rules indices

    687900
      I'm just getting started with using 11g's RDF store support. I see in the dev guide that you should insert your triples and then create a rules index. I'm not accustomed to forward chaining; I haven't even used a materialized view. If the rules support was backward chaining (like a common SQL query) then I'd be more comfortable with how to manage the store.

      I need to support an RDFS model against a triple store. If I have various processes inserting triples and occasionally querying against the store, do I need to recreate the rules index with a call to SEM_APIS.CREATE_RULES_INDEX after each set of inserts?

      If so, is there a recommended practice for effectively managing the rules index? I'm concerned about the time it takes to recreate the index and store the inferred triples since it has to recreate the entire view each time. For example, should I recreate the rules index after each transaction that inserts or deletes triples, or is there a way of recreating the rules index asynchronously with the connection transaction and block queries any queries that come in that want to use the index?

      Does anyone know about when incremental maintenance of rules indices will be released? Or perhaps support for backward chaining?

      Brian
        • 1. Re: Working with forward-chaining rules indices
          Mannamal-Oracle
          Hi Brian,

          When new triples are added to a model that was used for creation of the rules index, the status of the rules index is changed from 'VALID' to 'INCOMPLETE'. Queries can continue to be executed, as long as the SEM_MATCH query passes in a status of 'INCOMPLETE'. Similarly when triples are deleted the rules index status is changed to 'INVALID' and again queries can execute as long as SEM_MATCH passes in a status of 'INVALID'. In other words, queries can continue after inserts or deletes as long as the application is aware that the query results will not reflect entailment changes due to the triple inserts/deletes. If the triple inserts/deletes are to a model that is not part of the rules index then the rules index status remains unchanged (it will be 'VALID').

          Section 1.6 in the documentation contains more details on this.

          Re-creation of the rules index does re-use a lot of information so it is not like re-creating it from scratch. Users typically run the the rules index creation process periodically depending on the frequency of updates. For example, nightly runs are a common usage scenario.

          Incremental maintenance and backward chaining are planned for the future.

          Melli
          • 2. Re: Working with forward-chaining rules indices
            malcolm83
            Is there an easy way allow incomplete or invalid rulesets for queries from the Jena Adaptor API?
            • 3. Re: Working with forward-chaining rules indices
              alwu-Oracle
              Actually, you can use some of the constant QueryOptions objects defined in Jena Adaptor.

              e.g.
              ...
              Attachment attachment = Attachment.createInstance(model2, "RDFS", InferenceMaintenanceMode.NO_UPDATE,. QueryOptions.ALLOW_QUERY_INCOMPLETE);
              ...


              Also, there is this QueryOptions.ALLOW_QUERY_INVALID, ALLLOW_QUERY_VALID_AND_DUP,
              ALLOW_QUERY_INCOMPLETE_AND_DUP, etc. Please refer to the Javadoc.

              Thanks,

              Zhe Wu