1STAG-DIFF(1)          User Contributed Perl Documentation         STAG-DIFF(1)
2
3
4

NAME

6       stag-diff - finds the difference between two stag files
7

SYNOPSIS

9         stag-diff -ignore foo-id -ignore bar-id file1.xml file2.xml
10

DESCRIPTION

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
21           element 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
40           autodetected by the file suffix. Other alternatives are sxpr and
41           itext. 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       If a mismatch is reported, a report is generated displaying the subpart
55       of the tree that could not be matched. This will look like this:
56
57       REASON: no_matching_node: annotation
58         no_matching_node: feature_set
59           no_matching_node: feature_span
60             no_matching_node: evidence
61               no_matching_node: evidence-id
62                 data_mismatch(:15077290 ne :15077291): evidence-id AND
63       evidence-id
64
65       Due to the nature of tree matching, it can be difficult to specify
66       exactly how trees do not match. To investigate this, you may need to
67       use the -r and -v options. For the above output, I would recommend
68       using
69
70         stag-diff -r feature_span -v
71
72   ALGORITHM
73       Both trees are recursively traversed... see the actual code for how
74       this works
75
76       The order of elements is not important; eg
77
78         <foo>
79           <bar>
80             <baz>1</baz>
81           </bar>
82           <bar>
83             <baz>2</baz>
84           </bar>
85         </foo>
86
87       matches
88
89         <foo>
90           <bar>
91             <baz>2</baz>
92           </bar>
93           <bar>
94             <baz>1</baz>
95           </bar>
96         </foo>
97
98       The recursive nature of this algorithm means that certain tree
99       comparisons will explode wrt time and memory. I think this will only
100       happen with very deep trees where nodes high up in the tree can only be
101       differentiated by nodes low down in the tree.
102
103       Both trees are loaded into memory to begin with, so it may thrash with
104       very large documents
105
106   AUTHOR
107       Chris Mungall cjm at fruitfly dot org
108

SEE ALSO

110       Data::Stag
111

POD ERRORS

113       Hey! The above document had some coding errors, which are explained
114       below:
115
116       Around line 189:
117           =over should be: '=over' or '=over positive_number'
118
119
120
121perl v5.30.1                      2020-01-29                      STAG-DIFF(1)
Impressum