public static NodeValue makeNodeString(String string) { NodeValue nv = makeNode(string, null, (String)null) ; return nv ; }
public static NodeValue makeNodeDateTime(String lexicalForm) { NodeValue nv = makeNode(lexicalForm, XSDdateTime) ; return nv ; }
public static NodeValue dtGetHours(NodeValue nv) { DateTimeStruct dts = parseTime(nv) ; return NodeValue.makeNode(dts.hour, XSDDatatype.XSDinteger) ; }
public static NodeValue makeNodeFloat(String lexicalForm) { NodeValue nv = makeNode(lexicalForm, null, XSD.xdouble.getURI()) ; return nv ; }
public static NodeValue makeNodeDecimal(String lexicalForm) { NodeValue nv = makeNode(lexicalForm, null, XSD.decimal.getURI()) ; return nv ; }
public static NodeValue makeNodeDateTime(Calendar date) { //XSDDateTime dt = new XSDDateTime(date) ; String lex = Utils.calendarToXSDDateTimeString(date) ; NodeValue nv = makeNode(lex, XSDDatatype.XSDdateTime) ; return nv ; }
public static NodeValue dtGetSeconds(NodeValue nv) { DateTimeStruct dts = parseTime(nv) ; return NodeValue.makeNode(dts.second, XSDDatatype.XSDdecimal) ; }
public static NodeValue makeNode(String lexicalForm, XSDDatatype dtype) { Node n = com.hp.hpl.jena.graph.NodeFactory.createLiteral(lexicalForm, null, dtype) ; NodeValue nv = NodeValue.makeNode(n) ; return nv ; }
public static NodeValue makeNodeInteger(String lexicalForm) { NodeValue nv = makeNode(lexicalForm, null, XSDinteger.getURI()) ; return nv ; }
public static NodeValue makeNodeFloat(String lexicalForm) { NodeValue nv = makeNode(lexicalForm, null, XSDdouble.getURI()) ; return nv ; }
public static NodeValue makeNodeDouble(String lexicalForm) { NodeValue nv = makeNode(lexicalForm, null, XSDdouble.getURI()) ; return nv ; }
public static NodeValue makeNodeDate(Calendar date) { String lex = Utils.calendarToXSDDateString(date) ; NodeValue nv = makeNode(lex, XSDdate) ; return nv ; }
static private float asFloat(Node n) { if ( n == null ) return Float.MIN_VALUE ; NodeValue nv = NodeValue.makeNode(n) ; if ( nv.isFloat() ) return nv.getFloat() ; return Float.MIN_VALUE ; }
protected NodeValue cast(String s, NodeValue nv, XSDDatatype castType2) { // Plain cast. if ( ! castType.isValid(s) ) throw new ExprEvalException("CastXSD: Not a valid literal form: "+s) ; // Unfortunately, validity testing happens in NodeValue.makeNode as well. return NodeValue.makeNode(s, castType) ; } }
/** * {@inheritDoc} */ @Override public NodeValue exec(NodeValue v) { Node n = v.asNode(); return NodeValue.makeNode(Quadruple.removeMetaInformation(n)); }
public static NodeValue uuid() { String str = "urn:uuid:" + uuidString() ; Node n = NodeFactory.createURI(str) ; return NodeValue.makeNode(n) ; }
static NodeValue eval(Var v, Binding binding, FunctionEnv env) { if ( binding == null ) throw new VariableNotBoundException("Not bound: (no binding): "+v) ; Node nv = binding.get(v) ; if ( nv == null ) throw new VariableNotBoundException("Not bound: variable "+v) ; // Wrap as a NodeValue. return NodeValue.makeNode(nv) ; }
@Override public Expr applyNodeTransform(NodeTransform transform) { Node node = transform.convert(varNode) ; if ( Var.isVar(node)) return new ExprVar(Var.alloc(node)) ; return NodeValue.makeNode(node) ; }
public static NodeValue dtGetDay(NodeValue nv) { if ( nv.isDateTime() || nv.isDate() || nv.isGMonthDay() || nv.isGDay() ) { DateTimeStruct dts = parseAnyDT(nv) ; return NodeValue.makeNode(dts.day, XSDDatatype.XSDinteger) ; } throw new ExprEvalException("Not a month datatype") ; }