If the current reasoner supports derivation logging and it is enabled, the derivations can be shown in one of two ways. For illustration purposes, we will use the following small example which defines a Person with some attributes including their birthdate and calculates their age.
Gender
is a class, must be one of {Male, Female}.
Person is a class, described by gender with a single value of type Gender,
described by age with a single value of type int,
described by birthdate with a single value of type date.Rule
AgeRule:
given p is a Person
if bd is birthdate of p
cd is now()
x is subtractDates( cd, bd, "y")
xi is floor(x)
then age of p is xi .Joe
is a Person, gender Male, birthdate "2000-03-15" .
Susan is a Person, gender Female, birthdate "1980-04-09".
Jake is a Person, gender Male, birthdate "1951-04-20".
The first method of derivation logging happens automatically by turning on derivations in the reasoner configuration preferences (see Jena Reasoner Configuration for an example). The derivations are placed in a log file in the Temp folder of the project with a filename containing the SADL file name. If the above model is defined in the project file "zdecl.sadl", then the console output will contain a hyperlink to the derivation output and the contents of the derivation log will look something like this:
Derivations from instance data 'file:/G:/sadl/eclipse/workspace/SmallTest/OwlModels/zdecl.owl', 2011-05-03 12:01:03
Joe age 11
was concluded by: Rule AgeRule
based on matching conditions:
Joe type Person
Joe birthdate 2000-03-15
Jake age 60
was concluded by: Rule AgeRule
based on matching conditions:
Jake type Person
Jake birthdate 1951-04-20
Susan age 31
was concluded by: Rule AgeRule
based on matching conditions:
Susan type Person
Susan birthdate 1980-04-09
The other means of obtaining derivation information is much more precise to a specific conclusion. Suppose that the following statement is added to our model above:
Explain:
Joe has age 11 .
This would result in the following output to the console window with a hyperlink to the statement generating the output:
Explanation of 'Joe, age, 11':
Derivation of
Joe, age, 11:was concluded by: Rule AgeRule
based on matching conditions:
Joe type Person
Joe birthdate 2000-03-15
Note that the "Explain" statement will provide information about how statements that are not found in the model might have been inferred and why they weren't and about the matching of rule premises. See the Quick Reference Guide for examples.
Snapshots of two models are available using the "Print" statement. The first usage is:
Print:
Deductions.
This will cause the deductions OWL model to be saved to a file in the project's Temp folder. The file name is derived from the model being inferred and ends in "Deductions.owl".
The second usage is:
Print:
Model.
This causes the entire inferred model, which will include the conceptual model, the instance data, and the inferences, to be saved to an OWL model file in the project's Temp folder. The file name is derived from the model being inferred and ends in "Model.owl".