tags:

views:

44

answers:

1

I want to model a simple (IF Then) rule using DTD. This is what I have come up with:

<!ELEMENT forward    ((rule | fact)*)> 

<!ELEMENT rule       (if, then)> 

<!ELEMENT fact       (#PCDATA)> 

<!ELEMENT if         (#PCDATA)> 

<!ELEMENT then       (#PCDATA)>

This is a dtd for a forward rule ( p => c). I want to model the backward rule as well ( c <= p) using conclusion and premise elements instead of if and then. Do I just need to change if and then to cons and prem or do I need to do something else. I appreciate your responses.

A: 

XML DTDs simply give you a syntax for your model. You could, for example, write:

<rule>
  <if>is raining</if>  
  <then>pigs will fly</then>
</rule>

and

<rule>
  <cons>pigs will fly</cons>  
  <prem>is raining</prem>
</rule>

but you will have to provide any logic connecting these two and write it yourself. XML gives you no specific help.

I would suggest you look at languages such as Prolog.

peter.murray.rust