java.lang.Object
org.apache.jena.sparql.util.NodeFactoryExtra
Various convenience helper methods for converting to and from nodes
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.graph.Node
createLiteralNode
(String lex, String lang, String datatypeURI) Create a literal Node, when the datatype, if given, is a stringstatic org.apache.jena.graph.Node
Calendar to xsd:dateTime Nodestatic org.apache.jena.graph.Node
Calendar to xsd:date Nodestatic org.apache.jena.graph.Node
doubleToNode
(double value) double to Nodestatic org.apache.jena.graph.Node
floatToNode
(float value) float to Nodestatic org.apache.jena.graph.Node
intToNode
(int integer) int to Nodestatic org.apache.jena.graph.Node
intToNode
(long integer) long to Nodestatic double
nodeToDouble
(org.apache.jena.graph.Node node) Node to doublestatic float
nodeToFloat
(org.apache.jena.graph.Node node) Node to floatstatic int
nodeToInt
(org.apache.jena.graph.Node node) Node to intstatic long
nodeToLong
(org.apache.jena.graph.Node node) Node to longstatic org.apache.jena.graph.Node
Now, as xsd:dateTime Nodestatic org.apache.jena.graph.Node
Parse a node - with convenience prefix mappingstatic org.apache.jena.graph.Node
Parse a string into a node.static org.apache.jena.graph.Node
Calendar to xsd:time Nodestatic org.apache.jena.graph.Node
Today, as xsd:date Node
-
Constructor Details
-
NodeFactoryExtra
public NodeFactoryExtra()
-
-
Method Details
-
parseNode
Parse a node - with convenience prefix mappingAllows surrounding white space
- Parameters:
nodeString
- Node string to parse
-
parseNode
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 org.apache.jena.graph.Node createLiteralNode(String lex, String lang, String datatypeURI) Create a literal Node, when the datatype, if given, is a string -
nodeToInt
public static int nodeToInt(org.apache.jena.graph.Node node) Node to int- Parameters:
node
-- Returns:
- The int value or Integer.MIN_VALUE.
-
nodeToLong
public static long nodeToLong(org.apache.jena.graph.Node node) Node to long- Parameters:
node
-- Returns:
- The long value or Long.MIN_VALUE.
-
nodeToFloat
public static float nodeToFloat(org.apache.jena.graph.Node node) Node to float- Parameters:
node
-- Returns:
- The float value or Float.NaN
-
nodeToDouble
public static double nodeToDouble(org.apache.jena.graph.Node node) Node to double- Parameters:
node
-- Returns:
- The double value or Double.NaN
-
intToNode
public static org.apache.jena.graph.Node intToNode(int integer) int to Node- Parameters:
integer
-- Returns:
- An xsd:integer
-
intToNode
public static org.apache.jena.graph.Node intToNode(long integer) long to Node- Parameters:
integer
-- Returns:
- An xsd:integer
-
floatToNode
public static org.apache.jena.graph.Node floatToNode(float value) float to Node- Parameters:
value
-- Returns:
- An xsd:float
-
doubleToNode
public static org.apache.jena.graph.Node doubleToNode(double value) double to Node- Parameters:
value
-- Returns:
- An double
-
dateTimeToNode
Calendar to xsd:dateTime Node -
dateToNode
Calendar to xsd:date Node -
timeToNode
Calendar to xsd:time Node -
nowAsDateTime
public static org.apache.jena.graph.Node nowAsDateTime()Now, as xsd:dateTime Node -
todayAsDate
public static org.apache.jena.graph.Node todayAsDate()Today, as xsd:date Node
-