Package org.apache.jena.riot.system
Class PrefixLib
- java.lang.Object
-
- org.apache.jena.riot.system.PrefixLib
-
public class PrefixLib extends java.lang.ObjectAlgorithms overPrefixMapto abbreviate and expand
-
-
Constructor Summary
Constructors Constructor Description PrefixLib()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.jena.atlas.lib.Pair<java.lang.String,java.lang.String>abbrev(java.util.Map<java.lang.String,java.lang.String> prefixesMap, java.lang.String uriStr, boolean turtleSafeLocalPart)Abbreviate a uriStr, return the prefix and local parts, using aMapof prefix string to URI string.static org.apache.jena.atlas.lib.Pair<java.lang.String,java.lang.String>abbrev(PrefixMap prefixes, java.lang.String uriStr)Abbreviate a uriStr, return the prefix and local parts.static java.lang.Stringabbreviate(PrefixMap prefixes, java.lang.String uriStr)Abbreviate a uriStr, giving a string as a short form.static NodecanonicalGraphName(Node graphName)Canonical name for graphsstatic java.lang.StringcanonicalPrefix(java.lang.String prefix)Remove ":" from a prefix if necessary to make it canonical.static java.lang.Stringexpand(PrefixMap prefixes, java.lang.String prefixedName)Expand a prefixedName which must include a ':'static java.lang.Stringexpand(PrefixMap prefixes, java.lang.String prefix, java.lang.String localName)Expand a prefix, local name pair.static booleanisSafeLocalPart(java.lang.String localName)Is a local name safe? This is a partial, fast check for Turtle-like local names.
-
-
-
Method Detail
-
canonicalPrefix
public static java.lang.String canonicalPrefix(java.lang.String prefix)
Remove ":" from a prefix if necessary to make it canonical.- Parameters:
prefix-- Returns:
- prefix, without colon.
-
abbreviate
public static java.lang.String abbreviate(PrefixMap prefixes, java.lang.String uriStr)
Abbreviate a uriStr, giving a string as a short form. If not possible return null. This does not guarantee that the result is suitable for all RDF syntaxes. Further checking for the rules of a particular syntax are necessary.
-
abbrev
public static org.apache.jena.atlas.lib.Pair<java.lang.String,java.lang.String> abbrev(PrefixMap prefixes, java.lang.String uriStr)
Abbreviate a uriStr, return the prefix and local parts. This does not guarantee that the result is suitable for all RDF syntaxes.
-
abbrev
public static org.apache.jena.atlas.lib.Pair<java.lang.String,java.lang.String> abbrev(java.util.Map<java.lang.String,java.lang.String> prefixesMap, java.lang.String uriStr, boolean turtleSafeLocalPart)Abbreviate a uriStr, return the prefix and local parts, using aMapof prefix string to URI string. This does not guarantee that the result is suitable for all RDF syntaxes. In addition, perform a fast check for legal turtle local parts usingisSafeLocalPart(java.lang.String). This covers the majority of real work cases and allows the code to find a probably-legal abbrev pair if an illegal one is found. (In practice, illegal local names arise only when one prefix URI is a substring of another.)
-
expand
public static java.lang.String expand(PrefixMap prefixes, java.lang.String prefixedName)
Expand a prefixedName which must include a ':'
-
expand
public static java.lang.String expand(PrefixMap prefixes, java.lang.String prefix, java.lang.String localName)
Expand a prefix, local name pair.
-
isSafeLocalPart
public static boolean isSafeLocalPart(java.lang.String localName)
Is a local name safe? This is a partial, fast check for Turtle-like local names.- Parameters:
localName- Local name- Returns:
- True if safe, false otherwise
-
-