org.semanticweb.owlapi.vocab
Class PrefixOWLOntologyFormat

java.lang.Object
  extended by org.semanticweb.owlapi.model.OWLOntologyFormat
      extended by org.semanticweb.owlapi.vocab.PrefixOWLOntologyFormat
All Implemented Interfaces:
PrefixManager
Direct Known Subclasses:
ManchesterOWLSyntaxOntologyFormat, OWLFunctionalSyntaxOntologyFormat, OWLXMLOntologyFormat, RDFOntologyFormat

public class PrefixOWLOntologyFormat
extends OWLOntologyFormat
implements PrefixManager

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 20-Feb-2007

An


Constructor Summary
PrefixOWLOntologyFormat()
           
 
Method Summary
 void clearPrefixes()
          Clears any previously set prefixes
 boolean containsPrefixMapping(java.lang.String prefix)
          Determines if this manager knows about a given prefix name and it contains a (non-null) mapping for the prefix.
 void copyPrefixesFrom(PrefixOWLOntologyFormat fromFormat)
          Copies the prefix from another ontology format into this format
 java.lang.String getDefaultPrefix()
          Gets the default prefix.
 IRI getIRI(java.lang.String iri)
          Gets the URI for a given prefix IRI.
 java.lang.String getPrefix(java.lang.String prefix)
          Gets the prefix that is bound to a particular prefix name.
 java.lang.String getPrefixIRI(IRI iri)
          Gets the prefix IRI given a IRI (URI).
 java.util.Map<java.lang.String,java.lang.String> getPrefixName2PrefixMap()
          Gets a map that maps prefix names to prefixes.
 java.util.Set<java.lang.String> getPrefixNames()
          Gets the prefix names that have a mapping in this prefix manager
 void setDefaultPrefix(java.lang.String namespace)
          Sets the default namespace.
 void setPrefix(java.lang.String prefixName, java.lang.String prefix)
          A convenience method to add a prefix name to prefix mapping
 
Methods inherited from class org.semanticweb.owlapi.model.OWLOntologyFormat
asPrefixOWLOntologyFormat, equals, getParameter, hashCode, isPrefixOWLOntologyFormat, setParameter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrefixOWLOntologyFormat

public PrefixOWLOntologyFormat()
Method Detail

setPrefix

public void setPrefix(java.lang.String prefixName,
                      java.lang.String prefix)
A convenience method to add a prefix name to prefix mapping

Parameters:
prefixName - The prefix name which maps to a prefix
prefix - The prefix

clearPrefixes

public void clearPrefixes()
Clears any previously set prefixes


copyPrefixesFrom

public void copyPrefixesFrom(PrefixOWLOntologyFormat fromFormat)
Copies the prefix from another ontology format into this format

Parameters:
fromFormat - The format that the prefixes should be copied from

getPrefixNames

public java.util.Set<java.lang.String> getPrefixNames()
Gets the prefix names that have a mapping in this prefix manager

Specified by:
getPrefixNames in interface PrefixManager
Returns:
A set of string representing the prefix names

setDefaultPrefix

public void setDefaultPrefix(java.lang.String namespace)
Sets the default namespace. This is equivalent to adding mapping from the empty string prefix to a namespace.

Parameters:
namespace - The namespace to be set.

containsPrefixMapping

public boolean containsPrefixMapping(java.lang.String prefix)
Description copied from interface: PrefixManager
Determines if this manager knows about a given prefix name and it contains a (non-null) mapping for the prefix.

Specified by:
containsPrefixMapping in interface PrefixManager
Parameters:
prefix - The prefix name to be tested for.
Returns:
true if the manager knows about this prefix and there is a non-null mapping for this prefix.

getDefaultPrefix

public java.lang.String getDefaultPrefix()
Description copied from interface: PrefixManager
Gets the default prefix. The default prefix is denoted by the prefix name ":"

Specified by:
getDefaultPrefix in interface PrefixManager
Returns:
The default prefix, or null if there is no default prefix.

getPrefixName2PrefixMap

public java.util.Map<java.lang.String,java.lang.String> getPrefixName2PrefixMap()
Description copied from interface: PrefixManager
Gets a map that maps prefix names to prefixes.

Specified by:
getPrefixName2PrefixMap in interface PrefixManager
Returns:
The map of prefix names to prefixes. Note that modifying the contents of this map will not change the prefix name - prefix mappings

getPrefix

public java.lang.String getPrefix(java.lang.String prefix)
Description copied from interface: PrefixManager
Gets the prefix that is bound to a particular prefix name. Note that specifying ":" corresponds to requesting the default prefix and will return the same result as a call to the getDefaultPrefix() method.

Specified by:
getPrefix in interface PrefixManager
Parameters:
prefix - The prefix name. A string that represents a prefix name of the prefix to be retrieved. Note that specifying ":" is the same as asking for the default prefix (see the getDefaultPrefix() method).
Returns:
The prefix, or null if there is no prefix name bound to this prefix, or the prefix name doesn't exist.

getIRI

public IRI getIRI(java.lang.String iri)
Description copied from interface: PrefixManager
Gets the URI for a given prefix IRI. The prefix IRI must have a prefix name that is registered with this manager, or a runtime exception will be thrown.

Specified by:
getIRI in interface PrefixManager
Parameters:
iri - The Prefix IRI
Returns:
The full IRI.

getPrefixIRI

public java.lang.String getPrefixIRI(IRI iri)
Description copied from interface: PrefixManager
Gets the prefix IRI given a IRI (URI).

Specified by:
getPrefixIRI in interface PrefixManager
Parameters:
iri - The IRI whose prefix it to be retrieved
Returns:
The prefix IRI for this IRI, or null if a prefix IRI cannot be generated.