org.fenfire.loom
Class NamespaceMap

java.lang.Object
  |
  +--org.fenfire.loom.NamespaceMap

public class NamespaceMap
extends java.lang.Object

A class mapping XML namespace abbreviations like "rdf:" to namespace URIs.


Nested Class Summary
 class NamespaceMap.CompareByAbbrev
           
 
Constructor Summary
NamespaceMap()
           
 
Method Summary
 java.lang.String getAbbrev(java.lang.String uri)
          Get the abbreviation of an RDF resource URI.
 java.util.Comparator getComparator()
           
 void loadMappings(java.io.Reader r)
          Load the name -> uri mappings from an XML file.
 void put(java.lang.String name, java.lang.String uri)
          Add a shortname -> namespace mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespaceMap

public NamespaceMap()
Method Detail

put

public void put(java.lang.String name,
                java.lang.String uri)
Add a shortname -> namespace mapping.

Parameters:
name - The short name of the namespace, e.g. "rdfs".
uri - The URI of the namespace.

getAbbrev

public java.lang.String getAbbrev(java.lang.String uri)
Get the abbreviation of an RDF resource URI. If the URI starts with any of the namespace URIs in this map, an abbreviation is returned (e.g. "rdf:type"). Otherwise, a full URI is returned.


loadMappings

public void loadMappings(java.io.Reader r)
                  throws java.io.IOException,
                         org.xml.sax.SAXException
Load the name -> uri mappings from an XML file.

java.io.IOException
org.xml.sax.SAXException

getComparator

public java.util.Comparator getComparator()