Package org.apache.jena.sparql.util
Class NodeFactoryExtra
- java.lang.Object
-
- org.apache.jena.sparql.util.NodeFactoryExtra
-
public class NodeFactoryExtra extends java.lang.ObjectVarious convenience helper methods for converting to and from nodes
-
-
Constructor Summary
Constructors Constructor Description NodeFactoryExtra()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NodecreateLiteralNode(java.lang.String lex, java.lang.String lang, java.lang.String datatypeURI)Create a literal Node, when the datatype, if given, is a stringstatic NodedateTimeToNode(java.util.Calendar c)Calendar to xsd:dateTime Nodestatic NodedateToNode(java.util.Calendar c)Calendar to xsd:date Nodestatic NodedoubleToNode(double value)double to Nodestatic NodefloatToNode(float value)float to Nodestatic NodeintToNode(int integer)int to Nodestatic NodeintToNode(long integer)long to Nodestatic doublenodeToDouble(Node node)Node to doublestatic floatnodeToFloat(Node node)Node to floatstatic intnodeToInt(Node node)Node to intstatic longnodeToLong(Node node)Node to longstatic NodenowAsDateTime()Now, as xsd:dateTime Nodestatic NodeparseNode(java.lang.String nodeString)Parse a node - with convenience prefix mappingstatic NodeparseNode(java.lang.String nodeString, PrefixMap pmap)Parse a string into a node.static NodetimeToNode(java.util.Calendar c)Calendar to xsd:time Nodestatic NodetodayAsDate()Today, as xsd:date Node
-
-
-
Method Detail
-
parseNode
public static Node parseNode(java.lang.String nodeString)
Parse a node - with convenience prefix mappingAllows surrounding white space
- Parameters:
nodeString- Node string to parse
-
parseNode
public static Node parseNode(java.lang.String nodeString, PrefixMap pmap)
Parse a string into a node.Allows surrounding white space.
- Parameters:
nodeString- Node string to parsepmap- Prefix Map, null to use no prefix mappings- Returns:
- Parsed Node
- Throws:
RiotException- Thrown if a valid node cannot be parsed
-
createLiteralNode
public static Node createLiteralNode(java.lang.String lex, java.lang.String lang, java.lang.String datatypeURI)
Create a literal Node, when the datatype, if given, is a string
-
nodeToInt
public static int nodeToInt(Node node)
Node to int- Parameters:
node-- Returns:
- The int value or Integer.MIN_VALUE.
-
nodeToLong
public static long nodeToLong(Node node)
Node to long- Parameters:
node-- Returns:
- The long value or Long.MIN_VALUE.
-
nodeToFloat
public static float nodeToFloat(Node node)
Node to float- Parameters:
node-- Returns:
- The float value or Float.NaN
-
nodeToDouble
public static double nodeToDouble(Node node)
Node to double- Parameters:
node-- Returns:
- The double value or Double.NaN
-
intToNode
public static Node intToNode(int integer)
int to Node- Parameters:
integer-- Returns:
- An xsd:integer
-
intToNode
public static Node intToNode(long integer)
long to Node- Parameters:
integer-- Returns:
- An xsd:integer
-
floatToNode
public static Node floatToNode(float value)
float to Node- Parameters:
value-- Returns:
- An xsd:float
-
doubleToNode
public static Node doubleToNode(double value)
double to Node- Parameters:
value-- Returns:
- An double
-
dateTimeToNode
public static Node dateTimeToNode(java.util.Calendar c)
Calendar to xsd:dateTime Node
-
dateToNode
public static Node dateToNode(java.util.Calendar c)
Calendar to xsd:date Node
-
timeToNode
public static Node timeToNode(java.util.Calendar c)
Calendar to xsd:time Node
-
nowAsDateTime
public static Node nowAsDateTime()
Now, as xsd:dateTime Node
-
todayAsDate
public static Node todayAsDate()
Today, as xsd:date Node
-
-