Class MiriamRegistry

java.lang.Object
org.cy3sbml.miriam.MiriamRegistry

public final class MiriamRegistry extends Object
The MIRIAM registry of data collections used to resolve annotation URIs.

Starts with the copy bundled with the app, so it is usable immediately and without network. refreshInBackground(URI) replaces it with the current registry from identifiers.org once that download succeeds; readers see either the complete old or the complete new registry.

  • Field Details

    • ONLINE_REGISTRY

      public static final URI ONLINE_REGISTRY
      The current registry at identifiers.org.
    • DOWNLOAD_TIMEOUT

      public static final Duration DOWNLOAD_TIMEOUT
      Connect and read timeout of the registry download.
  • Method Details

    • bundled

      public static MiriamRegistry bundled()
      Creates the registry from the copy bundled with the app.
    • get

      public Namespace get(String prefix)
      The data collection with the given prefix, or null.
    • resolve

      public MiriamRegistry.ResolvedURI resolve(String resourceURI)
      Resolves the given identifiers.org resource URI or urn:miriam URN to its data collection and identifier, or null if the URI cannot be parsed. The namespace of the URI is matched case-insensitively (e.g. "NCBITaxon" gives "ncbitaxon"); a namespace with a provider part such as "obo.go" falls back to the part after the dot.

      The identifier of a compact URI (<prefix>:<accession>) depends on the data collection: without the namespace embedded in the identifier it is the accession ("BAO:0000362" gives "0000362"), with it the identifier keeps the prefix ("GO:0007049" and "go:GO:0007049" both give "GO:0007049").

    • findByURI

      public Namespace findByURI(String resourceURI)
      The data collection of the given identifiers.org resource URI or urn:miriam URN, or null, see resolve(String).
    • snapshot

      public Map<String,Namespace> snapshot()
      The current content, an unmodifiable map from prefix to data collection.
    • refresh

      public boolean refresh(URI source, Duration timeout)
      Replaces the registry with the one downloaded from the source. On failure the current registry stays in use.
      Returns:
      true if the registry was replaced
    • refreshInBackground

      public CompletableFuture<Boolean> refreshInBackground(URI source)
      Refreshes the registry from the source on a background thread, so the caller (e.g. the bundle start) is not blocked by the network.
      Returns:
      completes with the result of refresh(URI, Duration)