@Override public Node handle(Node node, String lexicalForm, RDFDatatype datatype) { return NodeFactory.createLiteral(lexicalForm) ; } } ;
@Override public Node handle(Node node, String lexicalForm, RDFDatatype datatype) { return NodeFactory.createLiteral(lexicalForm, "", datatype) ; } } ;
/** make a literal node with the specified literal value * @deprecated Use {@link NodeFactory#createLiteral(LiteralLabel)} instead*/ @Deprecated public static Node createLiteral( LiteralLabel lit ) { return NodeFactory.createLiteral(lit) ; }
/** make a literal with specified language and XMLishness. _lit_ must *not* be null. @param isXml If true then lit is exclusive canonical XML of type rdf:XMLLiteral, and no checking will be invoked. * @deprecated Use {@link NodeFactory#createLiteral(String,String,boolean)} instead */ @Deprecated public static Node createLiteral( String lit, String lang, boolean isXml ) { return NodeFactory.createLiteral(lit, lang, isXml) ; }
@Override public Node handle(Node node, String lexicalForm, RDFDatatype datatype) { double d = Double.parseDouble(lexicalForm) ; String lex2 = fmtFloatingPoint.format(d) ; if ( lex2.equals(lexicalForm) ) return node ; return NodeFactory.createLiteral(lex2, null, datatype) ; } } ;
/** make a literal with specified language and XMLishness. _lit_ must *not* be null. @param isXml If true then lit is exclusive canonical XML of type rdf:XMLLiteral, and no checking will be invoked. */ public static Node createLiteral( String lit, String lang, boolean isXml ) { if (lit == null) throw new NullPointerException ( "null for literals has been illegal since Jena 2.0" ); return createLiteral( LiteralLabelFactory.create( lit, lang, isXml ) ); }
@Override protected Node makeNode() { int s = decimal.scale() ; return NodeFactory.createLiteral(Utils.stringForm(decimal), null, 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 Node nowAsDateTime() { String lex = Utils.nowAsXSDDateTimeString() ; return com.hp.hpl.jena.graph.NodeFactory.createLiteral(lex, null, XSDDatatype.XSDdateTime) ; }
/** * Creates a random literal node whose length is the number of characters * specified. * * @param length * the length of random string to create. * * @return the randomly generated node. */ public static Node randomLiteral(int length) { return NodeFactory.createLiteral(StringGenerator.randomPrintableAscii(length)); }
/** * Creates a Jena {@link Node_Literal} representing the subscription id. * * @return a Jena {@link Node_Literal} representing the subscription id. */ public Node toJenaNode() { return NodeFactory.createLiteral(super.toString()); }
public static Node createLiteralNode(String lex, String lang, String datatypeURI) { if ( datatypeURI != null && datatypeURI.equals("") ) datatypeURI = null ; if ( lang != null && lang.equals("") ) lang = null ; RDFDatatype dType = null ; if ( datatypeURI != null ) dType = TypeMapper.getInstance().getSafeTypeByName(datatypeURI); Node n = com.hp.hpl.jena.graph.NodeFactory.createLiteral(lex, lang, dType) ; return n ; }
public static NodeValue makeDateTime(XMLGregorianCalendar cal) { String lex = cal.toXMLFormat() ; Node node = com.hp.hpl.jena.graph.NodeFactory.createLiteral(lex, XSDdateTime) ; return new NodeValueDT(lex, node) ; }
private static Quadruple createVarNamesQuadruple(Node originalSubscriptionURI, Node subSubscriptionURI, AtomicQuery atomicQuery) { return new Quadruple( originalSubscriptionURI, subSubscriptionURI, SUBSUBSCRIPTION_VAR_NAMES_NODE, NodeFactory.createLiteral(atomicQuery.getVarNamesAsString())); }
/** * Build a typed literal from its value form. * * @param value the value of the literal * @param dtype the type of the literal, null for old style "plain" literals */ @Override public Literal createTypedLiteral(Object value, RDFDatatype dtype) { LiteralLabel ll = LiteralLabelFactory.create(value, "", dtype); return new LiteralImpl( NodeFactory.createLiteral(ll), this ); }
private static Node convert(ALiteral lit) { String dtURI = lit.getDatatypeURI(); if (dtURI == null) return NodeFactory.createLiteral(lit.toString(), lit.getLang(), false); if (lit.isWellFormedXML()) { return NodeFactory.createLiteral(lit.toString(), null, true); } RDFDatatype dt = TypeMapper.getInstance().getSafeTypeByName(dtURI); return NodeFactory.createLiteral(lit.toString(), null, dt); }
private static Node convert(ALiteral lit) { String dtURI = lit.getDatatypeURI(); if (dtURI == null) return NodeFactory.createLiteral(lit.toString(), lit.getLang(), false); if (lit.isWellFormedXML()) { return NodeFactory.createLiteral(lit.toString(), null, true); } RDFDatatype dt = TypeMapper.getInstance().getSafeTypeByName(dtURI); return NodeFactory.createLiteral(lit.toString(), null, dt); }
public static NodeValue strLang(NodeValue v1, NodeValue v2) { if ( !v1.isString() ) throw new ExprEvalException("Not a string (arg 1): " + v1) ; if ( !v2.isString() ) throw new ExprEvalException("Not a string (arg 2): " + v2) ; String lex = v1.asString() ; String lang = v2.asString() ; // Check? Node n = NodeFactory.createLiteral(lex, lang, null) ; 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) ; }
@Override public Expr evaluate(NodeTest nodeTest, ElementGroup elementGroup, Var var, LDPathEvaluatorConfiguration evaluatorConfiguration) { PathEqualityTest pathEqualityTest = (PathEqualityTest) nodeTest; Var tmpVar = LDPathEvaluator.evaluate(pathEqualityTest.getPath(), elementGroup, var, evaluatorConfiguration); if(pathEqualityTest.getNode() instanceof org.openrdf.model.impl.LiteralImpl) { return new E_Equals(new ExprVar(tmpVar.asNode()), new NodeValueNode(NodeFactory.createLiteral(((LiteralImpl) pathEqualityTest.getNode()).getLabel().toString()))); } else { return new E_Equals(new ExprVar(tmpVar.asNode()), new NodeValueNode(NodeFactory.createURI(pathEqualityTest.getNode().toString()))); } } }