我正在使用JessTab处理本体。我需要使用XMLSchema DateTime值操作,例如比较日期。
(defrule checIntervalStatus
(declare (salience 40))
(object (is-a http://www.w3.org/2006/time#Instant)
(OBJECT ?ie)
(http://www.w3.org/2006/time#inXSDDateTime ?iet)
)
(object (is-a http://www.w3.org/2006/time#Instant)
(OBJECT ?ib)
(http://www.w3.org/2006/time#inXSDDateTime ?ibt)
)
(object (is-a http://www.w3.org/2006/time#Interval)
(OBJECT ?oi)
(http://www.w3.org/2006/time#hasBeginning ?ib)
(http://www.w3.org/2006/time#hasEnd ?ie)
)
=>
(if (< ?ibt (slot-get http://.../sample.owl#q11767 http://www.w3.org/2006/time#inXSDDateTime))
then
(printout t "The interval " (instance-name ?oi) " has start time " ?ibt " and end time " ?iet crlf)
)
)
出现以下异常:
Jess reported an error in routine Value.javaObjectValue
while executing (< ?ibt (slot-get http://.../sample.owl#q11767 http://www.w3.org/2006/time#inXSDDateTime))
while executing (if (< ?ibt (slot-get http://.../sample.owl#q11767
http://www.w3.org/2006/time#inXSDDateTime))
then (printout t "The interval " (instance-name ?oi) " has start time " ?ibt " and end time " ?iet crlf))
while executing defrule MAIN::checkIntervalStatus
while executing (run).
Message: '"~@http://www.w3.org/2001/XMLSchema#dateTime 2015-04-08T02:54:45.217"' is a list, not a Java object.
Program text: ( run )
at line 20.
我尝试通过以下方式将XMLSchema日期时间解析为Java Datetime: (新日期(slot-get http://.../sample.owl#q11767 http://www.w3.org/2006/time#inXSDDateTime)) 但又有一个例外:
消息:未找到构造函数:(新日期(slot-get http://.../sample.owl#q11767 http://www.w3.org/2006/time#inXSDDateTime))。程序文字:(运行) 在第22行。 嵌套异常是:java.util.Date