1STAG-DIFF(1) User Contributed Perl Documentation STAG-DIFF(1)
2
3
4
6 stag-diff.pl - finds the difference between two stag files
7
9 stag-diff.pl -ignore foo-id -ignore bar-id file1.xml file2.xml
10
12 Compares two data trees and reports whether they match. If they do not
13 match, the mismatch is reported.
14
15 -help⎪h
16 shows this document
17
18 -ignore⎪i ELEMENT
19 these nodes are ignored for the purposes of comparison. Note that
20 attributes are treated as elements, prefixed by the containing ele‐
21 ment id. For example, if you have
22
23 <foo ID="wibble">
24
25 And you wish to ignore the ID attribute, then you would use the
26 switch
27
28 -ignore foo-ID
29
30 You can specify multiple elements to ignore like this
31
32 -i foo -i bar -i baz
33
34 You can also specify paths
35
36 -i foo/bar/bar-id
37
38 -parser⎪p FORMAT
39 which parser to use. The default is XML. This can also be autode‐
40 tected by the file suffix. Other alternatives are sxpr and itext.
41 See Data::Stag for details.
42
43 -report⎪r ELEMENT
44 report mismatches as they occur on each element of type ELEMENT
45
46 multiple elements can be specified
47
48 -verbose⎪v
49 used in conjunction with the -report switch
50
51 shows the tree of the mismatching element
52
53 OUTPUT
54
55 If a mismatch is reported, a report is generated displaying the subpart
56 of the tree that could not be matched. This will look like this:
57
58 REASON: no_matching_node: annotation
59 no_matching_node: feature_set
60 no_matching_node: feature_span
61 no_matching_node: evidence
62 no_matching_node: evidence-id
63 data_mismatch(:15077290 ne :15077291): evidence-id AND evi‐
64 dence-id
65
66 Due to the nature of tree matching, it can be difficult to specify
67 exactly how trees do not match. To investigate this, you may need to
68 use the -r and -v options. For the above output, I would recommend
69 using
70
71 stag-diff.pl -r feature_span -v
72
73 ALGORITHM
74
75 Both trees are recursively traversed... see the actual code for how
76 this works
77
78 The order of elements is not important; eg
79
80 <foo>
81 <bar>
82 <baz>1</baz>
83 </bar>
84 <bar>
85 <baz>2</baz>
86 </bar>
87 </foo>
88
89 matches
90
91 <foo>
92 <bar>
93 <baz>2</baz>
94 </bar>
95 <bar>
96 <baz>1</baz>
97 </bar>
98 </foo>
99
100 The recursive nature of this algorithm means that certain tree compar‐
101 isons will explode wrt time and memory. I think this will only happen
102 with very deep trees where nodes high up in the tree can only be dif‐
103 ferentiated by nodes low down in the tree.
104
105 Both trees are loaded into memory to begin with, so it may thrash with
106 very large documents
107
108 AUTHOR
109
110 Chris Mungall cjm at fruitfly dot org
111
113 Data::Stag
114
115
116
117perl v5.8.8 2004-02-02 STAG-DIFF(1)