Class IdentifiersOrgURIUtils

java.lang.Object
de.uni_halle.informatik.biodata.mp.resolver.identifiersorg.IdentifiersOrgURIUtils

public class IdentifiersOrgURIUtils extends Object
  • Constructor Details

    • IdentifiersOrgURIUtils

      public IdentifiersOrgURIUtils()
  • Method Details

    • addJavaRegexCaptureGroup

      public static String addJavaRegexCaptureGroup(String pattern)
    • removeHttpProtocolFromUrl

      public static String removeHttpProtocolFromUrl(String query)
    • replaceIdTag

      public static String replaceIdTag(String url, String pattern)
      Replaces the identifier placeholder "{$id}" in a URL pattern with a specified regex pattern. This method is designed to facilitate the matching of URLs against a dynamic regex pattern that represents an identifier within an identifiers.org namespace or its child resources.

      The method first attempts to find the "{$id}" placeholder within the provided URL. If found, it splits the URL around this placeholder and reassembles it with the given regex pattern in place of the placeholder. If the placeholder is not found, the URL is returned as is, but quoted to ensure it is treated as a literal string in regex operations.

      Note: The placeholder "{$id}" can optionally be surrounded by curly braces, which are considered during the replacement but do not affect the functionality.

      Parameters:
      url - The URL pattern containing the "{$id}" placeholder. This pattern represents a identifiers.org namespace or a related child namespace.
      pattern - The regex pattern that should replace the "{$id}" placeholder in the URL pattern.
      Returns:
      A string representing the URL with the "{$id}" placeholder replaced by the provided regex pattern. If no placeholder is found, the URL is returned unchanged but quoted.