Package de.unirostock.sems.bives.api
Class Diff
- java.lang.Object
-
- de.unirostock.sems.bives.api.Diff
-
- Direct Known Subclasses:
RegularDiff
public abstract class Diff extends Object
The Class Diff, the central object if it comes to the comparison of XML documents. All methods might return null if not available in a certain case.- Author:
- Martin Scharm
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
ALLOW_DIFFERENT_IDS
Are mappings of nodes with different ids allowed? At the first glimpse that might sound stupid, but ids are generally arbitrary and say nothing valuable about the entities.static boolean
CARE_ABOUT_NAMES
Do we care about names? Should we treat names differently? They often provide more information than other attributes.protected SimpleConnectionManager
connections
The connections.static boolean
STRICTER_NAMES
Should we handle names very strictly? Go for this option if you're sure that you're names are very similar.protected de.unirostock.sems.xmlutils.ds.TreeDocument
treeA
The tree corresponding to the former version.protected de.unirostock.sems.xmlutils.ds.TreeDocument
treeB
The tree corresponding to the later version.
-
Constructor Summary
Constructors Constructor Description Diff(de.unirostock.sems.xmlutils.ds.TreeDocument treeA, de.unirostock.sems.xmlutils.ds.TreeDocument treeB)
Instantiates a new diff object in order to compare two tree documents.Diff(de.unirostock.sems.xmlutils.ds.TreeDocument treeA, de.unirostock.sems.xmlutils.ds.TreeDocument treeB, DiffAnnotator diffAnnotator)
Instantiates a new diff object in order to compare two tree documents.Diff(File fileA, File fileB)
Instantiates a new diff object in order to compare two documents stored in files fileA and fileB.Diff(File fileA, File fileB, DiffAnnotator diffAnnotator)
Instantiates a new diff object in order to compare two documents stored in files fileA and fileB.Diff(String docA, String docB)
Instantiates a new diff object in order to compare two documents stored in strings docA and docB.Diff(String docA, String docB, DiffAnnotator diffAnnotator)
Instantiates a new diff object in order to compare two documents stored in strings docA and docB.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getCRNDotGraph()
Deprecated.As of 1.3.3 replaced bygetReactionsDotGraph()
Object
getCRNGraph(GraphTranslator gt)
Deprecated.As of 1.3.3 replaced bygetReactionsGraph(de.unirostock.sems.bives.ds.graph.GraphTranslator)
String
getCRNGraphML()
Deprecated.As of 1.3.3 replaced bygetReactionsGraphML()
String
getCRNJsonGraph()
Deprecated.As of 1.3.3 replaced bygetReactionsJsonGraph()
String
getDiff()
Gets the diff as a string, encoded in XML.String
getDiff(boolean inclAnnotations)
Gets the differences encoded in an XML stringabstract String
getHierarchyDotGraph()
Returns the component's hierarchy graph encoded in DOT language.abstract Object
getHierarchyGraph(GraphTranslator gt)
Returns the component's hierarchy graph providing an own graph translator.abstract String
getHierarchyGraphML()
Returns the component's hierarchy graph encoded in GraphML.abstract String
getHierarchyJsonGraph()
Returns the component's hierarchy graph encoded in JSON.abstract String
getHTMLReport()
Returns the report encoded in HTML.abstract String
getMarkDownReport()
Returns the report encoded MarkDown.Patch
getPatch()
Gets the patch object.abstract String
getReactionsDotGraph()
Returns the graph of the reaction network encoded in DOT language.abstract Object
getReactionsGraph(GraphTranslator gt)
Returns the graph of the reaction network providing an own graph translator.abstract String
getReactionsGraphML()
Returns the graph of the reaction network encoded in GraphML.abstract String
getReactionsJsonGraph()
Returns the graph of the reaction network encoded in JSON.abstract String
getReactionsSbgnJsonGraph()
Returns the graph of the reaction network encoded in an SBGN-JSON format.abstract String
getReport(Typesetting ts)
Returns the report providing an on markup processor.abstract String
getReStructuredTextReport()
Returns the report encoded in ReStructured text.boolean
mapTrees()
Map both trees.abstract boolean
mapTrees(boolean allowDifferentIds, boolean careAboutNames, boolean stricterNames)
Map both trees.
-
-
-
Field Detail
-
ALLOW_DIFFERENT_IDS
public static final boolean ALLOW_DIFFERENT_IDS
Are mappings of nodes with different ids allowed? At the first glimpse that might sound stupid, but ids are generally arbitrary and say nothing valuable about the entities. they just need to be unique.. Look at the following two species:<species id="s1" name="glucose" initial_concentration="0.1" compartment="cell" initialAmount="1" hasOnlySubstanceUnits="true" boundaryCondition="true" /> <species id="species1" name="glucose" initial_concentration="0.1" compartment="cell" initialAmount="1" hasOnlySubstanceUnits="true" boundaryCondition="true" />
The id attribute might just be assigned by two different tools, everything else is the same. Should we map these entities? By default this istrue
.- See Also:
DocumentNode.getAttributeDistance(DocumentNode, boolean, boolean, boolean)
, Constant Field Values
-
CARE_ABOUT_NAMES
public static final boolean CARE_ABOUT_NAMES
Do we care about names? Should we treat names differently? They often provide more information than other attributes.- See Also:
DocumentNode.getAttributeDistance(DocumentNode, boolean, boolean, boolean)
, Constant Field Values
-
STRICTER_NAMES
public static final boolean STRICTER_NAMES
Should we handle names very strictly? Go for this option if you're sure that you're names are very similar.- See Also:
DocumentNode.getAttributeDistance(DocumentNode, boolean, boolean, boolean)
, Constant Field Values
-
treeA
protected de.unirostock.sems.xmlutils.ds.TreeDocument treeA
The tree corresponding to the former version.
-
treeB
protected de.unirostock.sems.xmlutils.ds.TreeDocument treeB
The tree corresponding to the later version.
-
connections
protected SimpleConnectionManager connections
The connections.
-
-
Constructor Detail
-
Diff
public Diff(File fileA, File fileB) throws de.unirostock.sems.xmlutils.exception.XmlDocumentParseException, IOException, org.jdom2.JDOMException
Instantiates a new diff object in order to compare two documents stored in files fileA and fileB.- Parameters:
fileA
- the file containing the former versionfileB
- the file containing the later version- Throws:
de.unirostock.sems.xmlutils.exception.XmlDocumentParseException
- the xml document parse exceptionIOException
- Signals that an I/O exception has occurred.org.jdom2.JDOMException
- the jDOM exception
-
Diff
public Diff(String docA, String docB) throws de.unirostock.sems.xmlutils.exception.XmlDocumentParseException, IOException, org.jdom2.JDOMException
Instantiates a new diff object in order to compare two documents stored in strings docA and docB.- Parameters:
docA
- the former versiondocB
- the later version- Throws:
de.unirostock.sems.xmlutils.exception.XmlDocumentParseException
- the xml document parse exceptionIOException
- Signals that an I/O exception has occurred.org.jdom2.JDOMException
- the jDOM exception
-
Diff
public Diff(de.unirostock.sems.xmlutils.ds.TreeDocument treeA, de.unirostock.sems.xmlutils.ds.TreeDocument treeB)
Instantiates a new diff object in order to compare two tree documents.- Parameters:
treeA
- the former version of the treetreeB
- the later version of the tree
-
Diff
public Diff(File fileA, File fileB, DiffAnnotator diffAnnotator) throws de.unirostock.sems.xmlutils.exception.XmlDocumentParseException, IOException, org.jdom2.JDOMException
Instantiates a new diff object in order to compare two documents stored in files fileA and fileB.- Parameters:
fileA
- the file containing the former versionfileB
- the file containing the later versiondiffAnnotator
- the annotator for identified changes- Throws:
de.unirostock.sems.xmlutils.exception.XmlDocumentParseException
- the xml document parse exceptionIOException
- Signals that an I/O exception has occurred.org.jdom2.JDOMException
- the jDOM exception
-
Diff
public Diff(String docA, String docB, DiffAnnotator diffAnnotator) throws de.unirostock.sems.xmlutils.exception.XmlDocumentParseException, IOException, org.jdom2.JDOMException
Instantiates a new diff object in order to compare two documents stored in strings docA and docB.- Parameters:
docA
- the former versiondocB
- the later versiondiffAnnotator
- the annotator for identified changes- Throws:
de.unirostock.sems.xmlutils.exception.XmlDocumentParseException
- the xml document parse exceptionIOException
- Signals that an I/O exception has occurred.org.jdom2.JDOMException
- the jDOM exception
-
Diff
public Diff(de.unirostock.sems.xmlutils.ds.TreeDocument treeA, de.unirostock.sems.xmlutils.ds.TreeDocument treeB, DiffAnnotator diffAnnotator)
Instantiates a new diff object in order to compare two tree documents.- Parameters:
treeA
- the former version of the treetreeB
- the later version of the treediffAnnotator
- the annotator for identified changes
-
-
Method Detail
-
getDiff
public String getDiff()
Gets the diff as a string, encoded in XML.- Returns:
- the diff
-
getDiff
public String getDiff(boolean inclAnnotations)
Gets the differences encoded in an XML string- Parameters:
inclAnnotations
- include annotations in the XML patch- Returns:
- the diff
-
getPatch
public Patch getPatch()
Gets the patch object.- Returns:
- the patch
-
mapTrees
public abstract boolean mapTrees(boolean allowDifferentIds, boolean careAboutNames, boolean stricterNames) throws Exception
Map both trees. This method let's you decide whether- mapped entities may have different ids,
- we specially treat name attributes,
- we handle names very strictly.
ALLOW_DIFFERENT_IDS
,CARE_ABOUT_NAMES
, andSTRICTER_NAMES
.- Parameters:
allowDifferentIds
- are mapped entities allowed to have different ids?careAboutNames
- should we care about names?stricterNames
- should we handle names very strictly?- Returns:
- true, if successful mapped
- Throws:
Exception
- the exception
-
mapTrees
public boolean mapTrees() throws Exception
Map both trees. This method by default allows different ids, better cares about names (that means, different names are worse than different concentrations) but doesn't handle the names too strict. CompareDocumentNode.getAttributeDistance(DocumentNode, boolean, boolean, boolean)
.- Returns:
- true, if successful
- Throws:
Exception
- the exception
-
getCRNGraph
@Deprecated public Object getCRNGraph(GraphTranslator gt) throws Exception
Deprecated.As of 1.3.3 replaced bygetReactionsGraph(de.unirostock.sems.bives.ds.graph.GraphTranslator)
Returns the graph of the chemical reaction network providing an own graph translator. Might return null if not available.- Parameters:
gt
- the graph translator- Returns:
- the chemical reaction network or null if not available
- Throws:
Exception
- the exception
-
getReactionsGraph
public abstract Object getReactionsGraph(GraphTranslator gt) throws Exception
Returns the graph of the reaction network providing an own graph translator. Might return null if not available.- Parameters:
gt
- the graph translator- Returns:
- the reaction network or null if not available
- Throws:
Exception
- the exception
-
getHierarchyGraph
public abstract Object getHierarchyGraph(GraphTranslator gt) throws Exception
Returns the component's hierarchy graph providing an own graph translator. Might return null if not available.- Parameters:
gt
- the graph translator- Returns:
- the hierarchy graph or null if not available
- Throws:
Exception
- the exception
-
getCRNGraphML
@Deprecated public String getCRNGraphML() throws Exception
Deprecated.As of 1.3.3 replaced bygetReactionsGraphML()
Returns the graph of the chemical reaction network encoded in GraphML. Might return null if not available.- Returns:
- the chemical reaction network or null if not available
- Throws:
Exception
- the exception
-
getReactionsGraphML
public abstract String getReactionsGraphML() throws Exception
Returns the graph of the reaction network encoded in GraphML. Might return null if not available.- Returns:
- the reaction network or null if not available
- Throws:
Exception
- the exception
-
getHierarchyGraphML
public abstract String getHierarchyGraphML() throws Exception
Returns the component's hierarchy graph encoded in GraphML. Might return null if not available.- Returns:
- the hierarchy graph or null if not available
- Throws:
Exception
- the exception
-
getCRNDotGraph
@Deprecated public String getCRNDotGraph() throws Exception
Deprecated.As of 1.3.3 replaced bygetReactionsDotGraph()
Returns the graph of the chemical reaction network encoded in DOT language. Might return null if not available.- Returns:
- the chemical reaction network or null if not available
- Throws:
Exception
- the exception
-
getReactionsDotGraph
public abstract String getReactionsDotGraph() throws Exception
Returns the graph of the reaction network encoded in DOT language. Might return null if not available.- Returns:
- the reaction network or null if not available
- Throws:
Exception
- the exception
-
getHierarchyDotGraph
public abstract String getHierarchyDotGraph() throws Exception
Returns the component's hierarchy graph encoded in DOT language. Might return null if not available.- Returns:
- the hierarchy graph or null if not available
- Throws:
Exception
- the exception
-
getCRNJsonGraph
@Deprecated public String getCRNJsonGraph() throws Exception
Deprecated.As of 1.3.3 replaced bygetReactionsJsonGraph()
Returns the graph of the chemical reaction network encoded in JSON. Might return null if not available.- Returns:
- the chemical reaction network or null if not available
- Throws:
Exception
- the exception
-
getReactionsJsonGraph
public abstract String getReactionsJsonGraph() throws Exception
Returns the graph of the reaction network encoded in JSON. Might return null if not available.- Returns:
- the reaction network or null if not available
- Throws:
Exception
- the exception
-
getHierarchyJsonGraph
public abstract String getHierarchyJsonGraph() throws Exception
Returns the component's hierarchy graph encoded in JSON. Might return null if not available.- Returns:
- the hierarchy graph or null if not available
- Throws:
Exception
- the exception
-
getReactionsSbgnJsonGraph
public abstract String getReactionsSbgnJsonGraph() throws Exception
Returns the graph of the reaction network encoded in an SBGN-JSON format. Might return null if not available.- Returns:
- the reaction network or null if not available
- Throws:
Exception
- the exception
-
getReport
public abstract String getReport(Typesetting ts) throws Exception
Returns the report providing an on markup processor. Might return null if not available.- Parameters:
ts
- the ts- Returns:
- the report or null if not available
- Throws:
Exception
- the exception
-
getHTMLReport
public abstract String getHTMLReport() throws Exception
Returns the report encoded in HTML. Might return null if not available.- Returns:
- the hTML report or null if not available
- Throws:
Exception
- the exception
-
getMarkDownReport
public abstract String getMarkDownReport() throws Exception
Returns the report encoded MarkDown. Might return null if not available.- Returns:
- the mark down report or null if not available
- Throws:
Exception
- the exception
-
-