Examples of ExprEvalTypeException


Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

        }
       
        if ( isDT(vs2) && vs1.equals(VSPACE_DURATION) )
            // Carefully ...
            return additionNV(nv2, nv1) ;
        throw new ExprEvalTypeException("Operator '+' : Undefined addition: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

            XMLGregorianCalendar cal1 = nv1.getDateTime() ;
            XMLGregorianCalendar cal2 = nv2.getDateTime() ;
            boolean isDef1 = ( cal1.getTimezone() == FIELD_UNDEFINED ) ;
            boolean isDef2 = ( cal2.getTimezone() == FIELD_UNDEFINED ) ;
            if ( ( isDef1 && !isDef2 ) || ( !isDef1 && isDef2 ) )
                throw new ExprEvalTypeException("Operator '-': can't substract timezone/non-timezone values") ;
            // Inspect duration and force to better type? xsd:dayTimeDuration
            return NodeValue.makeDuration(xsd_substract(cal1, cal2));
        }
       
        // Loose style. Subtract any duration to any date or time value.
        if ( vs1.equals(VSPACE_DATETIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDateTime(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_DATE) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDate(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_TIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeNode(result.toXMLFormat(), XSDDatatype.XSDtime) ;
            return r ;
        }
       
        throw new ExprEvalTypeException("Operator '-' : Undefined subtraction: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

        {
            // ONLY defined for dayTime.
            Duration dur = nv1.getDuration() ;
            boolean valid = XSDFuncOp.isDayTime(dur) ;
            if ( ! valid )
                throw new ExprEvalTypeException("Operator '*': only dayTime duration.  Got: "+nv1) ;
            BigDecimal dec = nv2.getDecimal() ;
            Duration r = dur.multiply(dec) ;
            Node n = NodeFactory.createLiteralNode(r.toString(), null, dtXSDdayTimeDuration) ;
            return NodeValue.makeNodeDuration(r, n) ;
        }
        throw new ExprEvalTypeException("Operator '*' : Undefined multiply: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

        ValueSpaceClassification vs2 = nv2.getValueSpace() ;
       
        if ( vs1.equals(VSPACE_NUM) && vs2.equals(VSPACE_NUM) )
            return XSDFuncOp.numDivide(nv1, nv2) ;

        throw new ExprEvalTypeException("Operator '/' : Undefined division: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

        }
       
        if ( isDT(vs2) && vs1.equals(VSPACE_DURATION) )
            // Carefully ...
            return additionNV(nv2, nv1) ;
        throw new ExprEvalTypeException("Operator '+' : Undefined addition: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

            XMLGregorianCalendar cal1 = nv1.getDateTime() ;
            XMLGregorianCalendar cal2 = nv2.getDateTime() ;
            boolean isDef1 = ( cal1.getTimezone() == FIELD_UNDEFINED ) ;
            boolean isDef2 = ( cal2.getTimezone() == FIELD_UNDEFINED ) ;
            if ( ( isDef1 && !isDef2 ) || ( !isDef1 && isDef2 ) )
                throw new ExprEvalTypeException("Operator '-': can't substract timezone/non-timezone values") ;
            // Inspect duration and force to better type? xsd:dayTimeDuration
            return NodeValue.makeDuration(xsd_substract(cal1, cal2));
        }
       
        // Loose style. Subtract any duration to any date or time value.
        if ( vs1.equals(VSPACE_DATETIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDateTime(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_DATE) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDate(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_TIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeNode(result.toXMLFormat(), XSDDatatype.XSDtime) ;
            return r ;
        }
       
        throw new ExprEvalTypeException("Operator '-' : Undefined subtraction: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

        {
            // ONLY defined for dayTime.
            Duration dur = nv1.getDuration() ;
            boolean valid = XSDFuncOp.isDayTime(dur) ;
            if ( ! valid )
                throw new ExprEvalTypeException("Operator '*': only dayTime duration.  Got: "+nv1) ;
            BigDecimal dec = nv2.getDecimal() ;
            Duration r = dur.multiply(dec) ;
            Node n = NodeFactoryExtra.createLiteralNode(r.toString(), null, dtXSDdayTimeDuration) ;
            return NodeValue.makeNodeDuration(r, n) ;
        }
        throw new ExprEvalTypeException("Operator '*' : Undefined multiply: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

        ValueSpaceClassification vs2 = nv2.getValueSpace() ;
       
        if ( vs1.equals(VSPACE_NUM) && vs2.equals(VSPACE_NUM) )
            return XSDFuncOp.numDivide(nv1, nv2) ;

        throw new ExprEvalTypeException("Operator '/' : Undefined division: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

        }
       
        if ( isDT(vs2) && vs1.equals(VSPACE_DURATION) )
            // Carefully ...
            return additionNV(nv2, nv1) ;
        throw new ExprEvalTypeException("Operator '+' : Undefined addition: "+nv1+" and "+nv2) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sparql.expr.ExprEvalTypeException

            XMLGregorianCalendar cal1 = nv1.getDateTime() ;
            XMLGregorianCalendar cal2 = nv2.getDateTime() ;
            boolean isDef1 = ( cal1.getTimezone() == FIELD_UNDEFINED ) ;
            boolean isDef2 = ( cal2.getTimezone() == FIELD_UNDEFINED ) ;
            if ( ( isDef1 && !isDef2 ) || ( !isDef1 && isDef2 ) )
                throw new ExprEvalTypeException("Operator '-': can't substract timezone/non-timezone values") ;
            // Inspect duration and force to better type? xsd:dayTimeDuration
            return NodeValue.makeDuration(xsd_substract(cal1, cal2));
        }
       
        // Loose style. Subtract any duration to any date or time value.
        if ( vs1.equals(VSPACE_DATETIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDateTime(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_DATE) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeDate(result) ;
            return r ;
        }
        if ( vs1.equals(VSPACE_TIME) && vs2.equals(VSPACE_DURATION) )
        {
            XMLGregorianCalendar cal = nv1.getDateTime() ;
            // add-negation
            XMLGregorianCalendar result = xsd_subtract(cal, nv2.getDuration()) ;
            NodeValue r = NodeValue.makeNode(result.toXMLFormat(), XSDDatatype.XSDtime) ;
            return r ;
        }
       
        throw new ExprEvalTypeException("Operator '-' : Undefined subtraction: "+nv1+" and "+nv2) ;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.