|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.nsdl.mptstore.util.NTriplesUtil
public abstract class NTriplesUtil
Utility for parsing, validating, and printing strings in N-Triples format.
Method Summary | |
---|---|
static java.lang.String |
consumeURIReference(java.io.Reader reader,
int pos)
Consume the next URI reference. |
static int |
consumeWhitespace(java.io.Reader reader,
int pos)
Move the reader to the first non-whitespace character and return the number of whitespaces encountered. |
static java.lang.String |
escapeLiteralValue(java.lang.String s)
Escape a string to N-Triples literal format. |
static Literal |
parseLiteral(java.lang.String s)
Parse an RDF literal in N-Triples format. |
static Node |
parseNode(java.lang.String ntNode)
Parse an RDF node in N-Triples format. |
static ObjectNode |
parseObject(java.lang.String ntObject)
Parse an RDF object in N-Triples format. |
static PredicateNode |
parsePredicate(java.lang.String ntPredicate)
Parse an RDF predicate in N-Triples format. |
static SubjectNode |
parseSubject(java.lang.String ntSubject)
Parse an RDF subject in N-Triples format. |
static Triple |
parseTriple(java.lang.String ntTriple)
Parse an RDF triple in N-Triples format. |
static URIReference |
parseURIReference(java.lang.String s)
Parse an RDF URI reference in N-Triples format. |
static java.lang.String |
unescapeLiteralValue(java.lang.String s)
Unescape an N-Triples-escaped string. |
static void |
validateLanguage(java.lang.String language)
Validate the given language tag according to RFC3066. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String consumeURIReference(java.io.Reader reader, int pos) throws java.io.IOException, java.text.ParseException
reader
- the reader to get characters from.pos
- the current position in the overall input.
java.io.IOException
- if there's an I/O error reading the input.
java.text.ParseException
- if the reader is exhausted before the terminal
is encountered.public static int consumeWhitespace(java.io.Reader reader, int pos) throws java.io.IOException, java.text.ParseException
reader
- the reader.pos
- the current position in the reader.
java.io.IOException
- if there is an error reading.
java.text.ParseException
- if the first character is not a whitespace or
EOF is reached before a non-whitespace char.public static Triple parseTriple(java.lang.String ntTriple) throws java.text.ParseException
ntTriple
- the input string.
java.text.ParseException
- if the input syntax is incorrectpublic static SubjectNode parseSubject(java.lang.String ntSubject) throws java.text.ParseException
ntSubject
- the input string.
java.text.ParseException
- if the input syntax is incorrectpublic static PredicateNode parsePredicate(java.lang.String ntPredicate) throws java.text.ParseException
ntPredicate
- the input string.
java.text.ParseException
- if the input syntax is incorrectpublic static ObjectNode parseObject(java.lang.String ntObject) throws java.text.ParseException
ntObject
- the input string.
java.text.ParseException
- if the input syntax is incorrectpublic static Node parseNode(java.lang.String ntNode) throws java.text.ParseException
ntNode
- the input string.
java.text.ParseException
- if the input syntax is incorrectpublic static Literal parseLiteral(java.lang.String s) throws java.text.ParseException
s
- the input string.
java.text.ParseException
- if the input syntax is incorrectpublic static URIReference parseURIReference(java.lang.String s) throws java.text.ParseException
s
- the input string.
java.text.ParseException
- if the input syntax is incorrectpublic static java.lang.String unescapeLiteralValue(java.lang.String s) throws java.text.ParseException
s
- The input string.
java.text.ParseException
- if the input syntax is incorrectpublic static java.lang.String escapeLiteralValue(java.lang.String s)
s
- The input string.
public static void validateLanguage(java.lang.String language) throws java.text.ParseException
LANGUAGE-TAG = PRIMARY-SUBTAG ("-" SUBTAG)* PRIMARY-SUBTAG = 1-8(ALPHA) SUBTAG = 1-8(ALPHA/DIGIT)
language
- the language to validate.
java.text.ParseException
- if the language is syntactically invalid.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |