java.lang.Object
org.apache.jena.riot.system.PrefixLib
Algorithms over
PrefixMap
to abbreviate and expand-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAbbreviate a uriStr, return the prefix and local parts, using aMap
of prefix string to URI string.Abbreviate a uriStr, return the prefix and local parts.static String
abbreviate
(PrefixMap prefixes, String uriStr) Abbreviate a uriStr, giving a string as a short form.static org.apache.jena.graph.Node
canonicalGraphName
(org.apache.jena.graph.Node graphName) Canonical name for graphsstatic String
canonicalPrefix
(String prefix) Remove ":" from a prefix if necessary to make it canonical.static String
Expand a prefixedName which must include a ':'static String
Expand a prefix, local name pair.static boolean
isSafeLocalPart
(String localName) Is a local name safe?
-
Constructor Details
-
PrefixLib
public PrefixLib()
-
-
Method Details
-
canonicalPrefix
Remove ":" from a prefix if necessary to make it canonical.- Parameters:
prefix
-- Returns:
- prefix, without colon.
-
canonicalGraphName
public static org.apache.jena.graph.Node canonicalGraphName(org.apache.jena.graph.Node graphName) Canonical name for graphs -
abbreviate
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<String,String> abbrev(PrefixMap prefixes, 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<String,String> abbrev(Map<String, String> prefixesMap, String uriStr, boolean turtleSafeLocalPart) Abbreviate a uriStr, return the prefix and local parts, using aMap
of 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
Expand a prefixedName which must include a ':' -
expand
Expand a prefix, local name pair. -
isSafeLocalPart
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
-