1

To the existing Rule file, I added a new Implication(action is modify), 7 Facts and 8 other initial Facts to be modified by the Implication. Ordered them like the chocolatebox example, with the implication at the top. Imp has priority:100 for good measure The modifying implication has a "label: update", which is different from the base facts

The engine gets initialized, called etc from a VB.net code 1) Initialize RuleAdapter with the RuleML file and initialize ie.LoadRuleBase(RulAdap) 2) Use ie.LoadFacts(FactBaseAdapter) 3) ie.Process()

When I Query for this, it returns the "base" facts only. Modifications to the base facts don't seem to be happening. But the same rule file, and fact base works perfectly in the IE-console! Also tested with differing fact files and the base facts get chosen and modified suitably. So the new Imp-Facts-Query set seems to have no flaws.

Thinking that ie.Process() was insufficient, I tried ie.Process(RuleTypes.All) but to no avail.

EDIT Apr 15 The verbose log in IE-Console has the following lines between the FIRST occurence of "found target" and "modified target". Could this an "exception" stop execution in the App...but continue execution in the Console with the default values ?

[V] -> found target: grDo{0,Ci,0 [System.Int32],,}
[I] Can not find setting key: 'referenceLinkMode', using default value: '' (Exception message: The key 'nxbre.referenceLinkMode' does not exist in the appSettings configuration section.)
[I] Can not find setting key: 'generateInMemoryAssembly', using default value: 'True' (Exception message: The key 'nxbre.generateInMemoryAssembly' does not exist in the appSettings configuration section.)
[I] Can not find setting key: 'compilerOptions', using default value: '' (Exception message: The key 'nxbre.compilerOptions' does not exist in the appSettings configuration section.)
[I] Can not find setting key: 'extraReferences', using default value: '' (Exception message: The key 'nxbre.extraReferences' does not exist in the appSettings configuration section.)
[I] Can not find setting key: 'extraReferences', using default value: '' (Exception message: The key 'nxbre.extraReferences' does not exist in the appSettings configuration section.)
[I] Can not find setting key: 'extraReferences', using default value: '' (Exception message: The key 'nxbre.extraReferences' does not exist in the appSettings configuration section.)
[V] -> modified target: grDo{0,Ci,6 [System.Int32],impact likely,Add nurture}

EDIT Apr 14

      <Assert mapClosure="universal">
    <!-- Implications -->
    <Implies>
      <oid>
        <Ind>label:update gr Do;priority:100;action:modify</Ind>
      </oid>
      <head>
        <Atom>
          <op>
            <Rel>grDo</Rel>
          </op>
          <Var>person</Var>
          <Var>gr</Var>
          <Ind uri="nxbre://expression">{predicate:2}+{var:lvlquant}*{var:wtquant}</Ind>
          <Ind uri="nxbre://expression">{predicate:3}+{var:lvldesc}</Ind>
          <Ind uri="nxbre://expression">{predicate:4}+{var:wtdesc}</Ind>
        </Atom>
      </head>
      <body>
        <And>
          <Atom>
            <Rel>DoLvl</Rel>
            <Var>Bh#</Var>
            <Var>lvlquant</Var>
            <Var>lvldesc</Var>
          </Atom>
          <Atom>
            <Rel>DoWt</Rel>
            <Var>gr</Var>
            <Var>wtquant</Var>
            <Var>wtdesc</Var>
          </Atom>
          <Atom>
            <op>
              <Rel>Bva</Rel>
            </op>
            <Var>person</Var>
            <Var>gr</Var>
            <Var>Bh#</Var>
          </Atom>
        </And>
      </body>
    </Implies>
  </Assert>

  <Assert mapClosure="universal">
    <!-- Do Bh & gr weightage FACTS-->
    <Atom>
      <Rel>DoLvl</Rel>
      <Ind>2</Ind>
      <Data xsi:type="xs:int">3</Data>
      <Ind>For 2</Ind>
    </Atom>

    <Atom>
      <Rel>DoWt</Rel>
      <Ind>Ci</Ind>
      <Data xsi:type="xs:int">2</Data>
      <Ind>For Ci</Ind>
    </Atom>

    <!-- Starting Implication for both Dos; to be modified by Implication-->
    <Atom>
      <oid>
        <Ind>Ci Do</Ind>
      </oid>
      <op>
        <Rel>grDo</Rel>
      </op>
      <Ind>0</Ind>
      <Ind>Ci</Ind>
      <Data xsi:type="xs:int">0</Data>
      <Ind> </Ind>
      <Ind> </Ind>
    </Atom>
    <Atom>
      <oid>
        <Ind>Sy Do</Ind>
      </oid>
      <op>
        <Rel>grDo</Rel>
      </op>
      <Ind>0</Ind>
      <Ind>Sy</Ind>
      <Data xsi:type="xs:int">0</Data>
      <Ind> </Ind>
      <Ind> </Ind>
    </Atom>
  </Assert>

  <Query>
    <oid>
      <Ind>Ci Do</Ind>
    </oid>
    <Atom>
      <op>
        <Rel>grDo</Rel>
      </op>
      <Ind>0</Ind>
      <Ind>Ci</Ind>
      <Var>quant</Var>
      <Var>lvldesc</Var>
      <Var>wtdesc</Var>
    </Atom>
  </Query>
  <Query>
    <oid>
      <Ind>All Do</Ind>
    </oid>
    <Atom>
      <op>
        <Rel>grDo</Rel>
      </op>
      <Var>person</Var>
      <Var>gr</Var>
      <Var>quant</Var>
      <Var>lvldesc</Var>
      <Var>wtdesc</Var>
    </Atom>
  </Query>
RTK
  • 15
  • 3
  • Please be more specific: What existing rule file? Can you show the implication you're adding? – David Dossot Apr 13 '17 at 14:51
  • Existing rule file = the file I have been using in my App with 14 working Implications for the last 4 years. Have added the new Implication, Facts & Query in the question above. – RTK Apr 14 '17 at 10:55
  • I'm surprised that `Bh#` is a valid `Var` name. But since you say that things work fine with the console, I'm wondering what's the difference between NxBRE running in the console and running embedded in your app. Are they using the same version of the core engine? – David Dossot Apr 15 '17 at 01:37
  • 1
    NxBRE in App - 3.2.0.33298; NxBRE Assembly in IEConsole - 3.2.0.15530; IEConsole version - 1.3.2.30671. Also...my thots too have been in thinking about what could be different. Maybe some difference in defaults in both? – RTK Apr 15 '17 at 06:00
  • It would be nice if you could run the inference engine with the maximum logger verbosity and diff the output from the console and from your code. This would help pinpointing the discrepancy. – David Dossot Apr 15 '17 at 16:01
  • Have added in the post above the exceptions shown in the ie-console log. They are the AppSettings which are taking default values...but wondering whether this "exception" is stopping the App execution? – RTK Apr 15 '17 at 18:09
  • Yup..comparing the logs is what I am trying. Got the console log. Trying to figure out how to get a similar output from my code :-( Trying to figure out logger and NxBRE switch etc, but quite lost. Will look through the ie-console code to figure out the logging process. – RTK Apr 16 '17 at 10:27
  • Logging is described in chapter 5 of the user guide. Everything relies on `System.Diagnostics.TraceSource` and `System.Diagnostics.TraceSwitch`. The errors you are seeing mean that `NxBRE` is not configured properly and some features (like in-memory compilation of binders) may fail. Make sure it is properly configured (chapter 4 of user guide and [embedded defaults](https://github.com/ddossot/NxBRE/blob/master/NxBRE3/Source/NxBRE.dll.config)). – David Dossot Apr 16 '17 at 15:27

0 Answers0