use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class DatasetAssemblerTDB method make.
static Dataset make(Resource root) {
if (!exactlyOneProperty(root, pLocation))
throw new AssemblerException(root, "No location given");
String dir = getStringValue(root, pLocation);
Location loc = Location.create(dir);
DatasetGraph dsg = TDBFactory.createDatasetGraph(loc);
if (root.hasProperty(pUnionDefaultGraph)) {
Node b = root.getProperty(pUnionDefaultGraph).getObject().asNode();
NodeValue nv = NodeValue.makeNode(b);
if (nv.isBoolean())
dsg.getContext().set(TDB.symUnionDefaultGraph, nv.getBoolean());
else
Log.warn(DatasetAssemblerTDB.class, "Failed to recognize value for union graph setting (ignored): " + b);
}
/*
<r> rdf:type tdb:DatasetTDB ;
tdb:location "dir" ;
//ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "10000" ] ;
tdb:unionGraph true ; # or "true"
*/
AssemblerUtils.setContext(root, dsg.getContext());
return DatasetFactory.wrap(dsg);
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class nowtz method exec.
@Override
public NodeValue exec(List<NodeValue> args, FunctionEnv functionEnv) {
Context cxt = functionEnv.getContext();
if (cxt.isDefined(symNowTz)) {
NodeValue nvx = cxt.get(symNowTz);
return nvx;
}
NodeValue nvx = execAdjust(functionEnv);
// String formattedDate = fromQueryTime(cxt);
// NodeValue nvx = NodeValue.makeNode(formattedDate, null, XSD.dateTime.getURI());
cxt.set(symNowTz, nvx);
return nvx;
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class eval method exec.
/**
* Processes unevaluated arguments
*/
@Override
public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
E_Call e = new E_Call(args);
NodeValue nv = e.evalSpecial(binding, env);
if (nv != null)
return nv;
return e.eval(binding, env);
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class FN_StrSubstring method exec.
@Override
public NodeValue exec(List<NodeValue> args) {
if (args.size() != 2 && args.size() != 3)
throw new ExprEvalException("substring: Wrong number of arguments: " + args.size() + " : [wanted 2 or 3]");
NodeValue v1 = args.get(0);
NodeValue v2 = args.get(1);
NodeValue v3 = null;
if (args.size() == 3) {
v3 = args.get(2);
return XSDFuncOp.substring(v1, v2, v3);
}
return XSDFuncOp.substring(v1, v2);
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class bnode method exec.
@Override
public NodeValue exec(NodeValue v) {
Node n = v.asNode();
if (!n.isBlank())
throw new ExprEvalException("bnode: not a blank node");
NodeValue nv = NodeValue.makeString(n.getBlankNodeId().getLabelString());
return nv;
}
Aggregations