public class Diff extends Object
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 SOutgoingrelations,
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:
#OPTION_CHECK_ANNOTATION - When true, even all annotations of
nodes and relations are used for isomorphie check and difference computation.
#OPTION_CHECK_ANNOTATION_DIFF - ???#OPTION_CHECK_ID - When true identifiers needs to be the same in
isomorphie check and difference computation.| Modifier and Type | Field and Description |
|---|---|
static String |
OPTION_IGNORE_ANNOTATIONS
When true, differences in
SAnnotation have no influence on
isomorphie and will not produce any differences. |
static String |
OPTION_IGNORE_FEATURES
When true, differences in
SFeature have no influence on
isomorphie and will not produce any differences. |
static String |
OPTION_IGNORE_ID
When true, differences in id have no influence on isomorphie and will not
produce any differences.
|
static String |
OPTION_IGNORE_LAYER
When true, layers will not be checked when computing isomorphie and
differences.
|
static String |
OPTION_IGNORE_META_ANNOTATIONS
When true, differences in
SMetaAnnotation have no influence on
isomorphie and will not produce any differences. |
static String |
OPTION_IGNORE_NAME
When true, differences in name have no influence on isomorphie and will
not produce any differences.
|
static String |
OPTION_IGNORE_PROCESSING_ANNOTATIONS
When true, differences in
SProcessingAnnotation have no influence
on isomorphie and will not produce any differences. |
| Constructor and Description |
|---|
Diff(SDocumentGraph template,
SDocumentGraph other)
Initializes Diff object with the two graphs
template and
other. |
Diff(SDocumentGraph template,
SDocumentGraph other,
Map<String,Boolean> optionMap) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
compareAnnotationContainers(SAnnotationContainer template,
SAnnotationContainer other,
Set<Difference> subDiffs)
Checks whether two
SAnnotationContainer objects are isomorph and
returns true if this is the case, false otherwise. |
boolean |
compareIdentifiableElements(IdentifiableElement template,
IdentifiableElement other,
Set<Difference> subDiffs)
Checks whether two
IdentifiableElement objects are isomorph. |
boolean |
compareLayers(SDocumentGraph template,
SDocumentGraph other,
Boolean diff)
Compares all layers in template graph with all layers in other graph and
searches for isomorphic partners.
|
boolean |
compareRelations(SDocumentGraph template,
List<? extends SRelation> templateRels,
SDocumentGraph other,
List<? extends SRelation> otherRels,
Boolean diff)
Compares all
SPointingRelation of other and template graph. |
Set<Difference> |
findDiffs()
Compares the set graphs and returns if they are isomorphic or not.
|
com.google.common.collect.BiMap<SNode,SNode> |
getIsoNodes()
Return BiMap with isomorphic
SNodes key= template, value= other |
boolean |
isIsomorph()
Compares the set graphs and returns if they are isomorphic or not.
|
public static final String OPTION_IGNORE_FEATURES
SFeature have no influence on
isomorphie and will not produce any differences.public static final String OPTION_IGNORE_ANNOTATIONS
SAnnotation have no influence on
isomorphie and will not produce any differences.public static final String OPTION_IGNORE_META_ANNOTATIONS
SMetaAnnotation have no influence on
isomorphie and will not produce any differences.public static final String OPTION_IGNORE_PROCESSING_ANNOTATIONS
SProcessingAnnotation have no influence
on isomorphie and will not produce any differences.public static final String OPTION_IGNORE_ID
public static final String OPTION_IGNORE_NAME
public static final String OPTION_IGNORE_LAYER
public Diff(SDocumentGraph template, SDocumentGraph other)
template and
other.template - other - public Diff(SDocumentGraph template, SDocumentGraph other, Map<String,Boolean> optionMap)
public boolean isIsomorph()
findDiffs().public Set<Difference> findDiffs()
isIsomorph().public com.google.common.collect.BiMap<SNode,SNode> getIsoNodes()
SNodes key= template, value= otherSNodespublic boolean compareIdentifiableElements(IdentifiableElement template, IdentifiableElement other, Set<Difference> subDiffs)
IdentifiableElement objects are isomorph. If
option OPTION_IGNORE_ID is false, this method returns true, if
the id values of both are equal, false otherwise.If subdiffs is not null,
the differences will be added to that list, if that list is empty the
method returns false when the first difference was found.templateNode - otherNode - subDiffs - public boolean compareAnnotationContainers(SAnnotationContainer template, SAnnotationContainer other, Set<Difference> subDiffs)
SAnnotationContainer objects are isomorph and
returns true if this is the case, false otherwise. If subdiffs is not
null, the differences will be added to that list, if that list is empty
the method returns false when the first difference was found. OPTION_IGNORE_META_ANNOTATIONS,
OPTION_IGNORE_PROCESSING_ANNOTATIONS,
OPTION_IGNORE_ANNOTATIONS and OPTION_IGNORE_FEATUREStemplateNode - otherNode - subDiffs - if differences shall be computed, this list must not have to
be emptypublic boolean compareRelations(SDocumentGraph template, List<? extends SRelation> templateRels, SDocumentGraph other, List<? extends SRelation> otherRels, Boolean diff)
SPointingRelation of other and template graph.getDifferences() is computed. To
check the isomorphie there must be no differences.template - other - diff - public boolean compareLayers(SDocumentGraph template, SDocumentGraph other, Boolean diff)
getDifferences() is computed. To
check the isomorphie there must be no differences.template - other - diff - Copyright © 2009–2016 Humboldt-Universität zu Berlin, INRIA. All rights reserved.