Print Statement

Last revised 7/15/2021. Contact us.
The print statement is a SADL grammar statement beginning with the keyword "Print:". The keyword can be followed by any of three possible completions to accomplish the objectives described below.

Print a String to the Console Window
Print the Entire Inferred Model
Print the Deductions Model

Print a String to the Console Window

One possibility is to print a specified string to the console window. This allows comments to be placed in the inference results that are output to the console window (or to a file, see Write Statement) for easier readability of test results. Consider this example.

Print: "\nThese results are from the definition of the named query 'Q1':".
Ask Q1: area.

Print: "\nThese results are from a reference to the named query 'Q1':".
Ask Q1.

Print: "\nThese are all of the names of known rules:".
Ask: x is a ^Rule.

Print: "\nThese are all of the instances of the Shape class:".
Ask: "select ?s where {?s <rdf:type> <Shape>}".

The above SADL statements will result in output to the console window that looks something like this.

These results are from the definition of the named query 'Q1':
Query: select ?v0 ?v1 where {?v0 <http://sadl.org/Shapes.sadl#area> ?v1}
"v0","v1"
"MyCircle","28.27433466911316"
"MyRect","8.0"

These results are from a reference to the named query 'Q1':
Query: select ?v2 ?v3 where {?v2 <http://sadl.org/Shapes.sadl#area> ?v3}
"v2","v3"
"MyCircle","28.27433466911316"
"MyRect","8.0"

These are all of the names of known rules:
Query: select ?x where {?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://sadl.org/sadlimplicitmodel#Rule>}
"x"
"AreaOfRectangle"
"AreaOfCircle"

These are all of the instances of the Shape class:
Query: select ?s where {?s <rdf:type> <Shape>}
"s"
"MyRect"
"MyCircle"

Print the Entire Inferred Model

Another usage of the print statement is to write the inferred model, which will include the conceptual model, the instance data, and the inferences, to an OWL model file in the project's Temp folder. The output file name is derived from the model being inferred and ends in "Model.owl.txt". The ".txt" is appended to ensure that the output model file is not indexed by SADL as an OWL model available for use, which would result in name conflicts. The statement consists of the keyword followed by "Model".

Print: Model.

This statement will result in output to the console window like the following, and will cause the indicated file to be created.


Model written to 'home/camfe/andy/ws/sadl/git/sadlos2/sadl3/Examples/TestSadl3Ide/Temp/Test2.sadl.Model.owl.txt'


Print the Deductions Model

A third usage of the print statement is to write the deductions model, which will include only those triples that are inferred by the reasoner, to an OWL model file in the project's Temp folder. The file name is derived from the model being inferred and ends in "Deductions.owl.txt". The ".txt" is appended to ensure that the output model file is not indexed by SADL as an OWL model available for use, which would result in name conflicts. This statement consists of the keyword followed by "Deductions".

Print: Deductions.

This statement will result in output to the console window like the following, and will cause the indicated file to be created.

Deductions written to 'home/camfe/andy/ws/sadl/git/sadlos2/sadl3/Examples/TestSadl3Ide/Temp/Test2.sadl.Deductions.owl.txt'