I am a software engineer trying to describe a system of interacting
services and the messages they send, in an attempt to better understand
and improve the messaging.
I started by defining my system in SQL, but have problems due to the
lack of recursion. Prolog seems rather complex, so I thought I might
be best using Datalog. Via Wikipedia I found DLV.
However, I am now stuck. I hope this might be a suitable place to ask
for help. I want to make sure that every "call" predicate (which
describes a message being sent) has a first argument which is a
process. I used:
:- call(P, _, _, _, _), not process(P, _).
as a strong constraint, but this is unsafe. Some example data:
application(des, "Data Entry Service").
application(fis, "File Information Service").
process(p_des, "Data enters the system").
method(fis, fis_regfile, "registerFileInformation").
call(p_des, des_fis_regfile, des, fis_regfile, "register new data").
return(p_des, des_fis_regfile).
follow(p_des, des_nmg_newname, des_fis_regfile).
which indicates that during process "p_des", a message (labelled
des_fis_regfile) is sent from "des" (a service) to "fis_regfile" (a
method on a service).
How do I express this constraint (I am worried that I have errors in my
data and want to detect them)?
Am I crazy?! :o) Any help appreciated - I know some computing theory
(mainly type theory related to functional programming), but have never
used a completely declarative system before.
Thanks,
Andrew
Andrew
Have a look at constraint handling rules:
http://en.wikipedia.org/wiki/Constraint_Handling_Rules
http://www.cs.kuleuven.ac.be/~dtai/projects/CHR/
Regards.
--- nef
Then I loaded the DB into DLV and did the analysis, knowing that the
data were correct.
More details at http://www.acooke.org/cute/DatalogDLV0.html
Andrew
and...@acooke.org wrote:
> Hi,
>
> I am a software engineer trying to describe a system of interacting
> services and the messages they send, in an attempt to better understand
> and improve the messaging.
[...]
In the negated clause in my constraint I had used "_" without giving it
any thought. But all variables in a negated clause need to be bound
(at first this struck me as odd, but I believe it's because otherwise
"you" are pretty much free to choose "_" so that the constraint fails,
which makes it pointless).
The fix is trivial - pull out the field of interest via a separate
clause, so that no "_" is needed.
Thanks to Wolfgang Faber, one of the DLV developers, who took the time
to explain this over email.
Andrew
This MSDN article might interest you, though it may not be directly relevant
to your current tasks.
"Building a Rule Engine with SQL Server"
http://msdn2.microsoft.com/en-us/library/Aa964135
Clark