|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jena.riot.system.PrefixMapBase
org.apache.jena.riot.system.FastAbbreviatingPrefixMap
public class FastAbbreviatingPrefixMap
A prefix map implementation suited to output heavy workloads
This is an alternative implementation of the PrefixMap
interface, it is broadly similar to the default PrefixMapStd
implementation but is faster in output heavy workloads. If you are calling
the PrefixMap.expand(String)
or
PrefixMap.expand(String, String)
methods a lot then you
should be using this implementation.
To improve on output performance this implementation maintains a Trie
mapping namespace IRIs to their prefixes as well as a normal mapping.
Therefore IRI abbreviation can be done as an approximately O(1) operation in
the worst case . If you contrast this with the abbreviation performance of
the default PrefixMap
which is worst case O(n) then this is a
substantial saving in scenarios where you primarily use a prefix map for
output.
Generally speaking all other operations should be roughly equivalent to the
default PrefixMap
though the memory overhead of this implementation
will be marginally higher due to the extra information maintained in the
Trie
.
Constructor Summary | |
---|---|
FastAbbreviatingPrefixMap()
Create a new fast abbreviating prefix map |
|
FastAbbreviatingPrefixMap(PrefixMap pmap)
Create a new fast abbreviating prefix map which copies mappings from an existing map |
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 |
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 |
boolean |
isEmpty()
return whether the |
int |
size()
Return the number of entries in the prefix map. |
Methods inherited from class org.apache.jena.riot.system.PrefixMapBase |
---|
add, getMappingCopy, getMappingCopyStr, putAll, putAll, putAll, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FastAbbreviatingPrefixMap()
public FastAbbreviatingPrefixMap(PrefixMap pmap)
pmap
- Prefix MapMethod Detail |
---|
public Map<String,org.apache.jena.iri.IRI> getMapping()
PrefixMap
public void add(String prefix, org.apache.jena.iri.IRI iri)
PrefixMap
prefix
- Prefixiri
- Namespace IRIpublic void delete(String prefix)
PrefixMap
prefix
- Prefix to deletepublic boolean contains(String prefix)
PrefixMap
prefix
- Prefix
public String abbreviate(String uriStr)
PrefixMap
uriStr
- URI to abbreviate
public Pair<String,String> abbrev(String uriStr)
PrefixMap
uriStr
- URI string to abbreviate
PrefixMap.abbreviate(java.lang.String)
public String expand(String prefixedName)
PrefixMap
expand
in interface PrefixMap
expand
in class PrefixMapBase
prefixedName
- Prefixed Name
public String expand(String prefix, String localName)
PrefixMap
prefix
- PrefixlocalName
- Local name
public boolean isEmpty()
PrefixMap
public int size()
PrefixMap
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |