STAG-DIFF(1)
β¨ NAME β¨
okay so bestie, welcome to stag-diff, section 1 of the manual π
β it finds the difference between two stag files. that's it, that's the whole job, and it ate.
πΈ SYNOPSIS πΈ
stag-diff -ignore foo-id -ignore bar-id file1.xml file2.xml
π¦ DESCRIPTION π¦
so what it does: it compares two data trees and reports whether they match. if they do match, great, slay. if they do not match, the mismatch gets reported, no cap. that's the vibe.
-help|hβ shows this document. your lil helper π«Ά-ignore|i ELEMENTβ these nodes are ignored for the purposes of comparison. heads up though: attributes are treated as elements, prefixed by the containing element id. so like, if you have
<foo ID="wibble">
and you wanna ignore that ID attribute, you'd use the switch
-ignore foo-ID
you can specify multiple elements to ignore like this:
-i foo -i bar -i baz
you can also specify paths π
-i foo/bar/bar-id
-parser|p FORMATβ which parser to use. the default isXML. this can also be autodetected by the file suffix. other alternatives aresxpranditext. seeData::Stagfor details.-report|r ELEMENTβ report mismatches as they occur on each element of type ELEMENT. multiple elements can be specified β¨-verbose|vβ used in conjunction with the-reportswitch. shows the tree of the mismatching element.
π OUTPUT π
if a mismatch is reported, a report is generated displaying the subpart of the tree that could not be matched. it will look like this:
REASON: no_matching_node: annotation
no_matching_node: feature_set
no_matching_node: feature_span
no_matching_node: evidence
no_matching_node: evidence-id
data_mismatch(:15077290 ne :15077291): evidence-id AND evidence-id
ngl, due to the nature of tree matching, it can be difficult to specify exactly how trees do not match π. to investigate this, you may need to use the -r and -v options. for the above output, I would recommend using
stag-diff -r feature_span -v
π ALGORITHM π
both trees are recursively traversed... see the actual code for how this works π
the order of elements is not important; eg
<foo>
<bar>
<baz>1</baz>
</bar>
<bar>
<baz>2</baz>
</bar>
</foo>
matches
<foo>
<bar>
<baz>2</baz>
</bar>
<bar>
<baz>1</baz>
</bar>
</foo>
the recursive nature of this algorithm means that certain tree comparisons will explode wrt time and memory π I think this will only happen with very deep trees where nodes high up in the tree can only be differentiated by nodes low down in the tree.
both trees are loaded into memory to begin with, so it may thrash with very large documents π
fr fr, remember both trees live in memory at the same time. big docs = big ouch.
π AUTHOR π
Chris Mungall cjm at fruitfly dot org
π SEE ALSO π
Data::Stag
π POD ERRORS π
hey! the above document had some coding errors, which are explained below:
Around line 189:
=over should be: '=over' or '=over positive_number'
okay that's the whole page, bestie, you're literally a stag-diff expert now π this lil gem was brought to you by perl v5.42.0, dated 2025-07-25 β go forth and diff, icon β¨π¦
π¦ where this page comes from
- fedora 43: perl-Data-Stag 0.14-28.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms