Class Alignment
java.lang.Object
com.googlecode.cqengine.ConcurrentIndexedCollection<Correspondence>
de.uni_mannheim.informatik.dws.melt.yet_another_alignment_api.Alignment
- All Implemented Interfaces:
com.googlecode.cqengine.engine.QueryEngine<Correspondence>
,com.googlecode.cqengine.IndexedCollection<Correspondence>
,Iterable<Correspondence>
,Collection<Correspondence>
,Set<Correspondence>
Data structure to represent an Alignment.
An alignment is a set of multiple
Correspondence
instances.
An alignment is also known as "mapping" or "mappings".
Each Correspondence
is uniquely identified by entityOne, entityTwo and relation.
This means, if you add a Correspondence which already exists, it will not be modified.
To modify an already existing correspondence you can use addOrModify(Correspondence)
.- Author:
- Sven Hertling, Jan Portisch
-
Field Summary
Modifier and TypeFieldDescriptionExtended attributes.protected com.googlecode.cqengine.index.navigable.NavigableIndex<Double,
Correspondence> protected com.googlecode.cqengine.index.hash.HashIndex<CorrespondenceRelation,
Correspondence> protected com.googlecode.cqengine.index.hash.HashIndex<String,
Correspondence> protected com.googlecode.cqengine.index.hash.HashIndex<String,
Correspondence> protected String
private static final org.slf4j.Logger
Default logger.protected String
private static final String
protected OntoInfo
protected OntoInfo
protected String
Fields inherited from class com.googlecode.cqengine.ConcurrentIndexedCollection
indexEngine, objectStore, persistence
-
Constructor Summary
ConstructorDescriptionAlignment
(boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) Copy constructor which copies all information stores in alignment as well as all correspondences.Copy constructor which copies all information stores in alignment as well as all correspondences (depending on attribute copyCorrespondences).Alignment
(File f, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) Alignment
(InputStream s, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) Alignment
(Iterable<Correspondence> correspondences) Alignment
(String text, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) Alignment
(URL url, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates a newCorrespondence
and adds it to this mapping.void
Creates a newCorrespondence
and adds it to this mapping.void
add
(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation) Creates a newCorrespondence
and adds it to this mapping.void
add
(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions) Creates a newCorrespondence
and adds it to this mapping.void
add
(String entityOne, String entityTwo, CorrespondenceRelation relation) Creates a newCorrespondence
and adds it to this mapping.addAdditionalConfidence
(String entityOne, String entityTwo, Class<?> matcherClass, double confidence) Adds the correspondence if not existing or adds the extensions values and updates confidence value.addAdditionalConfidenceAndExplanation
(String entityOne, String entityTwo, Class<?> matcherClass, double confidence, String explanation) Adds the correspondence if not existent or adds the extensions values and updates confidence value.addAdditionalExplanation
(String entityOne, String entityTwo, Class<?> matcherClass, String explanation) Adds the correspondence if not existent or adds the extensions values and updates confidence value.void
addExtensionValue
(Object extensionUri, Object extensionValue) Set the value for an extension.void
addExtensionValue
(String extensionUri, Object extensionValue) Set the value for an extension.addOrModify
(Correspondence correspondence) Adds the correspondence if not existent or adds the extensions values and updates confidence value.addOrModify
(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions) Adds the correspondence if not existent or adds the extensions values and updates confidence value.addOrModify
(String entityOne, String entityTwo, String extensionKey, Object extensionValue) Adds the correspondence if not existent or adds the extensions values and updates confidence value.Adds the correspondence if not existent or adds the extensions values and updates confidence value.Adds the correspondence if not existing.addOrUseHighestConfidence
(String entityOne, String entityTwo, double confidence) Adds the correspondence if not existent.void
void
void
void
static Alignment
copyExtensionsToAlignment
(Alignment sourceAlignment, Alignment targetAlignment) This method creates a deep copy oftargetAlignment
and further copies extension values from thesourceAlignment
.static Alignment
copyExtensionsToAlignment
(Alignment sourceAlignment, Alignment targetAlignment, boolean isOverwriteValues) This method creates a deep copy oftargetAlignment
and further copies extension values from thesourceAlignment
.void
copyExtensionsToThisAlignment
(Alignment otherAlignment) Copies extensions from correspondences in theotherAlignment
to this alignment.void
copyExtensionsToThisAlignment
(Alignment otherAlignment, boolean isOverwriteValues) Copies extensions from correspondences in theotherAlignment
to this alignment.static List<Correspondence>
createOrder
(Alignment alignment) Creates a deterministic order of correspondences.static List<Correspondence>
createOrder
(List<Correspondence> alignment) Creates a deterministic order of correspondences.cut
(double threshold) Returns a new alignment which contains only correspondences above or equal the given threshold (it will not modify the current object).int
cutSize
(double threshold) Returns only the size of the new alignment which contains only correspondences above or equal the given threshold (it will not modify the current object).getCorrespondence
(String source, String target, CorrespondenceRelation relation) Returns the specified correspondence (source, target, relation).Obtain an iterator for all correspondences where the given relation are involved.getCorrespondencesSource
(String source) Obtain an iterator for all correspondences where the given source is involved.getCorrespondencesSourceRelation
(String source, CorrespondenceRelation relation) Obtain an iterator for all correspondences where the given source and the given relation are involved.getCorrespondencesSourceTarget
(String source, String target) Returns correspondences involving the specified source AND target.getCorrespondencesTarget
(String target) getCorrespondencesTargetRelation
(String target, CorrespondenceRelation relation) Obtain an iterator for all correspondences where the given target and the given relation are involved.Returns all used (sub-) extension keys of correspondences which can be used with method getAdditionalConfidence.Returns all extension keys of correspondences in this alignment.Obtain the alignment extensions as Map.getExtensionValue
(Object extensionUri) Obtain the value of an extension.getExtensionValue
(String extensionUri) Obtain the value of an extension.getExtensionValueAsString
(Object extensionUri) Obtain the value of an extension.getExtensionValueAsString
(String extensionUri) Obtain the value of an extension.<T> T
getExtensionValueCasted
(Object extensionUri) Obtain the value of an extension.<T> T
getExtensionValueCasted
(String extensionUri) Obtain the value of an extension.getLevel()
double
double
getOnto1()
getOnto2()
getType()
private void
init
(boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) static Alignment
intersection
(Alignment alignment_1, Alignment alignment_2) Create the intersection between the two given alignments.boolean
isRelationContained
(CorrespondenceRelation relation) Check whether the given relation are contained in this alignment.boolean
isSourceContained
(String source) Check whether the specifiedsource
is contained in this alignment instance.boolean
isSourceRelationContained
(String source, CorrespondenceRelation relation) Check whether the given source and the given relation are contained in this alignment.boolean
isTargetContained
(String target) Check whether the specifiedtarget
is contained in this alignment instance.boolean
isTargetRelationContained
(String target, CorrespondenceRelation relation) Check whether the given target and the given relation are contained in this alignment.static long
iterableSize
(Iterable<?> i) Returns the size of the iterable.static long
iteratorSize
(Iterator<?> i) Returns the size of the iterator.static <T> List<T>
Creates a list from an iterable.static <T> Set<T>
Creates a set from an iterable.static Alignment
Parse a file and returns the corresponding Alignment object.More options are available when using constructors.static Alignment
parse
(InputStream stream) Parse a stream and returns the corresponding Alignment object.static Alignment
Parse a text and returns the corresponding Alignment object.void
Removes all correspondence extensions.void
removeCorrespondenceExtensions
(Iterable<String> blacklist) Remove all correspondence extensions which appear in blacklist.void
removeCorrespondenceExtensionsNotIn
(Set<String> whitelist) Removes all correspondence extensions, but keep the extensions with keys appearing in whitelist.void
removeCorrespondencesSource
(String source) void
removeCorrespondencesSourceTarget
(String source, String target) Removes correspondences where source AND target appear (at the same time), i.e.void
removeCorrespondencesTarget
(String target) reverse()
Reverse the alignment (switches sources with targets) and adjust(reverse) the relation.Reverse the alignment (switches sources with targets) and does not change the relation.sample
(int n) Returns a random sample of correspondences.sample
(int n, long seed) Returns a random sample of correspondences.Returns a random sample of correspondences.sampleByFraction
(double fraction) Returns a random sample of correspondences.sampleByFraction
(double fraction, long seed) Returns a random sample of correspondences.sampleByFraction
(double fraction, Random rnd) Returns a random sample of correspondences.Serialize this mapping to a string.void
Serialize this mapping directly to a given file in the default XML format.void
serializeToCSV
(File file) Serialize this mapping directly to a given file in CSV format.void
setExtensions
(Map<String, Object> extensions) Set the extensions of the alignment.void
void
void
void
void
static Alignment
subtraction
(Alignment alignment_1, Alignment alignment_2) Create the subtraction between the two given alignments.static Alignment
switchSourceWithTarget
(Alignment alignment) Deprecated.use function reversetoString()
ToString method which returns the alignment in multiple lines (each correspondence in one line) to have a better overview.ToString method which returns the alignment in multiple lines (each correspondence in one line) to have a better overview.ToString method which returns the alignment in one line.static Alignment
Create the union between the two given alignments.Methods inherited from class com.googlecode.cqengine.ConcurrentIndexedCollection
add, addAll, addIndex, addIndex, clear, closeRequestScopeResourcesIfNecessary, contains, containsAll, equals, flagAsReadRequest, getIndexes, getObjectStoreAsSet, getPersistence, hashCode, isEmpty, iterator, openRequestScopeResourcesIfNecessary, remove, removeAll, removeIndex, removeIndex, retainAll, retrieve, retrieve, size, toArray, toArray, update, update
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
spliterator
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERDefault logger. -
method
-
type
-
level
-
onto1
-
onto2
-
indexSource
-
indexTarget
-
indexRelation
protected com.googlecode.cqengine.index.hash.HashIndex<CorrespondenceRelation,Correspondence> indexRelation -
indexConfidence
protected com.googlecode.cqengine.index.navigable.NavigableIndex<Double,Correspondence> indexConfidence -
extensions
Extended attributes. -
NEWLINE
-
-
Constructor Details
-
Alignment
public Alignment() -
Alignment
-
Alignment
public Alignment(boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) -
Alignment
- Throws:
SAXException
IOException
-
Alignment
public Alignment(URL url, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) throws SAXException, IOException - Throws:
SAXException
IOException
-
Alignment
- Throws:
SAXException
IOException
-
Alignment
public Alignment(File f, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) throws SAXException, IOException - Throws:
SAXException
IOException
-
Alignment
- Throws:
SAXException
IOException
-
Alignment
public Alignment(String text, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) throws SAXException, IOException - Throws:
SAXException
IOException
-
Alignment
- Throws:
SAXException
IOException
-
Alignment
public Alignment(InputStream s, boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) throws SAXException, IOException - Throws:
SAXException
IOException
-
Alignment
Copy constructor which copies all information stores in alignment as well as all correspondences.- Parameters:
alignment
- The alignment which shall be copied (deep copy).
-
Alignment
Copy constructor which copies all information stores in alignment as well as all correspondences (depending on attribute copyCorrespondences). Important: the extensions (on alignment and correspondence level) are copied only shallow. This menas the objetc values of the hashmap are shared (pointing to the same object).- Parameters:
alignment
- The alignment which shall be copied (deep copy).copyCorrespondences
- if true copies all information, if false copies all but no correspondences
-
-
Method Details
-
init
private void init(boolean indexSource, boolean indexTarget, boolean indexRelation, boolean indexConfidence) -
add
public void add(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions) Creates a newCorrespondence
and adds it to this mapping.- 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.
-
add
public void add(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation) Creates a newCorrespondence
and adds it to this mapping.- 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.
-
add
Creates a newCorrespondence
and adds it to this mapping.- 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.
-
add
Creates a newCorrespondence
and adds it to this mapping.- 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.
-
add
Creates a newCorrespondence
and adds it to this mapping.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.
-
addOrModify
public Correspondence addOrModify(String entityOne, String entityTwo, double confidence, CorrespondenceRelation relation, Map<String, Object> extensions) Adds the correspondence if not existent or adds the extensions values and updates confidence value.- 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- Returns:
- the updated correspondence
-
addOrModify
public Correspondence addOrModify(String entityOne, String entityTwo, Map<String, Object> extensions) Adds the correspondence if not existent or adds the extensions values and updates confidence value.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.extensions
- extensions- Returns:
- the updated correspondence
-
addOrModify
public Correspondence addOrModify(String entityOne, String entityTwo, String extensionKey, Object extensionValue) Adds the correspondence if not existent or adds the extensions values and updates confidence value.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.extensionKey
- The key of the extension.extensionValue
- The value of the extension.- Returns:
- The updated correspondence.
-
addAdditionalConfidence
public Correspondence addAdditionalConfidence(String entityOne, String entityTwo, Class<?> matcherClass, double confidence) Adds the correspondence if not existing or adds the extensions values and updates confidence value.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.matcherClass
- The class of the matcher.confidence
- The additional confidence.- Returns:
- the updated correspondence
-
addAdditionalExplanation
public Correspondence addAdditionalExplanation(String entityOne, String entityTwo, Class<?> matcherClass, String explanation) Adds the correspondence if not existent or adds the extensions values and updates confidence value.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.matcherClass
- the class of the matcherexplanation
- the explanation for a correspondence- Returns:
- the updated correspondence
-
addAdditionalConfidenceAndExplanation
public Correspondence addAdditionalConfidenceAndExplanation(String entityOne, String entityTwo, Class<?> matcherClass, double confidence, String explanation) Adds the correspondence if not existent or adds the extensions values and updates confidence value.- Parameters:
entityOne
- URI of the entity from the source ontology as String.entityTwo
- URI of the entity from the target ontology as String.matcherClass
- the class of the matcherconfidence
- the additional confidenceexplanation
- the explanation for a correspondence- Returns:
- the updated correspondence
-
addOrModify
Adds the correspondence if not existent or adds the extensions values and updates confidence value.- Parameters:
correspondence
- Correspondence to be added.- Returns:
- the updated correspondence
-
addOrUseHighestConfidence
Adds the correspondence if not existing. In case it already exists, adds the extensions values and updates confidence value(but only if it increases the confidence value).- Parameters:
c
- Correspondence to be added- Returns:
- the updated Correspondence
-
addOrUseHighestConfidence
public Correspondence addOrUseHighestConfidence(String entityOne, String entityTwo, double confidence) Adds the correspondence if not existent. In case it already exists, updates confidence value only if it increases.- 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.- Returns:
- the updated Correspondence
-
getCorrespondence
public Correspondence getCorrespondence(String source, String target, CorrespondenceRelation relation) Returns the specified correspondence (source, target, relation). If not available it returns null.- Parameters:
source
- Source URI.target
- Target URI.relation
- Relation that holds between the URIs.- Returns:
- mapping correspondence or null
-
getCorrespondencesSourceTarget
Returns correspondences involving the specified source AND target.- Parameters:
source
- Source (URI)target
- Target (URI)- Returns:
- Iterable of correspondences involving source AND target (at the same time).
-
getCorrespondencesSource
Obtain an iterator for all correspondences where the given source is involved.- Parameters:
source
- The source that shall be looked up.- Returns:
- Iterable over
Correspondence
. Note: If there is no match, the iterable is not null.
-
isSourceContained
Check whether the specifiedsource
is contained in this alignment instance.- Parameters:
source
- The source to be looked up.- Returns:
- True if source is contained, else false.
-
getCorrespondencesSourceRelation
public Iterable<Correspondence> getCorrespondencesSourceRelation(String source, CorrespondenceRelation relation) Obtain an iterator for all correspondences where the given source and the given relation are involved.- Parameters:
source
- The source that shall be looked up.relation
- The relation that shall hold between the specified source and an arbitrary target.- Returns:
- Iterable over
Correspondence
.
-
isSourceRelationContained
Check whether the given source and the given relation are contained in this alignment.- Parameters:
source
- The source that shall be looked up.relation
- The relation that shall hold between the specified source and an arbitrary target.- Returns:
- True if correspondence with the specified criteria could be found, else false.
-
getCorrespondencesTarget
-
isTargetContained
Check whether the specifiedtarget
is contained in this alignment instance.- Parameters:
target
- The target to be looked up.- Returns:
- True if target is contained, else false.
-
getCorrespondencesTargetRelation
public Iterable<Correspondence> getCorrespondencesTargetRelation(String target, CorrespondenceRelation relation) Obtain an iterator for all correspondences where the given target and the given relation are involved.- Parameters:
target
- The target that shall be looked up.relation
- The relation that shall hold between the specified target and an arbitrary source.- Returns:
- Iterable over
Correspondence
.
-
isTargetRelationContained
Check whether the given target and the given relation are contained in this alignment.- Parameters:
target
- The target that shall be looked up.relation
- The relation that shall hold between the specified target and an arbitrary source.- Returns:
- True if correspondence with the specified criteria could be found, else false.
-
getCorrespondencesRelation
Obtain an iterator for all correspondences where the given relation are involved.- Parameters:
relation
- The relation that shall hold between the specified target and an arbitrary source.- Returns:
- Iterable over
Correspondence
.
-
isRelationContained
Check whether the given relation are contained in this alignment.- Parameters:
relation
- The relation that shall hold.- Returns:
- True if correspondence with the specified criteria could be found, else false.
-
removeCorrespondencesSourceTarget
Removes correspondences where source AND target appear (at the same time), i.e.<source, target, someConfidence>
.- Parameters:
source
- Source concept (typically URI)target
- Target concept (typically URI)
-
removeCorrespondencesSource
-
removeCorrespondencesTarget
-
removeCorrespondenceExtensions
public void removeCorrespondenceExtensions()Removes all correspondence extensions. -
removeCorrespondenceExtensions
Remove all correspondence extensions which appear in blacklist.- Parameters:
blacklist
- the extension keys to be removed.
-
removeCorrespondenceExtensionsNotIn
Removes all correspondence extensions, but keep the extensions with keys appearing in whitelist.- Parameters:
whitelist
- the extensions keys which should be kept
-
cut
Returns a new alignment which contains only correspondences above or equal the given threshold (it will not modify the current object).- Parameters:
threshold
- Threshold for cutting (correspondences greater than or equal the threshold will be added).- Returns:
- A new alignment with filtered correspondences. This alignment stays untouched from the operation.
-
cutSize
public int cutSize(double threshold) Returns only the size of the new alignment which contains only correspondences above or equal the given threshold (it will not modify the current object). This is faster than creating the cutted alignment in case you are only interested in the size of it (e.g. for best confidence search).- Parameters:
threshold
- Threshold for cutting (correspondences greater than or equal the threshold will be added).- Returns:
- the size of the cutted alignment.
-
sample
Returns a random sample of correspondences. If the parameter n is greater than the alignment size, an IllegalArgumentException is thrown. The alignment itself (where this method is called on) will not be modified.- Parameters:
n
- the number of correspondences to be returned. Should be smaller than the size of this alignment.- Returns:
- a new Alignment which contains the sampled correspondences.
-
sample
Returns a random sample of correspondences. If the parameter n is greater than the alignment size, an IllegalArgumentException is thrown. If the random parameter is always in the same state e.g. always providing a fresh instance with the same seed like new Random(1234) or setting the seed of one random instance always to the same value, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.- Parameters:
n
- the number of correspondences to be returned. Should be smaller than the size of this alignment.rnd
- the source of randomness.- Returns:
- a new Alignment which contains the sampled correspondences.
-
sample
Returns a random sample of correspondences. If the parameter n is greater than the alignment size, an IllegalArgumentException is thrown. If the random parameter is always in the same, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.- Parameters:
n
- the number of correspondences to be returned. Should be smaller than the size of this alignment.seed
- the seed for random.- Returns:
- a new Alignment which contains the sampled correspondences.
-
sampleByFraction
Returns a random sample of correspondences. If the parameter n is greater than the alignment size, the full alignment (copy of this alignment) is returned. The alignment itself (where this method is called on) will not be modified.- Parameters:
fraction
- the number of correspondences to be returned. Should be smaller than the size of this alignment.- Returns:
- a new Alignment which contains the sampled correspondences.
-
sampleByFraction
Returns a random sample of correspondences. If the parameter n is greater than the alignment size, the full alignment (copy of this alignment) is returned. If the random parameter is always in the same state e.g. always providing a fresh instance with the same seed like new Random(1234) or setting the seed of one random instance always to the same value, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.- Parameters:
fraction
- the number of correspondences to be returned. Should be smaller than the size of this alignment.rnd
- the source of randomness.- Returns:
- a new Alignment which contains the sampled correspondences.
-
sampleByFraction
Returns a random sample of correspondences. If the parameter n is greater than the alignment size, the full alignment (copy of this alignment) is returned. If the random parameter is always the same, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent). The alignment itself (where this method is called on) will not be modified.- Parameters:
fraction
- the number of correspondences to be returned. Should be smaller than the size of this alignment.seed
- the source of randomness.- Returns:
- a new Alignment which contains the sampled correspondences.
-
getDistinctCorrespondenceExtensionKeys
Returns all extension keys of correspondences in this alignment.- Returns:
- a set of all correspondence extension keys.
-
getDistinctCorrespondenceConfidenceKeys
Returns all used (sub-) extension keys of correspondences which can be used with method getAdditionalConfidence.- Returns:
- a set of all correspondence (sub-) extension keys.
-
reverseWithoutRelationChange
Reverse the alignment (switches sources with targets) and does not change the relation. It creates a new Alignment. If the relation should be changed use thereverse()
method.- Returns:
- NEW reversed alignment.
-
reverse
Reverse the alignment (switches sources with targets) and adjust(reverse) the relation. It creates a new Alignment. If the relation should not be changed use thereverseWithoutRelationChange()
method.- Returns:
- New reversed alignment.
-
copyExtensionsToThisAlignment
Copies extensions from correspondences in theotherAlignment
to this alignment. If this alignment already has an extension for the key in question, the extension will not be overwritten. The confidence is never overwritten. Extensions are only copied for correspondences available in theotherAlignment
and this alignment.- Parameters:
otherAlignment
- The other alignment from which the extensions shall be transferred.
-
copyExtensionsToThisAlignment
Copies extensions from correspondences in theotherAlignment
to this alignment.- Parameters:
otherAlignment
- The other alignment from which the extension values shall be transferred.isOverwriteValues
- Ifthis
alignment already contains an extension key available in theotherAlignment
, it will be overwritten with the value of theotherAlignment
. If false, the value will not be overwritten.
-
serialize
Serialize this mapping to a string. Better use the function serialize(File f) if the mapping is huge.- Returns:
- the mapping in the alignment xml format
- Throws:
IOException
- An IOException.
-
serialize
Serialize this mapping directly to a given file in the default XML format. This also works if the alignment is huge.- Parameters:
file
- The file for writing the mapping.- Throws:
IOException
- An IOException.
-
serializeToCSV
Serialize this mapping directly to a given file in CSV format. This also works if the alignment is huge.- Parameters:
file
- The file for writing the mapping.- Throws:
IOException
- An IOException.
-
getMethod
-
setMethod
-
getType
-
setType
-
getOnto2
-
setOnto2
-
getOnto1
-
setOnto1
-
getLevel
-
setLevel
-
getConfidenceOrderedMapping
-
getMinimalConfidence
public double getMinimalConfidence() -
getMaximalConfidence
public double getMaximalConfidence() -
assertIndexOnSource
public void assertIndexOnSource() -
assertIndexOnTarget
public void assertIndexOnTarget() -
assertIndexOnRelation
public void assertIndexOnRelation() -
assertIndexOnConfidence
public void assertIndexOnConfidence() -
getDistinctSources
-
getDistinctSourcesAsSet
-
getDistinctTargets
-
getDistinctTargetsAsSet
-
getDistinctSourceAndTargetsAsSet
-
getDistinctRelations
-
getDistinctRelationsAsSet
-
getDistinctConfidences
-
getDistinctConfidencesAsSet
-
makeSet
Creates a set from an iterable.- Type Parameters:
T
- the type of the iterable- Parameters:
iterable
- iterable which should be converted to set- Returns:
- set containing all elements of iterable
-
makeList
Creates a list from an iterable.- Type Parameters:
T
- the type of the iterable- Parameters:
iterable
- iterable which should be converted to list- Returns:
- list containing all elements of iterable
-
iteratorSize
Returns the size of the iterator.- Parameters:
i
- the iterator to use- Returns:
- the size of the iterator.
-
iterableSize
Returns the size of the iterable.- Parameters:
i
- the iterable to use- Returns:
- the size of the iterable.
-
getExtensionValue
Obtain the value of an extension.- Parameters:
extensionUri
- The URI identifying the extension. Note that many default extension URIs are contained inDefaultExtensions
.- Returns:
- The value of the extension as String, null if there is no value.
-
getExtensionValue
Obtain the value of an extension.- Parameters:
extensionUri
- The URI identifying the extension. Note that many default extension URIs are contained inDefaultExtensions
.- Returns:
- The value of the extension as String, null if there is no value.
-
getExtensionValueAsString
Obtain the value of an extension.- Parameters:
extensionUri
- The URI identifying the extension. Note that many default extension URIs are contained inDefaultExtensions
.- Returns:
- The value of the extension as String, null if there is no value.
-
getExtensionValueAsString
Obtain the value of an extension.- Parameters:
extensionUri
- The URI identifying the extension. Note that many default extension URIs are contained inDefaultExtensions
.- 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.- Parameters:
extensionUri
- The URI identifying the extension. Note that many default extension URIs are contained inDefaultExtensions
.extensionValue
- The value of the extension to be set.
-
addExtensionValue
Set the value for an extension.- Parameters:
extensionUri
- The URI identifying the extension. Note that many default extension URIs are contained inDefaultExtensions
.extensionValue
- The value of the extension to be set.
-
getExtensions
Obtain the alignment extensions as Map.- Returns:
- The map is build as follows:
- key: extension URI
- value: extension value
-
setExtensions
Set the extensions of the alignment. Note that this method will overwrite existing extensions of the alignment.- Parameters:
extensions
- The alignment extensions to be set.
-
toStringMultiline
ToString method which returns the alignment in multiple lines (each correspondence in one line) to have a better overview.- Returns:
- a string which contains the alignment in multiple lines.
-
toStringMultilineInfo
ToString method which returns the alignment in multiple lines (each correspondence in one line) to have a better overview. In comparison to toStringMultiline, this method prints also the alignment and correspondence extensions and onto infos.- Returns:
- a string which contains the alignment in multiple lines.
-
toStringOneLine
ToString method which returns the alignment in one line.- Returns:
- a string which contains the alignment in one line.
-
toString
- Overrides:
toString
in classcom.googlecode.cqengine.ConcurrentIndexedCollection<Correspondence>
-
parse
Parse a file and returns the corresponding Alignment object.More options are available when using constructors.- Parameters:
f
- the file to be pasred- Returns:
- alignment object
- Throws:
SAXException
- in case of an parser errorIOException
- in case of an parser error
-
parse
Parse a text and returns the corresponding Alignment object. More options are available when using constructors.- Parameters:
text
- the text to be pasred- Returns:
- alignment object
- Throws:
SAXException
- in case of an parser errorIOException
- in case of an parser error
-
parse
Parse a stream and returns the corresponding Alignment object. More options are available when using constructors.- Parameters:
stream
- the stream to be pasred- Returns:
- alignment object
- Throws:
SAXException
- in case of an parser errorIOException
- in case of an parser error
-
subtraction
Create the subtraction between the two given alignments. Only copies the alignment and not further infos like onto or extensions.- Parameters:
alignment_1
- Set 1.alignment_2
- Set 2.- Returns:
- Subtraction alignment.
-
intersection
Create the intersection between the two given alignments. Only copies the alignment and not further infos like onto or extensions.- Parameters:
alignment_1
- Set 1.alignment_2
- Set 2.- Returns:
- Intersection alignment.
-
union
Create the union between the two given alignments. Only copies the alignment and not further infos like onto or extensions.- Parameters:
alignment_1
- Set 1.alignment_2
- Set 2.- Returns:
- Union alignment.
-
switchSourceWithTarget
Deprecated.use function reverseSwitches sources with targets. Does not change the relation. This method is only for erroneous alignments where a matcher switched the source with the target ontology.- Parameters:
alignment
- The alignment where the source shall be switched with the target.- Returns:
- Edited alignment.
-
copyExtensionsToAlignment
public static Alignment copyExtensionsToAlignment(Alignment sourceAlignment, Alignment targetAlignment, boolean isOverwriteValues) This method creates a deep copy oftargetAlignment
and further copies extension values from thesourceAlignment
. The confidence is never overwritten.- Parameters:
sourceAlignment
- The alignment from which the extension values shall be transferred to thetargetAlignment
.targetAlignment
- The alignment which will be copied and to which are the extension values are copied.isOverwriteValues
- If thetargetAlignment
alignment already contains an extension key available in thesourceAlignment
, it will be overwritten with the value of thesourceAlignment
. If false, the value will not be overwritten.- Returns:
- A new alignment instance.
-
copyExtensionsToAlignment
public static Alignment copyExtensionsToAlignment(Alignment sourceAlignment, Alignment targetAlignment) This method creates a deep copy oftargetAlignment
and further copies extension values from thesourceAlignment
. The confidence is never overwritten. If thetargetAlignment
already contains the extension key, no value will be copied from thesourceAlignment
.- Parameters:
sourceAlignment
- The alignment from which the extension values shall be transferred to thetargetAlignment
.targetAlignment
- The alignment which will be copied and to which are the extension values are copied.- Returns:
- A new alignment instance.
-
createOrder
Creates a deterministic order of correspondences.- Parameters:
alignment
- the alignemtn to create the order- Returns:
- an ordered alignment as list.
-
createOrder
Creates a deterministic order of correspondences.- Parameters:
alignment
- the alignemtn to create the order- Returns:
- an ordered alignment as list.
-