Search in sources :

Example 6 with XSDDateTime

use of org.apache.jena.datatypes.xsd.XSDDateTime in project jena by apache.

the class Now method bodyCall.

/**
     * This method is invoked when the builtin is called in a rule body.
     * @param args the array of argument values for the builtin, this is an array 
     * of Nodes, some of which may be Node_RuleVariables.
     * @param context an execution context giving access to other relevant data
     * @return return true if the buildin predicate is deemed to have succeeded in
     * the current environment
     */
@Override
public boolean bodyCall(Node[] args, int length, RuleContext context) {
    checkArgs(length, context);
    BindingEnvironment env = context.getEnv();
    Node now = NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral(new XSDDateTime(Calendar.getInstance())));
    return env.bind(args[0], now);
}
Also used : XSDDateTime(org.apache.jena.datatypes.xsd.XSDDateTime) Node(org.apache.jena.graph.Node) BindingEnvironment(org.apache.jena.reasoner.rulesys.BindingEnvironment)

Aggregations

XSDDateTime (org.apache.jena.datatypes.xsd.XSDDateTime)6 LiteralLabel (org.apache.jena.graph.impl.LiteralLabel)2 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1 Duration (javax.xml.datatype.Duration)1 DatatypeFormatException (org.apache.jena.datatypes.DatatypeFormatException)1 RDFDatatype (org.apache.jena.datatypes.RDFDatatype)1 XSDDatatype (org.apache.jena.datatypes.xsd.XSDDatatype)1 Node (org.apache.jena.graph.Node)1 InfGraph (org.apache.jena.reasoner.InfGraph)1 BindingEnvironment (org.apache.jena.reasoner.rulesys.BindingEnvironment)1 ARQInternalErrorException (org.apache.jena.sparql.ARQInternalErrorException)1