public class Converters extends Object
| Modifier and Type | Method and Description |
|---|---|
static Node |
checkVar(Node n)
Converts any Node_Variable nodes into Var nodes.
|
static Node |
makeLiteral(Object o)
Creates a literal from an object.
|
static Node |
makeLiteral(String value,
String typeUri)
Creates a literal from the value and type URI.
|
static Node |
makeNode(Object o,
PrefixMapping pMapping)
Makes a node from an object while using the associated prefix mapping.
|
static Object |
makeNodeOrPath(Object o,
PrefixMapping pMapping)
Creates a Path or Node as appropriate.
|
static Collection<Node> |
makeValueNodes(Iterator<?> iter,
PrefixMapping prefixMapping)
Creates a collection of nodes from an iterator of Objects.
|
static Var |
makeVar(Object o)
Makes a Var from an object.
|
static String |
quoted(String q)
A convenience method to quote a string.
|
public static Node checkVar(Node n)
n - the node to checkpublic static Node makeLiteral(Object o)
o - the object to convert.IllegalArgumentException - if object type is not registered.public static Node makeLiteral(String value, String typeUri)
getLiteralValue() on the returned node
will return a proper object.
getLiteralValue() on the returned node will throw DatatypeFormatException.
Note that if JenaParameters.enableEagerLiteralValidation is true the
DatatypeFormatException will be thrown by this method.
value - the value for the literaltypeUri - the type URI for the literal node.DatatypeFormatException - on errors noted abovepublic static Node makeNode(Object o, PrefixMapping pMapping)
o - The object to convert (may be null).pMapping - The prefix mapping to use for prefix resolution.makeLiteral(Object)public static Object makeNodeOrPath(Object o, PrefixMapping pMapping)
o - the object that should be interpreted as a path or a node.pMapping - the prefix mapping to resolve path or node withmakeLiteral(Object)public static Var makeVar(Object o) throws ARQInternalErrorException
o - The object to convert.ARQInternalErrorExceptionpublic static String quoted(String q)
q - the string to quote.
Will use single quotes if there are no single quotes in the string or if the
double quote is before the single quote in the string.
Will use double quote otherwise.public static Collection<Node> makeValueNodes(Iterator<?> iter, PrefixMapping prefixMapping)
iter - the iterator of objects, may be null or empty.prefixMapping - the PrefixMapping to use when nodes are created.Licensed under the Apache License, Version 2.0