An inference engine for RDF - Agfa
An inference engine for RDF - Agfa
An inference engine for RDF - Agfa
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>An</strong> <strong>inference</strong> <strong>engine</strong> <strong>for</strong> <strong>RDF</strong><br />
Definition: an <strong>inference</strong> step is the act of passing from one state to another (with<br />
the exception of states 1 and 2).<br />
<strong>An</strong> <strong>inference</strong> step uses a data structure InfData:<br />
data InfData = Inf {graphs::Array Int <strong>RDF</strong>Graph, goals::Goals, stack::Stack,<br />
lev::Level, pdata::PathData, subst::Subst,<br />
sols::[Solution], ml::MatchList, mes::String }<br />
This data structure is specified in an Abstract Data Structure InfADT.hs<br />
(fig.5.10). It illustrates how complex data structures can easily be handled in<br />
Haskell using field labels. The use of field labels provides <strong>for</strong> evolvability of the<br />
datastructure because single fields can be easily removed or added without<br />
provoking major changes to the program. For instance, to get access to the stack,<br />
the instruction:<br />
stackI = stack inf where inf is an instance of InfData, can be used.<br />
This is a complex data structure. Its acess is further simplified by access routines<br />
in the ADT like e.g. sstack: show the contents of the stack in string <strong>for</strong>mat.<br />
The elements of the data structure are :<br />
Array Int <strong>RDF</strong>Graph: The array containing the <strong>RDF</strong> graphs.<br />
Goals: The list of goals that have to be proved.<br />
Stack: The stack needed <strong>for</strong> backtracking.<br />
Level: The inferencing level. This is needed <strong>for</strong> renumbering the variables and<br />
backtracking.<br />
PathData: A list of the statements that have been unified. This is used to<br />
establish the proof of the solutions.<br />
Subst: The current substitution. This substitution must be applied to the current<br />
goal.<br />
[Solution]: The list of the solutions.<br />
MatchList: This is a list of Match constructors:<br />
data Match = Match {msub::Subst, mgls::Goals, bs::BackStep}<br />
Matching two statements gives a substitution, a list of goals (that may be empty)<br />
and a backstep. A backstep is nothing else than a tuple <strong>for</strong>med by the two<br />
matched statements. This is needed <strong>for</strong> producing the proof of a solution.<br />
A substitution with a list of goals <strong>for</strong>ms an alternative.<br />
String: This string is used <strong>for</strong> maintaining the state of the process.<br />
<strong>An</strong> <strong>inference</strong> step has as only input an instantiation of InfData and as only<br />
output an instantiation of InfData. The data structure contains all the necessary<br />
in<strong>for</strong>mation <strong>for</strong> the next <strong>inference</strong> step.<br />
<strong>An</strong>other mini-language <strong>for</strong> inferencing is defined in module InfML.hs.<br />
It is shown in fig. 5.11.<br />
Fig. 5.12 gives the source code of the module that executes the inferencing<br />
process <strong>RDF</strong>Engine.hs.<br />
80