Salt  3.4.2
A powerful, tagset-independent and theory-neutral meta model and API for storing, manipulating, and representing nearly all types of linguistic data .
org.corpus_tools.salt.util.internal.Diff Class Reference

This class compares two SDocumentGraph objects for isomorphie. More...

Classes

class  Builder
 A fluent builder for comparing two SDocumentGraph or SCorpusGraph objects.
 

Public Member Functions

 Diff (SDocumentGraph template, SDocumentGraph other)
 Initializes Diff object with the two graphs template and other. More...
 
 Diff (SDocumentGraph template, SDocumentGraph other, DiffOptions optionMap)
 
 Diff (SDocumentGraph template, SDocumentGraph other, Map< String, Boolean > optionMap)
 
 Diff (SCorpusGraph template, SCorpusGraph other)
 Initializes Diff object with the two graphs template and other. More...
 
 Diff (SCorpusGraph template, SCorpusGraph other, DiffOptions optionMap)
 
 Diff (SaltProject template, SaltProject other, DiffOptions optionMap)
 
 Diff (SCorpusGraph template, SCorpusGraph other, Map< String, Boolean > optionMap)
 
boolean isIsomorph ()
 Compares the set graphs and returns if they are isomorphic or not. More...
 
Set< DifferencefindDiffs ()
 Compares the set graphs and returns if they are isomorphic or not. More...
 

Detailed Description

This class compares two SDocumentGraph objects for isomorphie.

It uses characteristics of document graphs to use a more specific algorithm for checking whether a graph is isomorphic. At first tokens are compared. Both graphs are compared starting with offset "0". Two tokens are the same, when their textual offset and the overlapped text is the same. As with all following SNodes, SAnnotations and SFeatures are checked. The next step is to look for SNodes that are the source of a incoming relations of a SToken. Of these only those are picked, that have SNodes on their outgoing relations, that already have been checked (at this point: only STokens). These SNodes are then compared with each other. Whenever a relation is used in the way described above, the SRelation is checked for SFeatures and SRelations.

To adapt the isomorphie check and the computation of differences you can pass an option map via Diff(SDocumentGraph, SDocumentGraph, Map). Possible options are:

Author
florian
André Röhrig

Constructor & Destructor Documentation

◆ Diff() [1/4]

org.corpus_tools.salt.util.internal.Diff.Diff ( SDocumentGraph  template,
SDocumentGraph  other 
)

Initializes Diff object with the two graphs template and other.

Parameters
template
other

◆ Diff() [2/4]

org.corpus_tools.salt.util.internal.Diff.Diff ( SDocumentGraph  template,
SDocumentGraph  other,
Map< String, Boolean >  optionMap 
)
Parameters
template
other
optionMap

◆ Diff() [3/4]

org.corpus_tools.salt.util.internal.Diff.Diff ( SCorpusGraph  template,
SCorpusGraph  other 
)

Initializes Diff object with the two graphs template and other.

Parameters
template
other

◆ Diff() [4/4]

org.corpus_tools.salt.util.internal.Diff.Diff ( SCorpusGraph  template,
SCorpusGraph  other,
Map< String, Boolean >  optionMap 
)
Parameters
template
other
optionMap

Member Function Documentation

◆ findDiffs()

Set<Difference> org.corpus_tools.salt.util.internal.Diff.findDiffs ( )

Compares the set graphs and returns if they are isomorphic or not.

If graphs are not isomporphic, this method finds and records all differences and lists them. This means the entire graphs have to be compared and could slow down the computation. If you are only interested in the result and not in the particular differences, use method isIsomorph().

Returns
true, if graphs are isomorphic, false otherwise.

◆ isIsomorph()

boolean org.corpus_tools.salt.util.internal.Diff.isIsomorph ( )

Compares the set graphs and returns if they are isomorphic or not.

In case of the graphs are not isomorphic, this method does not record all differences. TO speed up the computation. it just detects the first difference and returns false. To get a full list of all differences, use method findDiffs().

Returns
true, if graphs are isomorphic, false otherwise.