org.jrdf.writer.mem
Class RdfNamespaceMapImpl

java.lang.Object
  extended by org.jrdf.writer.mem.RdfNamespaceMapImpl
All Implemented Interfaces:
RdfNamespaceMap

public class RdfNamespaceMapImpl
extends Object
implements RdfNamespaceMap

Contains mappings between namespaces and partial URIs.

Author:
TurnerRX

Constructor Summary
RdfNamespaceMapImpl()
           
 
Method Summary
 String getFullUri(String partial)
          Returns the URI that is mapped to the prefix or null if the prefix is not mapped.
 Set<Map.Entry<String,String>> getNameEntries()
          Returns the Names mapping entry set.
 String getPrefix(URIReference resource)
          Returns the prefix that is mapped to the resource or null if the URI is not mapped.
 void load(Graph graph)
          Loads namespaces from the graph.
 String replaceNamespace(URIReference resource)
          Returns a string representing the resource URI with its URI prefix replaced by the mapped namespace.
 void reset()
          Reset the name and uri mappings.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RdfNamespaceMapImpl

public RdfNamespaceMapImpl()
Method Detail

load

public void load(Graph graph)
          throws GraphException
Description copied from interface: RdfNamespaceMap
Loads namespaces from the graph.

Specified by:
load in interface RdfNamespaceMap
Parameters:
graph - Graph containing URIs to load from.
Throws:
GraphException - If the graph cannot be read.

replaceNamespace

public String replaceNamespace(URIReference resource)
                        throws NamespaceException
Description copied from interface: RdfNamespaceMap
Returns a string representing the resource URI with its URI prefix replaced by the mapped namespace.

Specified by:
replaceNamespace in interface RdfNamespaceMap
Parameters:
resource - URIReference resource URI
Returns:
String namespaced representation of resource URI
Throws:
NamespaceException - If there is no mapping for the partial resource URI.

getPrefix

public String getPrefix(URIReference resource)
Description copied from interface: RdfNamespaceMap
Returns the prefix that is mapped to the resource or null if the URI is not mapped. Extracts the uri to the last '#' or '/' character.

Specified by:
getPrefix in interface RdfNamespaceMap
Parameters:
resource - prefix to look up.
Returns:
full namespace.

getFullUri

public String getFullUri(String partial)
Description copied from interface: RdfNamespaceMap
Returns the URI that is mapped to the prefix or null if the prefix is not mapped.

Specified by:
getFullUri in interface RdfNamespaceMap
Parameters:
partial - prefix to lookup.
Returns:
full namespace.

getNameEntries

public Set<Map.Entry<String,String>> getNameEntries()
Description copied from interface: RdfNamespaceMap
Returns the Names mapping entry set.

Specified by:
getNameEntries in interface RdfNamespaceMap
Returns:
name map entries.

reset

public void reset()
Description copied from interface: RdfNamespaceMap
Reset the name and uri mappings.

Specified by:
reset in interface RdfNamespaceMap

toString

public String toString()
Overrides:
toString in class Object