PRD Logic Example

From RIF
Jump to: navigation, search

Back to PRD Discussions Page

This page shows an example of interchange of a Prolog program to PRD.

The Prolog programs deals with parent relationships. It asserts some direct parent relationships, and provides rules to infer derived relationships such as uncle or aunt.

In terms of pipeline, the Prolog example is first translated into RIF, then the PRD consumer (for example ILOG JRules) will read the RIF document. For this reason, we have to write this example in RIF to see the real issues.


While writing the JRules program, I have encountered the following issues:

  • It is extremely difficult and error prone to infer and create an object model while reading the RIF document. The names of the relations give indications to the class names, but the field names and types are undefined. If the Prolog program deals mainly with symbols, there are several ways to implement symbols in Java (as string, as enums or as ints). Each way will give arise to slightly different rules, and performance is not the same.
  • All the classes are supposed to have simple-valued fields. This is because the data are relation oriented, they are not clustered as frames. The same example with frames will provide a more complete understanding.
  • Some uniqueness tests need to be inserted. See "sibling" rule, I have inserted this test (?X != ?Y). This fordids the same object to match both conditions. This could be a difficulity in the translation pipeline.
  • There is a difficulty to translate the Prolog query into production rule. The query needs to be turned into some way that conforms to the production rule.


  • The RIF consumer cannot create the object model by analyzing the rules and guessing the structure and types. Such an approach is extremely limited and error-prone. PRD must provide a way to indicate the data or object model which supports the rules. This can be achieved by providing a reference to the model and leave the RIF document rule centric. The RIF document consumer will first prepare the hosting model using the reference to the model, prior to reading the rules.