Class Correspondence
java.lang.Object
de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.Correspondence
- All Implemented Interfaces:
Comparable<Correspondence>
A Correspondence contains a relation that holds between two elements from two different ontologies.
This is also known as "Mapping Cell" or "Cell".
It is uniquely identified by entityOne, entityTwo and relation.
- Author:
- Sven Hertling, Jan Portisch
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
static final com.googlecode.cqengine.attribute.Attribute<Correspondence,
Double> private static final Pattern
protected String
protected String
private static final Pattern
protected String
private static final org.slf4j.Logger
protected CorrespondenceRelation
static final com.googlecode.cqengine.attribute.Attribute<Correspondence,
CorrespondenceRelation> static final com.googlecode.cqengine.attribute.Attribute<Correspondence,
String> static final com.googlecode.cqengine.attribute.Attribute<Correspondence,
String> -
Constructor Summary
ConstructorDescriptionConstructor for empty correspondence initialization byAlignmentParser
.Correspondence
(Correspondence other) Copy constructor for correspondences.Correspondence
(String entityOne, String entityTwo) Constructor The relation that holds between the two entities is assumed to beCorrespondenceRelation.EQUIVALENCE
.Correspondence
(String entityOne, String entityTwo, double confidence) Constructor The relation that holds between the two entities is assumed to beCorrespondenceRelation.EQUIVALENCE
.Correspondence
(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation) Constructor The identifier is set to null by default.Correspondence
(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Object... extensions) Constructor The identifier is set to null by default.Correspondence
(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions) Constructor The identifier is set to null by default.Correspondence
(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions, String identifier) ConstructorCorrespondence
(String entityOne, String entityTwo, double confidence, Object... extensions) Constructor The identifier is set to null by default.Correspondence
(String entityOne, String entityTwo, CorrespondenceRelation relation) Constructor The identifier is set to null by default. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdditionalConfidence
(Class<?> matcherClass, double confidence) Adds an additional confidence based on a specific class.void
addAdditionalConfidence
(String key, double confidence) Adds an additional confidence associated with any specific string value.void
addAdditionalConfidenceIfHigher
(Class<?> matcherClass, double confidence) Adds an additional confidence based on a specific class only if the confidence is higher.void
addAdditionalConfidenceIfHigher
(String key, double confidence) Adds an additional confidence associated with any specific string value only if the confidence is higher.void
addAdditionalExplanation
(Class<?> matcherClass, String explanation) Adds an additional explanationvoid
addAdditionalExplanation
(String key, String explanation) Adds an additional explanationvoid
addExtensionValue
(Object extensionUri, Object extensionValue) Set the value for an extension.void
addExtensionValue
(String extensionUri, Object extensionValue) Set the value for an extension.int
compareTo
(Correspondence that) static Comparator<Correspondence>
boolean
getAdditionalConfidence
(Class<?> matcherClass) Get a confidence given the name of the matcher.Returns the additional confidence based on the key (which is used in addAdditionalConfidence).double
getAdditionalConfidenceOrDefault
(String key, double defaultValue) Returns all added confidences (but not all extension values).static String
Returns the full URL for an additional confidence.getAdditionalExplanation
(Class<?> matcherClass) static String
Returns the full URL for an additional explanation.double
getExtensionValue
(String extensionUri) Obtain the value of an extension.getExtensionValueAsString
(String extensionUri) Obtain the value of an extension as string.<T> T
getExtensionValueCasted
(Object extensionUri) Obtain the value of an extension.<T> T
getExtensionValueCasted
(String extensionUri) Obtain the value of an extension.int
hashCode()
parseExtensions
(Object[] arr) void
Clears the extension of this correspondence.void
removeExtensions
(Iterable<String> blacklist) Remove all extensions which appear in blacklist.void
removeExtensionsNotIn
(Set<String> whitelist) Removes all extensions, but keep the extensions with keys appearing in whitelist.reverse()
This method returns a NEW correspondence with a reversed relation.This method returns a NEW correspondence where the source and target are reversed but not the relation.void
setConfidence
(double confidence) void
setEntityOne
(String entityOne) void
setEntityTwo
(String entityTwo) void
setIdentifier
(String identifier) void
setRelation
(CorrespondenceRelation relation) toString()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
entityOne
-
entityTwo
-
confidence
protected double confidence -
relation
-
identifier
-
extensions
-
CONFIDENCE_KEY_PATTERN
-
EXPLANATION_KEY_PATTERN
-
SOURCE
-
TARGET
-
RELATION
public static final com.googlecode.cqengine.attribute.Attribute<Correspondence,CorrespondenceRelation> RELATION -
CONFIDENCE
-
-
Constructor Details
-
Correspondence
public Correspondence(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions, String identifier) Constructor- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.confidence
- The confidence of the mapping.relation
- The relation that holds between the two entities.identifier
- The unique identifier for the mapping.extensions
- extensions in the form of a map
-
Correspondence
public Correspondence(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Object... extensions) Constructor The identifier is set to null by default.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.confidence
- The confidence of the mapping.relation
- The relation that holds between the two entities.extensions
- extensions in key1, value1, key2, value2, ... format
-
Correspondence
public Correspondence(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions) Constructor The identifier is set to null by default.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.confidence
- The confidence of the mapping.relation
- The relation that holds between the two entities.extensions
- extensions as a map of key to value (both strings)
-
Correspondence
Constructor The identifier is set to null by default.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.confidence
- The confidence of the mapping.extensions
- extensions in key1, value1, key2, value2, ... format
-
Correspondence
public Correspondence(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation) Constructor The identifier is set to null by default.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.confidence
- The confidence of the mapping.relation
- The relation that holds between the two entities.
-
Correspondence
Constructor The relation that holds between the two entities is assumed to beCorrespondenceRelation.EQUIVALENCE
. The identifier is set to null by default.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.confidence
- The confidence of the mapping.
-
Correspondence
Constructor The identifier is set to null by default. The confidence is assumed to be 1.0.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.relation
- The relation that holds between the two entities.
-
Correspondence
Constructor The relation that holds between the two entities is assumed to beCorrespondenceRelation.EQUIVALENCE
. The identifier is set to null by default. The confidence is assumed to be 1.0.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.
-
Correspondence
Correspondence()Constructor for empty correspondence initialization byAlignmentParser
. -
Correspondence
Copy constructor for correspondences. Important: Copies the extensions only shallow. This menas the objetc values of the hashmap are shared (pointing to the same object).- Parameters:
other
- the other correspondence
-
-
Method Details
-
parseExtensions
-
reverseWithoutRelationChange
This method returns a NEW correspondence where the source and target are reversed but not the relation.- Returns:
- New reversed correspondence.
-
reverse
This method returns a NEW correspondence with a reversed relation. For exampleCorrespondenceRelation.SUBSUME
will be reversed toCorrespondenceRelation.SUBSUMED
. If only the source and target should be reversed, usereverseWithoutRelationChange()
method.- Returns:
- New reversed correspondence.
-
getExtensionValue
Obtain the value of an extension.- Parameters:
extensionUri
- The URI identifying the extension.- Returns:
- The value of the extension as String, null if there is no value.
-
getExtensionValueAsString
Obtain the value of an extension as string.- Parameters:
extensionUri
- The URI identifying the extension.- Returns:
- The value of the extension as String, null if there is no value.
-
getExtensionValueCasted
Obtain the value of an extension.- Type Parameters:
T
- Extension value type.- Parameters:
extensionUri
- The URI identifying the extension.- Returns:
- The value of the extension as String, null if there is no value.
-
getExtensionValueCasted
Obtain the value of an extension.- Type Parameters:
T
- Extension value type.- Parameters:
extensionUri
- The URI identifying the extension.- Returns:
- The value of the extension as String, null if there is no value.
-
addExtensionValue
Set the value for an extension. Possible keys are defined in classDefaultExtensions
.- Parameters:
extensionUri
- The URI identifying the extension. Possible keys are defined in classDefaultExtensions
.extensionValue
- The value of the extension to be set.
-
addExtensionValue
Set the value for an extension. Possible keys are defined in classDefaultExtensions
.- Parameters:
extensionUri
- The URI identifying the extension. Possible keys are defined in classDefaultExtensions
.extensionValue
- The value of the extension to be set.
-
addAdditionalConfidence
Adds an additional confidence based on a specific class.- Parameters:
matcherClass
- the class of the matcherconfidence
- the additional confidence
-
addAdditionalConfidence
Adds an additional confidence associated with any specific string value. This should be used if one class puts multiple confidence values.- Parameters:
key
- the key which should be associated with the confidenceconfidence
- the additional confidence
-
addAdditionalConfidenceIfHigher
Adds an additional confidence associated with any specific string value only if the confidence is higher. This should be used if one class puts multiple confidence values.- Parameters:
key
- the key which should be associated with the confidenceconfidence
- the additional confidence
-
addAdditionalConfidenceIfHigher
Adds an additional confidence based on a specific class only if the confidence is higher.- Parameters:
matcherClass
- the class of the matcherconfidence
- the additional confidence
-
getAdditionalConfidence
Get a confidence given the name of the matcher.- Parameters:
matcherClass
- Class of the matcher.- Returns:
- The confidence if found.
-
getAdditionalConfidence
Returns the additional confidence based on the key (which is used in addAdditionalConfidence). The key is NOT the full URL in the correspondence extensions.- Parameters:
key
- part of the confidence URL- Returns:
- the confidence or null if not existent
-
getAdditionalConfidenceOrDefault
-
getAdditionalConfidenceURL
Returns the full URL for an additional confidence. The key is just a part of the full URL.- Parameters:
key
- the key which is a part of the full URL.- Returns:
- the full URL
-
getAdditionalConfidences
Returns all added confidences (but not all extension values). The key of the returned map contains just the name of the confidence and is not the full URL contained in correspondence extensions.- Returns:
- All confidences that were added using e.g.
addAdditionalConfidence(String, double)
.
-
addAdditionalExplanation
Adds an additional explanation- Parameters:
matcherClass
- the class of the matcherexplanation
- the explanation for a correspondence
-
addAdditionalExplanation
Adds an additional explanation- Parameters:
key
- the key which should be associated with the explanationexplanation
- the explanation for a correspondence
-
getAdditionalExplanation
-
getAdditionalExplanation
-
getAdditionalExplanationURL
Returns the full URL for an additional explanation. The key is just a part of the full URL.- Parameters:
key
- the key which is a part of the full URL.- Returns:
- the full URL
-
getAdditionalExplanations
-
removeExtensions
public void removeExtensions()Clears the extension of this correspondence. -
removeExtensions
Remove all extensions which appear in blacklist.- Parameters:
blacklist
- the extension keys to be removed.
-
removeExtensionsNotIn
Removes all extensions, but keep the extensions with keys appearing in whitelist.- Parameters:
whitelist
- the extensions keys which should be kept
-
getExtensions
-
getEntityOne
-
setEntityOne
-
getEntityTwo
-
setEntityTwo
-
getConfidence
public double getConfidence() -
setConfidence
public void setConfidence(double confidence) -
getRelation
-
setRelation
-
getIdentifier
-
setIdentifier
-
hashCode
public int hashCode() -
equals
-
toString
-
toStringWithExtensions
-
comparingByConfidence
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Correspondence>
-