Package org.apache.jena.riot.system
Interface PrefixMap
-
- All Known Implementing Classes:
PrefixMapAdapter,PrefixMapBase,PrefixMapNull,PrefixMapProxy,PrefixMapSink,PrefixMapStd,PrefixMapUnmodifiable,PrefixMapWrapper,PrefixMapZero
public interface PrefixMapInterface for lightweight prefix maps, this is similar toPrefixMappingfrom 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
PrefixMappingwhich requires validation of prefixes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.jena.atlas.lib.Pair<java.lang.String,java.lang.String>abbrev(java.lang.String uriStr)Abbreviate an IRI and return a pair of prefix and local parts, or null.java.lang.Stringabbreviate(java.lang.String uriStr)Abbreviate an IRI or return nullvoidadd(java.lang.String prefix, java.lang.String iriString)Add a prefix, overwrites any existing associationvoidclear()Clear all prefixes.booleancontainsPrefix(java.lang.String prefix)Gets whether the map contains a given prefixvoiddelete(java.lang.String prefix)Delete a prefixjava.lang.Stringexpand(java.lang.String prefixedName)Expand a prefix named, return null if it can't be expandedjava.lang.Stringexpand(java.lang.String prefix, java.lang.String localName)Expand a prefix, return null if it can't be expandedvoidforEach(java.util.function.BiConsumer<java.lang.String,java.lang.String> action)Apply aBiConsumer<String, String> to each entry in the PrefixMap.java.lang.Stringget(java.lang.String prefix)Return the URI for the prefix, or null if there is no entry for this prefix.java.util.Map<java.lang.String,java.lang.String>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.java.util.Map<java.lang.String,java.lang.String>getMappingCopy()Return a fresh copy of the underlying mapping, should be safe to modify unlike the mapping returned fromgetMapping()booleanisEmpty()Return whether the prefix map is empty or not.voidputAll(java.util.Map<java.lang.String,java.lang.String> mapping)Add a prefix, overwrites any existing associationvoidputAll(PrefixMap pmap)Add a prefix, overwrites any existing associationvoidputAll(PrefixMapping pmap)Add a prefix, overwrites any existing associationintsize()Return the number of entries in the prefix map.java.util.stream.Stream<PrefixEntry>stream()Return a stream ofPrefixEntry, pairs of prefix and URI.
-
-
-
Method Detail
-
get
java.lang.String get(java.lang.String prefix)
Return the URI for the prefix, or null if there is no entry for this prefix.
-
getMapping
java.util.Map<java.lang.String,java.lang.String> 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
- See Also:
getMappingCopy()
-
getMappingCopy
java.util.Map<java.lang.String,java.lang.String> getMappingCopy()
Return a fresh copy of the underlying mapping, should be safe to modify unlike the mapping returned fromgetMapping()- Returns:
- Copy of the mapping
-
forEach
void forEach(java.util.function.BiConsumer<java.lang.String,java.lang.String> action)
Apply aBiConsumer<String, String> to each entry in the PrefixMap.
-
stream
java.util.stream.Stream<PrefixEntry> stream()
Return a stream ofPrefixEntry, pairs of prefix and URI.
-
add
void add(java.lang.String prefix, java.lang.String iriString)Add a prefix, overwrites any existing association- Parameters:
prefix- PrefixiriString- 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(java.util.Map<java.lang.String,java.lang.String> mapping)
Add a prefix, overwrites any existing association- Parameters:
mapping- A Map of prefix name to IRI string
-
delete
void delete(java.lang.String prefix)
Delete a prefix- Parameters:
prefix- Prefix to delete
-
clear
void clear()
Clear all prefixes.
-
containsPrefix
boolean containsPrefix(java.lang.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
java.lang.String abbreviate(java.lang.String uriStr)
Abbreviate an IRI or return null- Parameters:
uriStr- URI to abbreviate- Returns:
- URI in prefixed name form if possible, null otherwise
-
abbrev
org.apache.jena.atlas.lib.Pair<java.lang.String,java.lang.String> abbrev(java.lang.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
java.lang.String expand(java.lang.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
java.lang.String expand(java.lang.String prefix, java.lang.String localName)Expand a prefix, return null if it can't be expanded- Parameters:
prefix- PrefixlocalName- Local name- Returns:
- Expanded URI if possible, null otherwise
-
isEmpty
boolean isEmpty()
Return whether the prefix map is empty or not.
-
size
int size()
Return the number of entries in the prefix map.
-
-