/** * @deprecated Use {@link NodeFactory#getType(String)} instead */ @Deprecated public static RDFDatatype getType( String s ) { return NodeFactory.getType(s) ; }
/** Cast a NodeValue to a date/time type (xsd dateTime, date, time, g*) according to F&O * <a href="http://www.w3.org/TR/xpath-functions/#casting-to-datetimes">17.1.5 Casting to date and time types</a> * Throws an exception on incorrect case. * * @throws ExprEvalTypeException */ public static NodeValue dateTimeCast(NodeValue nv, String typeURI) { RDFDatatype t = NodeFactory.getType(typeURI) ; return dateTimeCast(nv, t) ; }
/** * Returns a {@link Node} representation of a literal. * * @param literal the resource (as string in NT format). * @return a {@link Node} representation of a literal. */ public static Node asLiteral(final String literal) { if (literal.startsWith(START_LITERAL_CHAR)) { int endIndexOfValue = endIndexOfValue(literal); if (endIndexOfValue != -1) { final String literalValue = unescape(literal.substring(1, endIndexOfValue)); final int startIndexOfLanguage = literal.indexOf(LANGUAGE_MARKER, endIndexOfValue); final int startIndexOfDatatype = literal.indexOf(DATATYPE_MARKER, endIndexOfValue); if (startIndexOfLanguage != -1) { return NodeFactory.createLiteral( literalValue, literal.substring(startIndexOfLanguage + LANGUAGE_MARKER.length()), null); } else if (startIndexOfDatatype != -1) { return NodeFactory.createLiteral( literalValue, null, NodeFactory.getType(literal.substring(startIndexOfDatatype + DATATYPE_MARKER.length()))); } else { return NodeFactory.createLiteral(literalValue); } } } throw new IllegalArgumentException(literal); }
if ("Z".equals(dts.timezone) ) Node n = NodeFactory.createLiteral("PT0S", null, NodeFactory.getType(XSDDatatype.XSD+"#dayTimeDuration")) ; return NodeValue.makeNode(n) ; Node n = NodeFactory.createLiteral("PT0S", null, NodeFactory.getType(XSDDatatype.XSD+"#dayTimeDuration")) ; return NodeValue.makeNode(n) ; Node n = NodeFactory.createLiteral("-PT0S", null, NodeFactory.getType(XSDDatatype.XSD+"#dayTimeDuration")) ; return NodeValue.makeNode(n) ;
public static NodeValue strDatatype(NodeValue v1, NodeValue v2) { if ( !v1.isString() ) throw new ExprEvalException("Not a string (arg 1): " + v1) ; if ( !v2.isIRI() ) throw new ExprEvalException("Not an IRI (arg 2): " + v2) ; String lex = v1.asString() ; Node dt = v2.asNode() ; // Check? Node n = NodeFactory.createLiteral(lex, null, NodeFactory.getType(dt.getURI())) ; return NodeValue.makeNode(n) ; }
RDFDatatype dt = NodeFactory.getType(uriStr) ; return createTypedLiteral(str, dt, line, col) ;