Package cz.vutbr.fit.layout.impl
Class DefaultIRIDecoder
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.DefaultIRIDecoder
-
- All Implemented Interfaces:
IRIDecoder
- Direct Known Subclasses:
RDFIRIDecoder
public class DefaultIRIDecoder extends Object implements IRIDecoder
A default implementation of IRI decoder.- Author:
- burgetr
-
-
Constructor Summary
Constructors Constructor Description DefaultIRIDecoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPrefix(String prefix, String uri)Adds a new prefix to be used.StringdeclarePrefixes()Gets the prefix declaration string (e.g. for SPARQL) containing the currenly defined prefixes.org.eclipse.rdf4j.model.IRIdecodeIri(String shortIri)Converts a prefixed string to an IRIStringencodeIri(org.eclipse.rdf4j.model.IRI iri)Converts an IRI to a prefixed string.Map<String,String>getPrefixUris()Gets a map that assigns uris to prefix names.Map<String,String>getUriPrefixes()Gets a map that assigns prefix names to uris.protected voidinitPrefixes()
-
-
-
Method Detail
-
initPrefixes
protected void initPrefixes()
-
addPrefix
public void addPrefix(String prefix, String uri)
Adds a new prefix to be used.- Parameters:
prefix- the prefix stringuri- the corresponding IRI prefix
-
getPrefixUris
public Map<String,String> getPrefixUris()
Gets a map that assigns uris to prefix names.- Specified by:
getPrefixUrisin interfaceIRIDecoder- Returns:
- the map
-
getUriPrefixes
public Map<String,String> getUriPrefixes()
Gets a map that assigns prefix names to uris.- Returns:
- the map
-
declarePrefixes
public String declarePrefixes()
Gets the prefix declaration string (e.g. for SPARQL) containing the currenly defined prefixes.- Specified by:
declarePrefixesin interfaceIRIDecoder- Returns:
- the prefix declaration string
-
encodeIri
public String encodeIri(org.eclipse.rdf4j.model.IRI iri)
Converts an IRI to a prefixed string.- Specified by:
encodeIriin interfaceIRIDecoder- Parameters:
iri-- Returns:
-
decodeIri
public org.eclipse.rdf4j.model.IRI decodeIri(String shortIri) throws IllegalArgumentException
Converts a prefixed string to an IRI- Specified by:
decodeIriin interfaceIRIDecoder- Parameters:
shortIri-- Returns:
- Throws:
IllegalArgumentException- when the given IRI could not be decoded (has an invalid format)
-
-