Class WebIsAlodClassicLinker
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.external.webIsAlod.classic.WebIsAlodClassicLinker
- All Implemented Interfaces:
LabelToConceptLinker
This linker can link strings to dictionary entries.
-
Field Summary
Modifier and TypeFieldDescriptionprivate String
Identifying label of this linker.private WebIsAlodSPARQLservice
SPARQL Service instance for (buffered) queries. -
Constructor Summary
ConstructorDescriptionDefault Constructor (for Web endpoint).WebIsAlodClassicLinker
(String tdbDirectory) TDB constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
cleanLabelForLabelLookup
(String labelToClean) When looking up a resource on WebIsALOD using a plain label, that label needs to be stripped off from invalid characters.Get instance specific name of the linker.linkLabelToTokensLeftToRight
(String labelToBeLinked) Splits the labelToBeLinked in ngrams up to infinite size and tries to link components.linkToPotentiallyMultipleConcepts
(String labelToBeLinked) This method tries to linklabelToBeLinked
to one concept if possible.linkToSingleConcept
(String labelToBeLinked) Queries for a concept and returns a link that represents an entity in the background knowledge source such as theSemanticWordRelationDictionary
.static String
normalizeForAlodClassicLookupWithoutTokenization
(String lookupString) Normalize for BabelNet lookup, i.e., lowercasing and camel-case resolution.static String
normalizeForAlodClassicLookupWithTokenization
(String lookupString) Normalize for BabelNet lookup, i.e., lowercasing and camel-case resolution.void
setNameOfLinker
(String nameOfLinker) Set instance specific name of the linker.static String
unstripUriClassic
(String uri) This method will strip the URL part from the URI.
-
Field Details
-
nameOfLinker
Identifying label of this linker. -
sparqlService
SPARQL Service instance for (buffered) queries.
-
-
Constructor Details
-
WebIsAlodClassicLinker
public WebIsAlodClassicLinker()Default Constructor (for Web endpoint). -
WebIsAlodClassicLinker
TDB constructor.- Parameters:
tdbDirectory
- TDB 1 directory that shall be used.
-
-
Method Details
-
linkToSingleConcept
Description copied from interface:LabelToConceptLinker
Queries for a concept and returns a link that represents an entity in the background knowledge source such as theSemanticWordRelationDictionary
. Note that the link may not always be something intuitive such as a URI but may also be an artificial identifier that is understood by the corresponding background knowledge source.- Specified by:
linkToSingleConcept
in interfaceLabelToConceptLinker
- Parameters:
labelToBeLinked
- The label which shall be linked to a single concept.- Returns:
- Concept or null if no link could be found.
-
linkToPotentiallyMultipleConcepts
Description copied from interface:LabelToConceptLinker
This method tries to linklabelToBeLinked
to one concept if possible. If it fails, it will try to link it to multiple concepts.- Specified by:
linkToPotentiallyMultipleConcepts
in interfaceLabelToConceptLinker
- Parameters:
labelToBeLinked
- The label which shall be linked.- Returns:
- One or multiple linked concepts in a set. Null if it could not fully link the label.
-
linkLabelToTokensLeftToRight
Splits the labelToBeLinked in ngrams up to infinite size and tries to link components. This corresponds to a MAXGRAM_LEFT_TO_RIGHT_TOKENIZER or NGRAM_LEFT_TO_RIGHT_TOKENIZER OneToManyLinkingStrategy.- Parameters:
labelToBeLinked
- The label that shall be linked.- Returns:
- A set of concept URIs that were found.
-
getNameOfLinker
Description copied from interface:LabelToConceptLinker
Get instance specific name of the linker.- Specified by:
getNameOfLinker
in interfaceLabelToConceptLinker
- Returns:
- Name as String.
-
setNameOfLinker
Description copied from interface:LabelToConceptLinker
Set instance specific name of the linker.- Specified by:
setNameOfLinker
in interfaceLabelToConceptLinker
- Parameters:
nameOfLinker
- Name to be set.
-
cleanLabelForLabelLookup
When looking up a resource on WebIsALOD using a plain label, that label needs to be stripped off from invalid characters. This method does the job. Note that this method is endpoint specific.- Parameters:
labelToClean
- That label that is to be cleaned.- Returns:
- Cleaned label.
-
normalizeForAlodClassicLookupWithTokenization
Normalize for BabelNet lookup, i.e., lowercasing and camel-case resolution. Dev-Remark: The BabelNet library utilizes space-separation.- Parameters:
lookupString
- The string that shall be normalized for lookup.- Returns:
- Space-separated lookup word.
-
normalizeForAlodClassicLookupWithoutTokenization
Normalize for BabelNet lookup, i.e., lowercasing and camel-case resolution. Dev-Remark: The BabelNet library utilizes space-separation.- Parameters:
lookupString
- The string that shall be normalized for lookup.- Returns:
- Space-separated lookup word.
-
unstripUriClassic
This method will strip the URL part from the URI.- Parameters:
uri
- URI that shall be stripped.- Returns:
- Un-stripped URI.
-