For display, use localname(java.lang.String) and namespace(java.lang.String).
This follows Turtle, adds some pragmatic rulesm but does not escape
any characters. A URI is split never split before the last /
or last #, if present.
See splitpoint(java.lang.String) for more details.
This code form the machinery behind Node.getLocalName()
Node.getNameSpace() for URI Nodes.
localnameTTL(java.lang.String) is strict Turtle; it is the same local name as
before, but escaped if necessary.
The functions namespaceXML(java.lang.String) and localnameXML(java.lang.String)
apply the rules for XML qnames.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCalculate a localname - do not escape PN_LOCAL_ESC.static StringlocalnameTTL(String string) Calculate a localname - enforce legal Turtle escape PN_LOCAL_ESC, check for final '.' Use withnamespaceTTL(java.lang.String)static StringlocalnameXML(String string) Localname, according to XML qname rules.static StringReturn the 'namespace' (prefix) for a URI string.static StringnamespaceTTL(String string) Return the 'namespace' (prefix) for a URI string, legal for Turtle and goes withlocalnameTTL(java.lang.String)static StringnamespaceXML(String string) Namespace, according to XML qname rules.static intsplitpoint(String uri) Find the URI split point, return the index into the string that is the first character of a legal Turtle local name.static intSplit point, according to XML qname rules.
-
Constructor Details
-
SplitIRI
public SplitIRI()
-
-
Method Details
-
namespace
Return the 'namespace' (prefix) for a URI string. Use withlocalname(java.lang.String) -
localname
Calculate a localname - do not escape PN_LOCAL_ESC. This is not guaranteed to be legal Turtle. Use withnamespace(java.lang.String) -
namespaceTTL
Return the 'namespace' (prefix) for a URI string, legal for Turtle and goes withlocalnameTTL(java.lang.String) -
localnameTTL
Calculate a localname - enforce legal Turtle escape PN_LOCAL_ESC, check for final '.' Use withnamespaceTTL(java.lang.String) -
splitpoint
Find the URI split point, return the index into the string that is the first character of a legal Turtle local name.This is a pragmatic choice, not just finding the maximal point. For example, with escaping '/' can be included but that means
http://example/path/abccould split to givehttp://example/andpath/abc.Split URN's after ':'.
- Parameters:
uri- URI string- Returns:
- The split point, or -1 for "not found".
-
splitXML
Split point, according to XML qname rules. This is the longest NCName at the end of the uri. SeeUtil.splitNamespaceXML(java.lang.String). -
namespaceXML
Namespace, according to XML qname rules. Use withlocalnameXML(java.lang.String). -
localnameXML
Localname, according to XML qname rules.
-