org.apache.jena.riot.stream
Class LocationMapper

java.lang.Object
  extended by org.apache.jena.riot.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{FileManager}.


Constructor Summary
LocationMapper()
          Create a LocationMapper with no mapping yet
 
Method Summary
 void addAltEntry(String uri, String alt)
           
 void addAltPrefix(String uriPrefix, String altPrefix)
           
 String altMapping(String uri)
           
 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.
 LocationMapper clone()
          Deep copy of location and prefix maps
 void copyFrom(LocationMapper lmap2)
           
 boolean equals(Object obj)
           
 String getAltEntry(String uri)
           
 String getAltPrefix(String uriPrefix)
           
 int hashCode()
           
 Iterator<String> listAltEntries()
          Iterate over all the entries registered
 Iterator<String> listAltPrefixes()
          Iterate over all the prefixes registered
 void removeAltEntry(String uri)
           
 void removeAltPrefix(String uriPrefix)
           
 Model toModel()
           
 void toModel(Model model)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocationMapper

public LocationMapper()
Create a LocationMapper with no mapping yet

Method Detail

clone

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

Overrides:
clone in class Object

copyFrom

public void copyFrom(LocationMapper lmap2)

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 choosen

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)

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 Model toModel()

toModel

public void toModel(Model model)


Licenced under the Apache License, Version 2.0