Class LocationMapper

java.lang.Object
org.apache.jena.riot.system.stream.LocationMapper

public class LocationMapper extends Object
Alternative locations for URIs. Maintains two maps: single item alternatives and alternative prefixes. To suggest an alternative location, first check the single items, then check the prefixes. A LocationMapper can be configured by an RDF file. The default for this is "etc/location-mapping.n3". There is a default LocationMapper which is used by the global @link{StreamManager}.
  • Constructor Details

    • LocationMapper

      public LocationMapper()
      Create a LocationMapper with no mapping yet
  • Method Details

    • clone

      public LocationMapper clone()
      Deep copy of location and prefix maps
    • copyFrom

      public void copyFrom(LocationMapper lmap2)
    • containsMapping

      public boolean containsMapping(String uri)
    • altMapping

      public String altMapping(String uri)
    • altMapping

      public String altMapping(String uri, String otherwise)
      Apply mappings: first try for an exact alternative location, then try to remap by prefix, finally, try the special case of filenames in a specific base directory.
      Parameters:
      uri -
      otherwise -
      Returns:
      The alternative location chosen
    • addAltEntry

      public void addAltEntry(String uri, String alt)
    • addAltPrefix

      public void addAltPrefix(String uriPrefix, String altPrefix)
    • listAltEntries

      public Iterator<String> listAltEntries()
      Iterate over all the entries registered
    • listAltPrefixes

      public Iterator<String> listAltPrefixes()
      Iterate over all the prefixes registered
    • removeAltEntry

      public void removeAltEntry(String uri)
    • removeAltPrefix

      public void removeAltPrefix(String uriPrefix)
    • getAltEntry

      public String getAltEntry(String uri)
    • getAltPrefix

      public String getAltPrefix(String uriPrefix)
    • isEmpty

      public boolean isEmpty()
      Iterate over all the entries registered
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toModel

      public org.apache.jena.rdf.model.Model toModel()
    • toModel

      public void toModel(org.apache.jena.rdf.model.Model model)