1. Home
  2. Getting Started
  3. Modelling
  4. High-level language production rules

High-level language production rules

◷ Reading Time: 1 minute


There are two high-level languages are supported for inferencing:

  1. XML based
  2. SExpression


    <reference assembly="FlexRule.Samples.PersonAge.exe"/>
    <import type="FlexRule.Samples.Person" />
    <import type="FlexRule.Samples.Gender" />
    <import type="System.Console" />
    <defrule name="older and younger">
        <match type="Person" variable="older">
          <e>e.Sex == Gender.Female</e>
        <match type="Person" variable="younger">
          <p>p.Age < older.Age</p>
          <o>o.Sex == Gender.Male</o>
        <action context="ctx" name="Print result">
          <execute>Console.WriteLine("{0} ({1}) is older than {2} ({3})", older.Name, older.Age, younger.Name, younger.Age)</execute>


    (reference (@assembly "FlexRule.Samples.PersonAge.exe"))
    (import (@type FlexRule.Samples.Person))
    (import (@type FlexRule.Samples.Gender))
    (import (@type System.Console))
    (defrule (@name "older and younger")
        (match (@type Person) (@variable older)
          (e "e.Sex == Gender.Female")
        (match (@type Person) (@variable younger)
          (p "p.Age < older.Age")
          (o "o.Sex == Gender.Male")
        (action (@context ctx) (@name "Print result")
          (execute 'Console.WriteLine("{0} ({1}) is older than {2} ({3})", older.Name, older.Age, younger.Name, younger.Age)')
Updated on October 30, 2023

Was this article helpful?

Related Articles