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 void
addPrefix(String prefix, String uri)
Adds a new prefix to be used.String
declarePrefixes()
Gets the prefix declaration string (e.g. for SPARQL) containing the currenly defined prefixes.org.eclipse.rdf4j.model.IRI
decodeIri(String shortIri)
Converts a prefixed string to an IRIString
encodeIri(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 void
initPrefixes()
-
-
-
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:
getPrefixUris
in 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:
declarePrefixes
in 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:
encodeIri
in 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:
decodeIri
in interfaceIRIDecoder
- Parameters:
shortIri
-- Returns:
- Throws:
IllegalArgumentException
- when the given IRI could not be decoded (has an invalid format)
-
-