java.lang.Object
org.apache.jena.sparql.util.NodeFactoryExtra
Various convenience helper methods for converting to and from nodes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodecreateLiteralNode(String lex, String lang, String datatypeURI) Create a literal Node, when the datatype, if given, is a stringstatic NodeCalendar to xsd:dateTime Nodestatic NodeCalendar 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 intNode to intstatic longnodeToLong(Node node) Node to longstatic NodeNow, as xsd:dateTime Nodestatic NodeParse a node - with convenience prefix mappingstatic NodeParse a string into a node.static NodeCalendar to xsd:time Nodestatic NodeToday, 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
Create a literal Node, when the datatype, if given, is a string -
nodeToInt
Node to int- Parameters:
node-- Returns:
- The int value or Integer.MIN_VALUE.
-
nodeToLong
Node to long- Parameters:
node-- Returns:
- The long value or Long.MIN_VALUE.
-
nodeToFloat
Node to float- Parameters:
node-- Returns:
- The float value or Float.NaN
-
nodeToDouble
Node to double- Parameters:
node-- Returns:
- The double value or Double.NaN
-
intToNode
int to Node- Parameters:
integer-- Returns:
- An xsd:integer
-
intToNode
long to Node- Parameters:
integer-- Returns:
- An xsd:integer
-
floatToNode
float to Node- Parameters:
value-- Returns:
- An xsd:float
-
doubleToNode
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
Now, as xsd:dateTime Node -
todayAsDate
Today, as xsd:date Node
-