org.apache.jena.riot.system
Interface PrefixMap

All Known Implementing Classes:
FastAbbreviatingPrefixMap, PrefixMapBase, PrefixMapExtended, PrefixMapNull, PrefixMapStd, PrefixMapUnmodifiable, PrefixMapWrapper

public interface PrefixMap

Interface for lightweight prefix maps, this is similar to PrefixMapping from Jena Core but it omits any reverse lookup functionality.

The contract also does not require an implementation to do any validation unlike the Jena Core PrefixMapping which require validation of prefixes.

Implementations

For input dominated workloads where you are primarily calling expand(String) or expand(String, String) it is best to use the default implementation - PrefixMapStd. For output dominated workloads where you are primarily calling abbrev(String) or abbreviate(String) it is better to use the FastAbbreviatingPrefixMap implementation. See the javadoc for those classes for more explanation of their differences.


Method Summary
 Pair<String,String> abbrev(String uriStr)
          Abbreviate an IRI and return a pair of prefix and local parts, or null.
 String abbreviate(String uriStr)
          Abbreviate an IRI or return null
 void add(String prefix, org.apache.jena.iri.IRI iri)
          Add a prefix, overwrites any existing association
 void add(String prefix, String iriString)
          Add a prefix, overwrites any existing association
 boolean contains(String prefix)
          Gets whether the map contains a given prefix
 void delete(String prefix)
          Delete a prefix
 String expand(String prefixedName)
          Expand a prefix named, return null if it can't be expanded
 String expand(String prefix, String localName)
          Expand a prefix, return null if it can't be expanded
 Map<String,org.apache.jena.iri.IRI> getMapping()
          Return the underlying mapping, this is generally unsafe to modify and implementations may opt to return an unmodifiable view of the mapping if they wish
 Map<String,org.apache.jena.iri.IRI> getMappingCopy()
          Return a fresh copy of the underlying mapping, should be safe to modify unlike the mapping returned from getMapping()
 Map<String,String> getMappingCopyStr()
          Gets a fresh copy of the mapping with the IRIs translated into their strings
 boolean isEmpty()
          return whether the
 void putAll(Map<String,String> mapping)
          Add a prefix, overwrites any existing association
 void putAll(PrefixMap pmap)
          Add a prefix, overwrites any existing association
 void putAll(PrefixMapping pmap)
          Add a prefix, overwrites any existing association
 int size()
          Return the number of entries in the prefix map.
 

Method Detail

getMapping

Map<String,org.apache.jena.iri.IRI> getMapping()
Return the underlying mapping, this is generally unsafe to modify and implementations may opt to return an unmodifiable view of the mapping if they wish

Returns:
Underlying mapping

getMappingCopy

Map<String,org.apache.jena.iri.IRI> getMappingCopy()
Return a fresh copy of the underlying mapping, should be safe to modify unlike the mapping returned from getMapping()

Returns:
Copy of the mapping

getMappingCopyStr

Map<String,String> getMappingCopyStr()
Gets a fresh copy of the mapping with the IRIs translated into their strings

Returns:
Copy of the mapping

add

void add(String prefix,
         String iriString)
Add a prefix, overwrites any existing association

Parameters:
prefix - Prefix
iriString - Namespace IRI

add

void add(String prefix,
         org.apache.jena.iri.IRI iri)
Add a prefix, overwrites any existing association

Parameters:
prefix - Prefix
iri - Namespace IRI

putAll

void putAll(PrefixMap pmap)
Add a prefix, overwrites any existing association

Parameters:
pmap - Prefix Map

putAll

void putAll(PrefixMapping pmap)
Add a prefix, overwrites any existing association

Parameters:
pmap - Prefix Mapping

putAll

void putAll(Map<String,String> mapping)
Add a prefix, overwrites any existing association

Parameters:
mapping - A Map of prefix name to IRI string

delete

void delete(String prefix)
Delete a prefix

Parameters:
prefix - Prefix to delete

contains

boolean contains(String prefix)
Gets whether the map contains a given prefix

Parameters:
prefix - Prefix
Returns:
True if the prefix is contained in the map, false otherwise

abbreviate

String abbreviate(String uriStr)
Abbreviate an IRI or return null

Parameters:
uriStr - URI to abbreviate
Returns:
URI in prefixed name form if possible, null otherwise

abbrev

Pair<String,String> abbrev(String uriStr)
Abbreviate an IRI and return a pair of prefix and local parts, or null.

Parameters:
uriStr - URI string to abbreviate
Returns:
Pair of prefix and local name
See Also:
abbreviate(java.lang.String)

expand

String expand(String prefixedName)
Expand a prefix named, return null if it can't be expanded

Parameters:
prefixedName - Prefixed Name
Returns:
Expanded URI if possible, null otherwise

expand

String expand(String prefix,
              String localName)
Expand a prefix, return null if it can't be expanded

Parameters:
prefix - Prefix
localName - Local name
Returns:
Expanded URI if possible, null otherwise

isEmpty

boolean isEmpty()
return whether the

Returns:
boolean

size

int size()
Return the number of entries in the prefix map.

Returns:
Size of the prefix mapping


Licenced under the Apache License, Version 2.0