我正在使用 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 日期时间:(new Date (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