-
Notifications
You must be signed in to change notification settings - Fork 5
/
indtd0.8.xml
1277 lines (1120 loc) · 51.6 KB
/
indtd0.8.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet href="homepage.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<!-- Written by Harold Boley "[email protected]" -->
<homepage>
<title>RuleML DTDs</title>
<opening>
<center>
<big>
<box bgcolor="#CCCCFF"><code><![CDATA[
-->]]></code></box>
<box bgcolor="#FFCCCC">R u l e M L</box>
<box bgcolor="#CCCCFF"><code><![CDATA[
<--]]></code></box>
</big>
<br/> <br/>
<!-- <xhtml><big><b>RuleML DTDs</b></big></xhtml> -->
<h1>RuleML DTDs</h1>
<h2><a href="http://www.cs.unb.ca/~boley/">Harold Boley</a>, <a href="http://ebusiness.mit.edu/bgrosof/">Benjamin Grosof</a>, <a href="http://home.comcast.net/~stabet/">Said Tabet</a>, <a href="http://tmitwww.tm.tue.nl/staff/gwagner/">Gerd Wagner</a></h2>
<h4>Version History, 2001-01-25: <a href="http://www.ruleml.org/indtd.html">Version 0.7</a></h4>
<h2>Version History, 2001-07-11: <a href="http://www.ruleml.org/indtd0.8.html">Version 0.8</a></h2>
<h2>Ongoing Work: <a href="http://www.ruleml.org/inxsd0.8.html">XML Schema Version 0.8</a></h2>
<h2>All DTDs: <a href="http://www.ruleml.org/dtd/0.8/">DTD Directory</a></h2>
<h2>Some Examples: <a href="http://www.ruleml.org/exa/0.8/">Examples Directory</a></h2>
</center>
<br/> <br/> <br/>
<p>
This is a revised DTD draft for RuleML.
Each DTD in the evolving hierarchy corresponds to a specific RuleML sublanguage.
The DTDs use a modularization approach similar to the one in XHTML
in order to offer appropriate flexibility and accomodate
different implementations and approaches.
We will write a technical report on this system of RuleML DTDs
(see also <a href="http://www.ruleml.org/ruleml-krdtd/sld001.htm">KR Principles and DTD Modularization</a>).
</p>
</opening>
<section>
<header>Changes</header>
<p>
The current Version 0.8 differs from the earlier Version 0.7 by principally shifting the
approach from a positional representation of rules towards an object-centered one. This was
motivated by RuleML's semantic neutrality w.r.t. backward and forward reasoning as well as
by a comparison of the mostly positional XML data model with the mostly object-centered RDF
data model:
In Version 0.7, a rule ('if') element's children were positionalized, XML-style,
in the fixed order of a conclusion followed by premises; in Version 0.8, a rule ('imp')
element's children are predicate-object ('role'-'type') pairs, RDF-style, whose positions are immaterial.
Thus, while Version 0.8, as well as future versions, remain <b>based</b> on XML, we make an
object-centered <b>usage</b> of XML via novel 'role' tag names complementing the normal 'type' tag names.
In order not to change too many things at once, we didn't yet work on proceeding from DTDs to XML Schemas.
However, we already see some places where the added expressive power of XML Schemas could help Version 0.8,
in particular, XML Schema datatypes. The XML Schema expressiveness should also improve the other important
change in RuleML, namely the replacement
of Version 0.7 ur elements by corresponding Version 0.8 attributes. This permits not only each ind
but also each rel (as required for RDF triples) etc. to be regarded as a URI 'object'.
Important additions in RuleML 0.8 are the n-tuple (tup) and role-list (roli) datatypes,
which can be employed, respectively, in a positional and non-positional manner,
to replace all n-ary operations by unary ones.
</p>
<p>
The DTD files etc. of the earlier Version 0.7 will be kept "as is"; actually, RuleML 0.7 can be regarded as
a language in its own right, which may serve future RuleML versions as a "purely positional"
reference language for feature comparisons etc. Since to our knowledge not many rulebases have yet been written
in Version 0.7 (with the notable exception of <a href="http://www.daml.org/2001/02/gedcom-ruleml/">GEDCOM</a>),
we currently have no full-blown XSLT translator for automatically upgrading them to Version 0.8.
However, there is a GEDCOM-oriented upgrading translator
(cf. the GEDCOM entry of the <a href="http://www.ruleml.org/#Library">RuleML Rulebase Library</a>),
which should be easy to adapt to other RuleML 0.7-to-0.8 upgrades.
Version 0.8 was partially inspired by a presentation of
<a href="http://www.ruleml.org/RuleML-RDF/sld001.htm">RuleML 0.7 to an RDF audience</a>.
Hence, a RuleML 0.7-to-RuleML 0.8 translator could probably be constructed taking our
<a href="http://www.ruleml.org/inrdf.html">experimental RuleML 0.7-to-RDF translator</a>
as a starting point.
Since RuleML 0.7 is a positional system with similarities to RFML,
a 0.7-to-0.8 translator could also take advantage of the
<a href="http://www.relfun.org/ruleml/rfml-ruleml.html">translator from RFML to RuleML 0.8</a>.
</p>
</section>
<section>
<header>Overview</header>
<p>
The upper layer of the RuleML hierarchy of rules is discussed in our
main page's <a href="index.html#Design">design section</a>.
In that terminology, the system of RuleML DTDs presented here only covers
derivation rules, not reaction rules
(special tags for facts have now been introduced).
</p>
<p>
This is because we think it is important to start with a subset of
simple rules, test and refine our principal strategy using these,
and then work 'up' to the more general categories of rules in the hierarchy.
For this we choose
<a href="http://www-lp.doc.ic.ac.uk/UserPages/staff/ft/alp/net/dbs/datalog.html">Datalog</a>, a language corresponding to relational databases
(ground facts without complex domains or 'constructors')
augmented by views (possibly recursive rules),
and work a few steps upwards to further declarative rules
as allowed in (equational) Horn logic.
We also introduce a URL/URI language corresponding to
simple objects. The 'UR'-Datalog join of both of these classes then permits
inferences over RDF-like 'resources' and can be re-specialized to
RDF triples:
<a href="http://www.ruleml.org/ruleml-krdtd/sld012.htm">hierarchy slide</a>.
</p>
<p>
Regarding the concrete markup syntax, we have been experimenting
with several DTDs prior to the current, still preliminary, version.
The rationale for our current tags is as follows.
<enumerate>
<item>Rather than leaving conjunction implicit, an explicit tag pair
<tt><and></tt> ... <tt></and></tt> with a sequence of N conjuncts is used
(this would preferably be a set of conjuncts),
preparing the unavoidable explicit markup of other boolean connectives
(mainly <tt><or></tt> ... <tt></or></tt>) and their nesting.
</item>
<item>As a result of previous discussions,
RuleML now uses an XML-RDF-unified data model with "Order-Labeled (OrdLab) Trees" as its notational base;
cf. <a href="http://www.dfki.uni-kl.de/~boley/xmlrdf.html">A Web Data Model Unifying XML and RDF</a>.
</item>
<item>In particular, we conventionally mark up <a href="http://www.w3.org/TR/REC-rdf-syntax/">RDF</a>-like 'predicates' or <a href="http://www.w3.org/2000/10/swap/Primer.html">N3</a>-like 'verbs', here called 'roles',
by "<tt>_</tt>"-prefixed tags in XML (if all class-like 'type' tags would start with an upper-case letter, then
'role' tags could also be distinguished, Java-like, by having them start with a lower-case letter, as in
<a href="http://www.dfki.uni-kl.de/frodo/rdf2java/">The FRODO rdf2java Tool</a>;
alternatively different namespaces for RuleML types and roles could be used);
dually to regarding "<tt>_</tt>" as a prefix to be reserved as the first
character of role tag names,
it can also be viewed as an extension of the opening angular brackets of role start tags, "<tt><_</tt>",
and end tags, "<tt></_</tt>".
</item>
<item>Using an <tt>atom</tt> (for a single premise) or an <tt>and</tt> (for a conjunction of premises) in the role of the body
and an <tt>atom</tt>ic conclusion in the role of the head, rules aggregate
two commutative roles;
in particular, our Horn-like implication rules equivalently become
<tt><imp></tt> <tt><_body></tt> <tt><and></tt> <i>prem1</i> ... <i>premN</i> <tt></and></tt> <tt></_body></tt> <tt><_head></tt> <i>conc</i> <tt></_head></tt> <tt></imp></tt>
or become
<tt><imp></tt> <tt><_head></tt> <i>conc</i> <tt></_head></tt> <tt><_body></tt> <tt><and></tt> <i>prem1</i> ... <i>premN</i> <tt></and></tt> <tt></_body></tt> <tt></imp></tt>
(thus unifying <a href="http://logic.stanford.edu/kif/dpans.html">KIF</a>'s "implication" and "reverse implication" syntaxes).
</item>
<item>The main advantage of roles is that of feature-term or object-centered modeling:
If some extra information is to be added to an element
such as a priority factor to the <tt>imp</tt> element, then
it is easy to attach, RDF-like, a new <tt>_priority</tt> role with a <tt>float</tt>-type value;
on the other hand the insertion, XML-like, of the <tt>float</tt>-type value directly into
the child sequence would (be harder to read and) cause all subsequent children to assume a new
position in the element (a problem for processing via XSLT etc.).
</item>
<item>The (head and body) roles of the two subelements (children) of the XML element
<tt><imp></tt> <i>head</i> <i>body</i> <tt></imp></tt> or
<tt><imp></tt> <i>body</i> <i>head</i> <tt></imp></tt> enable commutativity at the cost of
introducing an extra level of markup (but see below). Future equivalence rules
<tt><equiv></tt> <i>lequiv</i> <i>requiv</i> <tt></equiv></tt>,
with interchangeable (lequiv and requiv) subelements, could use (implicit) _1 and _2 roles also
used in all other RuleML connectives such as a binary <tt>and</tt>.
</item>
<item>The extra level of markup introduced by roles is most valuable,
hence only used in RuleML 0.8, when there are meaningful role names
such as <tt><_head></tt> and <tt><_body></tt> (as contrasted to 'structural' role names
such as <tt>_1</tt> and <tt>_2</tt>):
If meaningful role names are visualized as arc labels in a tree representation like RuleML 0.8's
T3 in section <a href="#Context">Context</a>, this tree does not entail extra depth compared to RuleML 0.7's T1,
only meaningful extra names for certain arcs.
In general, the type-role alternation of 0.8 markups, similar to RDF,
is nicely visualized via a node-label alternation in trees.
Moreover, two different roles can be used to uniquely access (e.g., via XSLT)
the same type in a position-independent manner such as when the <tt><_head></tt> and <tt><_body></tt>
of a (single-premise) rule are both the <tt><atom></tt> type.
Even when a type is later changed (say, from <tt><atom></tt> to <tt><and></tt>),
the role (say, <tt><_body></tt>) can stay the same (e.g., for uniform XSLT access).
Finally, a graphical RuleML editor could directly work on T3-like (OrdLab) trees.
</item>
<item>The backward <b>variant</b>
<tt><imp></tt> <i>head</i> <i>body</i> <tt></imp></tt>
of most examples below makes them better comparable to
the standard notation of Horn rules. The forward <b>variant</b>
<tt><imp></tt> <i>body</i> <i>head</i> <tt></imp></tt>, better comparable to production rules,
will be exemplified in section <a href="#Abstraction">Abstraction</a>, T3[9of16].
Future directed equations could be easily added via a 'foot' role for an
equation's right-hand side (the defined function's returned value):
<tt><direq></tt> <i>head</i> <i>foot</i> <i>body</i> <tt></direq></tt> or
<tt><direq></tt> <i>head</i> <i>body</i> <i>foot</i> <tt></direq></tt>.
</item>
<item>In the new data model an element can have "mixed content" in the new sense of
having both 'role' and 'type' children
(see the <tt>atom</tt> examples in T3/X3 below whose content consists of
one _opr-role child before (or after) _1, _2, ... var-type children):
while the 'type' children form an ordered sequence as in XML
(without need for RDF's Sequence container), the 'role' children
are commutative as in RDF (treating an ordered sequence as a unit,
as if it was reified into a Sequence container under an _args role as in T6/X6).
The "_"-integers _1, _2, ... can be viewed as 'system-generated' roles,
which are always useful when one runs out of (meaningful) 'user-defined' roles:
Like for 'rest' variables in Lisp, Prolog, etc.,
there is at most one _1, _2, ... sequence per element
for capturing otherwise unnamed, normally adjacent, children
(normally, no other, role-named child should intervene in this sequence,
so it is improbable that we will introduce _op-role <a href="#Infix-Variants">infix variants</a> in the future).
</item>
<item>In RuleML 0.8 the (implicit) roles _1, _2, ... are used generically for the arguments of relations, functions,
and constructors; they could also have been named _arg1, _arg2, ..., but we wanted to be consistent with
RDF's rdf:_1, rdf:_2, ... container-element predicates and with numeric indexes into 1-dimensional arrays.
Similary, the roles _opr, _opf, _opc are substitutes (required by DTDs)
for a generic role _op for the operator of relations, functions, and constructors.
Role names need only discriminate between the children of an element, and
the current set was partially chosen for mnemonic reasons.
</item>
<item>While the _op roles could be avoided by regarding an operator, Lisp-like, as part
of its own argument sequence (as if it was role _0 or_arg0), we did introduce them
in RuleML 0.8 for the following reasons:
<enumerate>
<item>An _op role for the operator complements one (implicit) _args role for a sequence of the arguments
(explicit in T6/X6 of section <a href="#Context">Context</a>) or a sequence of (implicit) _arg1, _arg2, ... or
_1, _2, ... roles for the arguments (explicit in T4/X4 and T5/X5 of section <a href="#Context">Context</a>). Using n-tuples, _op complements one (implicit) _1 role for a tup of the arguments
(cf. T7/X7 of section <a href="#Context">Context</a>).
</item>
<item>There may be further sibling roles to discriminate _op from on the level of
atom (and nano and cterm) types
such as a _qual(ification) role or a _comment role.
</item>
<item><a name="Infix-Variants"></a>
The _op-role notation allows both prefix and postfix variants, as well as
possible future infix variants (especially for binary relations, functions, and constructors),
where the _op role would intervene in the sequence of consecutive _1, _2, ... children (which would
hinder our current sequence-as-Seq view).
</item>
<item>While in the current first-order RuleML sublanguages the role _opr always has
a child of type rel (similarly for _opf and _opc), so that there is some duplicate role-type markup,
in future (syntactically) higher-order RuleML sublanguages
the role _opr may also have children of type var (for relation-valued variables) or type nano
(for relation-valued function calls) and the roles _1, _2, ... may also have children of type rel
(for relations as arguments), so that no role-type redundancy remains in the markup.
</item>
<item>Full role markup can also give us uniformity to a future feature-term sublanguage within RuleML
(prepared by the current role-list datatype in <a href="http://www.ruleml.org/dtd/0.8/ruleml-hornlog.dtd">http://www.ruleml.org/dtd/0.8/ruleml-hornlog.dtd</a>). This should be closely coordinated with
the use of F-Logic in <a href="http://www-db.stanford.edu/~stefan/2001/02/rdfinterest/">Triple</a>.
</item>
<item>Finally, this brings RuleML closer to RDF, DAML+OIL, and other language for the Semantic Web.
</item>
</enumerate>
</item>
<item>Similarly, we keep the _head role
inside the fact type, which originates from, and permits access uniform to,
its rule (or clause) ancestor imp,
since there soon should be other named roles in facts, e.g.
_priority, so _head will not stay 'lonely' for long.
</item>
</enumerate>
</p>
</section>
<section>
<header>Context</header>
<p>
Here we exemplify RuleML 0.8 in the context of six
versions of rule representations as trees and their corresponding XML markups,
from totally ordered (most concise) to totally labeled, with Seq containers (most verbose).
The first version corresponds to RuleML 0.7 with
<tt>if</tt> replaced by <tt>imp</tt>. The last version is the one most related to RDF.
The T3/X3 version corresponds to RuleML 0.8, which employs RDF-like role labels exactly where
they prevent order overspecification (which arbitrarily puts a non-positional type into the child order)
and uses the natural XML child order instead of RDF's Seq containers.
</p>
<p>
We will use the following sample rule:
<code><![CDATA[
A person owns an object
if that person buys the object from a merchant and the person keeps the object.]]></code>
</p>
<p>
<code><![CDATA[
T1: As an Ordered Tree ("|"-Arcs: Ordered left to right, as if labeled 1, 2, ...):
imp---------------------------------
| |
| |
| |
atom------------------ and----------------------------------------
| | | | |
| | | | |
| | | | |
rel var var atom--------------------------- atom------------------
. . . | | | | | | |
. . . | | | | | | |
. . . | | | | | | |
own person object rel var var var rel var var
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X1: As XML Markup without any Roles:
<imp>
<atom>
<rel>own</rel>
<var>person</var>
<var>object</var>
</atom>
<!-- explicit 'and' -->
<and>
<atom>
<rel>buy</rel>
<var>person</var>
<var>merchant</var>
<var>object</var>
</atom>
<atom>
<rel>keep</rel>
<var>person</var>
<var>object</var>
</atom>
</and>
</imp>]]></code>
</p>
<p>
<code><![CDATA[
T2: As an Order-Biased Tree ("|"-Arcs: Ordered left to right, implicitly labeled 1, 2, ...;
"*"-Arcs: Unordered but explicitly labeled):
imp---------------------------------
* *
head * body *
* *
atom------------------ and----------------------------------------
| | | | |
| | | | |
| | | | |
rel var var atom--------------------------- atom------------------
. . . | | | | | | |
. . . | | | | | | |
. . . | | | | | | |
own person object rel var var var rel var var
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X2: As XML Markup with Roles only for parents all of whose child Types are Non-Positional:
<imp>
<_head>
<atom>
<rel>own</rel>
<var>person</var>
<var>object</var>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<rel>buy</rel>
<var>person</var>
<var>merchant</var>
<var>object</var>
</atom>
<atom>
<rel>keep</rel>
<var>person</var>
<var>object</var>
</atom>
</and>
</_body>
</imp>]]></code>
</p>
<p>
<code><![CDATA[
T3: As an Order-Labeled Tree ("|"-Arcs: Ordered left to right, implicitly labeled 1, 2, ...;
"*"-Arcs: Explicitly labeled as in Arc-Labeled Trees below):
imp---------------------------------
* *
head * body *
* *
atom------------------ and----------------------------------------
* | | | |
opr * | | | |
* | | | |
rel var var atom--------------------------- atom------------------
. . . * | | | * | |
. . . opr * | | | opr * | |
. . . * | | | * | |
own person object rel var var var rel var var
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X3: As XML Markup with Roles only for Non-Positional Types:
<imp>
<_head>
<atom>
<_opr><rel>own</rel></_opr>
<var>person</var>
<var>object</var>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<_opr><rel>buy</rel></_opr>
<var>person</var>
<var>merchant</var>
<var>object</var>
</atom>
<atom>
<_opr><rel>keep</rel></_opr>
<var>person</var>
<var>object</var>
</atom>
</and>
</_body>
</imp>]]></code>
</p>
<p>
<code><![CDATA[
T4: As a Label-Biased Tree:
imp---------------------------------
* *
head * body *
* *
atom------------------ and----------------------------------------
* * * | |
opr * 1 * 2 * | |
* * * | |
rel var var atom--------------------------- atom------------------
. . . * * * * * * *
. . . opr * 1 * 2 * 3 * opr * 1 * 2 *
. . . * * * * * * *
own person object rel var var var rel var var
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X4: As XML Markup with Roles for all parents having at least one Non-Positional Type as child:
<imp>
<_head>
<atom>
<_opr><rel>own</rel></_opr>
<_1><var>person</var></_1>
<_2><var>object</var></_2>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<_opr><rel>buy</rel></_opr>
<_1><var>person</var></_1>
<_2><var>merchant</var></_2>
<_3><var>object</var></_3>
</atom>
<atom>
<_opr><rel>keep</rel></_opr>
<_1><var>person</var></_1>
<_2><var>object</var></_2>
</atom>
</and>
</_body>
</imp>]]></code>
</p>
<p>
<code><![CDATA[
T5: As an Arc-Labeled Tree (Special case of a Directed Arc-Labeled Graph):
imp---------------------------------
* *
head * body *
* *
atom------------------ and----------------------------------------
* * * * *
opr * 1 * 2 * 1 * 2 *
* * * * *
rel var var atom--------------------------- atom------------------
. . . * * * * * * *
. . . opr * 1 * 2 * 3 * opr * 1 * 2 *
. . . * * * * * * *
own person object rel var var var rel var var
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X5: As XML Markup with Roles for Every Embedded Type:
<imp>
<_head>
<atom>
<_opr><rel>own</rel></_opr>
<_1><var>person</var></_1>
<_2><var>object</var></_2>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<_1>
<atom>
<_opr><rel>buy</rel></_opr>
<_1><var>person</var></_1>
<_2><var>merchant</var></_2>
<_3><var>object</var></_3>
</atom>
</_1>
<_2>
<atom>
<_opr><rel>keep</rel></_opr>
<_1><var>person</var></_1>
<_2><var>object</var></_2>
</atom>
</_2>
</and>
</_body>
</imp>]]></code>
</p>
<p>
<code><![CDATA[
T6: As an Arc-Labeled Tree with Seq Nodes (RDF-like Sequence Containers):
imp-----------------------------------------
* *
head * body *
* *
atom--------------- and--------
* * *
opr * args * args *
* * *
rel Seq---------- Seq---------------
. * * * *
. 1 * 2 * 1 * 2 *
. * * * *
own var var atom atom
. .
. .
. . . . .
person object
X6: As XML Markup with Roles for Every Embedded Type including Seq Types:
<imp>
<_head>
<atom>
<_opr><rel>own</rel></_opr>
<_args>
<Seq>
<_1><var>person</var></_1>
<_2><var>object</var></_2>
</Seq>
</_args>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<_args>
<Seq>
<_1>
<atom>
<_opr><rel>buy</rel></_opr>
<_args>
<Seq>
<_1><var>person</var></_1>
<_2><var>merchant</var></_2>
<_3><var>object</var></_3>
</Seq>
</_args>
</atom>
</_1>
<_2>
<atom>
<_opr><rel>keep</rel></_opr>
<_args>
<Seq>
<_1><var>person</var></_1>
<_2><var>object</var></_2>
</Seq>
</_args>
</atom>
</_2>
</Seq>
</_args>
</and>
</_body>
</imp>]]></code>
</p>
<p>
A comparison of these six tree/markup versions shows the following:
<itemize>
<item>Version T1/X1 overspecifies the positions of rule heads and tails
and of atom oprs.
</item>
<item>Version T2/X2 still overspecifies the positions of atom oprs.
</item>
<item>Version T3/X3 has no overspecification or redundancy.
</item>
<item>Version T4/X4 uses redundant labels on atom arguments.
</item>
<item>Version T5/X5 uses additional redundant labels on and arguments.
</item>
<item>Version T6/X6 Seq-reifies the redundantly labeled arguments.
</item>
</itemize>
For RuleML 0.8 we thus chose Version T3/X3.
</p>
<p>
However, RuleML 0.8 also provides an n-tuple datatype in its
<a href="http://www.ruleml.org/dtd/0.8/ruleml-hornlog.dtd">http://www.ruleml.org/dtd/0.8/ruleml-hornlog.dtd</a>.
This tup type can be employed to reduce all atoms to binary "_opr"-"_1" element pairs,
where the original n arguments after opr become the
n elements of a single tup argument under an (implicit) _1 role. Similarly for nanos and cterms.
Such a 'tupping' of arguments may be used to confine positional types to n-tuples and other built-ins (e.g., 'and').
The Version T7/X7 below exemplifies.
</p>
<p>
<code><![CDATA[
T7: As an Order-Labeled Tree with tupped Arguments:
imp-----------------------------------------
* *
head * body *
* *
atom--------------- and----------------------------------------
* | | |
opr * | | |
* | | |
rel tup---------- atom atom
. | |
. | |
. | |
own var var
. .
. .
. . . . .
person object
X7: As XML Markup with tupped Arguments and Roles only for Non-Positional Types:
<imp>
<_head>
<atom>
<_opr><rel>own</rel></_opr>
<tup>
<var>person</var>
<var>object</var>
</tup>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<_opr><rel>buy</rel></_opr>
<tup>
<var>person</var>
<var>merchant</var>
<var>object</var>
</tup>
</atom>
<atom>
<_opr><rel>keep</rel></_opr>
<tup>
<var>person</var>
<var>object</var>
</tup>
</atom>
</and>
</_body>
</imp>]]></code>
</p>
</section>
<section>
<header>Abstraction</header>
<p>
For the above T3/X3 version constituting RuleML 0.8 we now exemplify the abstraction
achieved by regarding all commutative possibilities as equivalent.
In this 'abstract syntax' commutative tree variants will be graph-theoretically equivalent and
the corresponding commutative markup variants will be algebraically equivalent.
More precisely, for trees the branching order of the (explicitly labeled) "*" arcs
is immaterial and for markups
the following equation holds:
<tt><</tt><i>element</i><tt>></tt>. . .<tt><_</tt><i>role1</i><tt>></tt>...<tt></_</tt><i>role1</i><tt>></tt>. . .<tt><_</tt><i>role2</i><tt>></tt>...<tt></_</tt><i>role2</i><tt>></tt>. . .<tt></</tt><i>element</i><tt>></tt>
=
<tt><</tt><i>element</i><tt>></tt>. . .<tt><_</tt><i>role2</i><tt>></tt>...<tt></_</tt><i>role2</i><tt>></tt>. . .<tt><_</tt><i>role1</i><tt>></tt>...<tt></_</tt><i>role1</i><tt>></tt>. . .<tt></</tt><i>element</i><tt>></tt>.
Note that such an abstraction is also implicit in RDF graphs and serializations,
since both the triples within RDF models and the pairs within <tt>rdf:Description</tt>
can be permuted without information loss.
The following examples of the sixteen equivalent 'Commutations' of T3/X3 illustrate,
starting with our original T3/X3 version.
</p>
<p>
<code><![CDATA[
T3[1of16]: RuleML 0.8 Tree in the first of 16 Graph-theoretically Equivalent Commutations:
imp---------------------------------
* *
head * body *
* *
atom------------------ and----------------------------------------
* | | | |
opr * | | | |
* | | | |
rel var var atom--------------------------- atom------------------
. . . * | | | * | |
. . . opr * | | | opr * | |
. . . * | | | * | |
own person object rel var var var rel var var
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X3[1of16]: RuleML 0.8 Markup in the first of 16 Algebraically Equivalent Commutations:
<imp>
<_head>
<atom>
<_opr><rel>own</rel></_opr>
<var>person</var>
<var>object</var>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<_opr><rel>buy</rel></_opr>
<var>person</var>
<var>merchant</var>
<var>object</var>
</atom>
<atom>
<_opr><rel>keep</rel></_opr>
<var>person</var>
<var>object</var>
</atom>
</and>
</_body>
</imp>]]></code>
</p>
<p>
<code><![CDATA[
T3[2of16]: RuleML 0.8 Tree in the second of 16 Graph-theoretically Equivalent Commutations:
imp---------------------------------
* *
head * body *
* *
atom---------------- and----------------------------------------
| | * | |
| | * opr | |
| | * | |
var var rel atom--------------------------- atom------------------
. . . * | | | * | |
. . . opr * | | | opr * | |
. . . * | | | * | |
object person own rel var var var rel var var
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X3[2of16]: RuleML 0.8 Markup in the second of 16 Algebraically Equivalent Commutations:
<imp>
<_head>
<atom>
<var>person</var>
<var>object</var>
<_opr><rel>own</rel></_opr>
</atom>
</_head>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<_opr><rel>buy</rel></_opr>
<var>person</var>
<var>merchant</var>
<var>object</var>
</atom>
<atom>
<_opr><rel>keep</rel></_opr>
<var>person</var>
<var>object</var>
</atom>
</and>
</_body>
</imp>]]></code>
</p>
<p>
. . .
</p>
<p>
<code><![CDATA[
T3[9of16]: RuleML 0.8 Tree in the ninth of 16 Graph-theoretically Equivalent Commutations:
imp--------------------------------------------------------------------------
* *
body * head *
* *
and---------------------------------------- atom------------------
| | * | |
| | opr * | |
| | * | |
atom--------------------------- atom------------------ rel var var
* | | | * | | . . .
opr * | | | opr * | | . . .
* | | | * | | . . .
rel var var var rel var var own person object
. . . . . . .
. . . . . . .
. . . . . . .
buy person merchant object keep person object
X3[9of16]: RuleML 0.8 Markup in the ninth of 16 Algebraically Equivalent Commutations:
<imp>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<_opr><rel>buy</rel></_opr>
<var>person</var>
<var>merchant</var>
<var>object</var>
</atom>
<atom>
<_opr><rel>keep</rel></_opr>
<var>person</var>
<var>object</var>
</atom>
</and>
</_body>
<_head>
<atom>
<_opr><rel>own</rel></_opr>
<var>person</var>
<var>object</var>
</atom>
</_head>
</imp>]]></code>
</p>
<p>
. . .
</p>
<p>
<code><![CDATA[
T3[16of16]: RuleML 0.8 Tree in the sixteenth of 16 Graph-theoretically Equivalent Commutations:
imp--------------------------------------------------------------------------
* *
body * head *
* *
and---------------------------------------- atom----------------
| | | | *
| | | | * opr
| | | | *
atom--------------------------- atom------------------ var var rel
| | | * | | * . . .
| | | * opr | | * opr . . .
| | | * | | * . . .
var var var rel var var rel object person own
. . . . . . .
. . . . . . .
. . . . . . .
person merchant object buy person object keep
X3[16of16]: RuleML 0.8 Markup in the sixteenth of 16 Algebraically Equivalent Commutations:
<imp>
<_body>
<!-- explicit 'and' -->
<and>
<atom>
<var>person</var>
<var>merchant</var>
<var>object</var>
<_opr><rel>buy</rel></_opr>
</atom>
<atom>
<var>person</var>
<var>object</var>
<_opr><rel>keep</rel></_opr>
</atom>
</and>
</_body>
<_head>
<atom>
<var>person</var>
<var>object</var>
<_opr><rel>own</rel></_opr>
</atom>
</_head>
</imp>]]></code>
</p>
</section>
<section>
<header>Explanations</header>
<p>
Appended below is a preliminary DTD, designated version 0.8,
for a Datalog subset of RuleML (<a href="#Appendix 1">Appendix 1</a>). Also appended
below is a simple example rulebase that conforms to that DTD,
and instructions for how to validate the example against the
DTD.
</p>
<p>
There now also is a family of DTD's, specified in a modular
fashion (using parameter ENTITY declarations), also designated
vers. 0.8, at this URL: <a href="http://www.ruleml.org/dtd/0.8/">http://www.ruleml.org/dtd/0.8/</a> .
Note that this family of DTD's is, overall, more raw/immature than just
the Datalog member of that family. Note that the Datalog DTD on the
website is a bit more complex, a proper superset of, the one appended
below. The one below is called "monolith", because it has
stripped out the ENTITY interface declarations that are in the
website (non-"monolith") version.
</p>
<p>
To see the DTD's on the website:
After you clicked on the *.dtd files, you may have to select
View | Page Source. Thus, we provide additional *.dtd.txt links.
Downloading should work anyway.
</p>
<p>
You can try things out "monolithically", as explained in <a href="#Appendix 3">Appendix 3</a>,
using the own.ruleml example of <a href="#Appendix 2">Appendix 2</a> (the Warnings here
concern only stylistic matters).
</p>
<p>
You may also use the non-"monolith" modules to study XML's
"INCLUDE"/"IGNORE" overriding method for DTDs that are read in via
"ENTITY % ... SYSTEM *.dtd" declarations. But you can get the gist
of the definitions also when treating most of these house-keeping
directives as no-ops.
</p>
<p>
After some discussions, we found a set of tag names that sound
reasonable to us. Feedback is very welcome.
</p>
<p>
Facts now use an explicit, abbreviating "fact"
tag. Similarly, abbreviating tags will probably be needed for reaction rules and integrity constraints.
</p>
<p>
User comments on all levels are currently taken care of by XML;
look at the sample datalog document own.ruleml.
</p>
<p>
More sample files -- each referring to the most specific DTD still
validating them -- can be found at: <a href="http://www.ruleml.org/exa/0.8/">http://www.ruleml.org/exa/0.8/</a> .
See the instructions above (about View | Page Source, etc.) for
viewing the content etc.
</p>
</section>
<section>
<header>Issues</header>
<p>
Should the 'UR' attribute in inds etc. be renamed from (XHTML-like) 'href' to (our favorite) 'uref',
'ur', 'resource', or something else?
</p>
<p>
More issues are being collected by Said Tabet.