Class TextExtractorOnlyLabel
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.util.textExtractors.TextExtractorOnlyLabel
- All Implemented Interfaces:
TextExtractor
Extracts only one speaking label (language can be set in constructor) which can be (in decreasing importance):
skos:prefLabel, rdfs:label, fragment (only if more than 50 percent are not numbers), skos:altLabel, skos:hiddenLabel.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionextract
(org.apache.jena.rdf.model.Resource r) Given a Jena resource this method extracts textual/string representations from it.static String
extractFragment
(org.apache.jena.rdf.model.Resource r) extractOne
(org.apache.jena.rdf.model.Resource r) protected String
extractProperty
(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p) Extract literal if language tag fits or (as fallback) literal with no language tag.protected boolean
langTagMatch
(String target)
-
Field Details
-
languageCode
-
-
Constructor Details
-
TextExtractorOnlyLabel
public TextExtractorOnlyLabel() -
TextExtractorOnlyLabel
-
-
Method Details
-
extract
Description copied from interface:TextExtractor
Given a Jena resource this method extracts textual/string representations from it.- Specified by:
extract
in interfaceTextExtractor
- Parameters:
r
- the jena resource which also allows to traverse the whole rdf graph- Returns:
- a set of textual representations of the given resource.
-
extractOne
-
extractProperty
protected String extractProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p) Extract literal if language tag fits or (as fallback) literal with no language tag.- Parameters:
r
- the resourcep
- the property to analyze- Returns:
- the extracted lexical form of the literal or empty string (if no literal matches or is provided).
-
langTagMatch
-
extractFragment
-