Interface PrefixMap

All Known Implementing Classes:
BufferingPrefixMap, PrefixMapAdapter, PrefixMapBase, PrefixMapNull, PrefixMapProxy, PrefixMapSink, PrefixMapStd, PrefixMapUnmodifiable, PrefixMapWrapper, PrefixMapZero

public interface PrefixMap
Interface for lightweight prefix maps, this is similar to PrefixMapping from Jena Core but it omits any reverse lookup functionality.

The contract also does not require an implementation to do any validation unlike the Jena Core PrefixMapping which requires validation of prefixes.

  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.jena.atlas.lib.Pair<String,String>
    abbrev(String uriStr)
    Abbreviate an IRI and return a pair of prefix and local parts, or null.
    Abbreviate an IRI or return null
    void
    add(String prefix, String iriString)
    Add a prefix, overwrites any existing association
    void
    Clear all prefixes.
    boolean
    Gets whether the map contains a given prefix
    void
    delete(String prefix)
    Delete a prefix
    expand(String prefixedName)
    Expand a prefix named, return null if it can't be expanded
    expand(String prefix, String localName)
    Expand a prefix, return null if it can't be expanded
    void
    Apply a BiConsumer<String, String> to each entry in the PrefixMap.
    get(String prefix)
    Return the URI for the prefix, or null if there is no entry for this prefix.
    Return the underlying mapping, this is generally unsafe to modify and implementations may opt to return an unmodifiable view of the mapping if they wish.
    Return a fresh copy of the underlying mapping, should be safe to modify unlike the mapping returned from getMapping()
    boolean
    Return whether the prefix map is empty or not.
    void
    putAll(Map<String,String> mapping)
    Add a prefix, overwrites any existing association
    void
    Add a prefix, overwrites any existing association
    void
    putAll(org.apache.jena.shared.PrefixMapping pmap)
    Add a prefix, overwrites any existing association
    int
    Return the number of entries in the prefix map.
    Return a stream of PrefixEntry, pairs of prefix and URI.
  • Method Details

    • get

      String get(String prefix)
      Return the URI for the prefix, or null if there is no entry for this prefix.
    • getMapping

      Map<String,String> getMapping()
      Return the underlying mapping, this is generally unsafe to modify and implementations may opt to return an unmodifiable view of the mapping if they wish.
      Returns:
      Underlying mapping
      See Also:
    • getMappingCopy

      Map<String,String> getMappingCopy()
      Return a fresh copy of the underlying mapping, should be safe to modify unlike the mapping returned from getMapping()
      Returns:
      Copy of the mapping
    • forEach

      void forEach(BiConsumer<String,String> action)
      Apply a BiConsumer<String, String> to each entry in the PrefixMap.
    • stream

      Stream<PrefixEntry> stream()
      Return a stream of PrefixEntry, pairs of prefix and URI.
    • add

      void add(String prefix, String iriString)
      Add a prefix, overwrites any existing association
      Parameters:
      prefix - Prefix
      iriString - Namespace IRI
    • putAll

      void putAll(PrefixMap pmap)
      Add a prefix, overwrites any existing association
      Parameters:
      pmap - Prefix Map
    • putAll

      void putAll(org.apache.jena.shared.PrefixMapping pmap)
      Add a prefix, overwrites any existing association
      Parameters:
      pmap - Prefix Mapping
    • putAll

      void putAll(Map<String,String> mapping)
      Add a prefix, overwrites any existing association
      Parameters:
      mapping - A Map of prefix name to IRI string
    • delete

      void delete(String prefix)
      Delete a prefix
      Parameters:
      prefix - Prefix to delete
    • clear

      void clear()
      Clear all prefixes.
    • containsPrefix

      boolean containsPrefix(String prefix)
      Gets whether the map contains a given prefix
      Parameters:
      prefix - Prefix
      Returns:
      True if the prefix is contained in the map, false otherwise
    • abbreviate

      String abbreviate(String uriStr)
      Abbreviate an IRI or return null
      Parameters:
      uriStr - URI to abbreviate
      Returns:
      URI in prefixed name form if possible, null otherwise
    • abbrev

      org.apache.jena.atlas.lib.Pair<String,String> abbrev(String uriStr)
      Abbreviate an IRI and return a pair of prefix and local parts, or null.
      Parameters:
      uriStr - URI string to abbreviate
      Returns:
      Pair of prefix and local name
      See Also:
    • expand

      String expand(String prefixedName)
      Expand a prefix named, return null if it can't be expanded
      Parameters:
      prefixedName - Prefixed Name
      Returns:
      Expanded URI if possible, null otherwise
    • expand

      String expand(String prefix, String localName)
      Expand a prefix, return null if it can't be expanded
      Parameters:
      prefix - Prefix
      localName - Local name
      Returns:
      Expanded URI if possible, null otherwise
    • isEmpty

      boolean isEmpty()
      Return whether the prefix map is empty or not.
    • size

      int size()
      Return the number of entries in the prefix map.