org.jrdf.writer
Class RdfNamespaceMapImpl

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

public final class RdfNamespaceMapImpl
extends Object
implements RdfNamespaceMap

Contains mappings between namespaces and partial URIs.

Author:
TurnerRX

Constructor Summary
RdfNamespaceMapImpl(MapFactory mapFactory)
           
 
Method Summary
 void addNamespace(String namespace, String partialUri)
          Adds a new namespace mapping, if no mapping already exists.
 Set<Map.Entry<String,String>> getNameEntries()
          Returns the Names mapping entry set.
 QName getQName(String uri)
          Parses a string and finds the last # or / and treats the characters before that as the namespace URI and the characters after it as the local part.
 void load(Graph graph)
          Loads namespaces from the graph.
 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(MapFactory mapFactory)
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.

addNamespace

public void addNamespace(String namespace,
                         String partialUri)
                  throws NamespaceException
Description copied from interface: RdfNamespaceMap
Adds a new namespace mapping, if no mapping already exists.

Specified by:
addNamespace in interface RdfNamespaceMap
Parameters:
namespace - the shortened name to add, e.g. rdf.
partialUri - the URI to map, e.g. http://www.w3.org/1999/02/22-rdf-syntax-ns#.
Throws:
NamespaceException

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.

getQName

public QName getQName(String uri)
Description copied from interface: RdfNamespaceMap
Parses a string and finds the last # or / and treats the characters before that as the namespace URI and the characters after it as the local part.

Specified by:
getQName in interface RdfNamespaceMap
Parameters:
uri - the uri to parse
Returns:
either a QName with a namespace URI and local part if a # or / is found or a QName with the given string as the namespace uri and an empty string as the local part.

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