java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_jena_matchers.util.textExtractors.TextExtractorOnlyLabel
All Implemented Interfaces:
TextExtractor

public class TextExtractorOnlyLabel extends Object implements 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 Details

    • languageCode

      protected String languageCode
  • Constructor Details

    • TextExtractorOnlyLabel

      public TextExtractorOnlyLabel()
    • TextExtractorOnlyLabel

      public TextExtractorOnlyLabel(String languageCode)
  • Method Details

    • extract

      public Set<String> extract(org.apache.jena.rdf.model.Resource r)
      Description copied from interface: TextExtractor
      Given a Jena resource this method extracts textual/string representations from it.
      Specified by:
      extract in interface TextExtractor
      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

      public String extractOne(org.apache.jena.rdf.model.Resource r)
    • 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 resource
      p - the property to analyze
      Returns:
      the extracted lexical form of the literal or empty string (if no literal matches or is provided).
    • langTagMatch

      protected boolean langTagMatch(String target)
    • extractFragment

      public static String extractFragment(org.apache.jena.rdf.model.Resource r)