public class SplitIRI extends Object
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 machinary 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 and Description |
---|
SplitIRI() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isPN_LOCAL_ESC(char ch) |
static String |
localname(String string)
Calculate a localname - do not escape PN_LOCAL_ESC.
|
static String |
localnameTTL(String string)
Calculate a localname - enforce legal Turle
escape PN_LOCAL_ESC, check for final '.'
Use with
namespaceTTL(java.lang.String) |
static String |
localnameXML(String string)
Localname, according to XML qname rules.
|
static String |
namespace(String string)
Return the 'namespace' (prefix) for a URI string.
|
static String |
namespaceTTL(String string)
Return the 'namespace' (prefix) for a URI string,
legal for Turtle and goes with
localnameTTL(java.lang.String) |
static String |
namespaceXML(String string)
Namespace, according to XML qname rules.
|
static int |
splitpoint(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 int |
splitXML(String string)
Split point, according to XML rules.
|
public static String namespace(String string)
localname(java.lang.String)
public static String localname(String string)
namespace(java.lang.String)
public static String namespaceTTL(String string)
localnameTTL(java.lang.String)
public static String localnameTTL(String string)
namespaceTTL(java.lang.String)
public static boolean isPN_LOCAL_ESC(char ch)
public static int splitpoint(String uri)
This is a pragmatic choice, not just finding the maximal point.
For example, with escaping '/' can be included but that means
http://example/path/abc
could split to give http://example/
and path/abc
.
Split URN's after ':'.
uri
- URI stringpublic static int splitXML(String string)
public static String namespaceXML(String string)
localnameXML(java.lang.String)
.Licenced under the Apache License, Version 2.0