1)您可以定义使用Prolog 函子来定义这些规则。在您的情况下,您将定义。
;; Functors to add triples.
(<-- (a-- ?s ?p ?o)
;; Fails unless all parts ground.
(lispp (not (get-triple :s ?s :p ?p :o ?o)))
(lisp (add-triple ?s ?p ?o)))
;; Functors to seek news that should have theta annotation
(<-- (shouldHaveAnnotationTheta ?news)
(q- ?news !namespace:hasAnnotation !"Gamma"))
(<- (shouldHaveAnnotationTheta ?news)
(q- ?news !namespace:hasAnnotation !"Beta"))
2)然后运行以下prolog查询(以AGview为例)添加这些新闻语句
(select (?news)
(shouldHaveAnnotationTheta ?news)
(a-- ?news !namespace:hasAnnotation !"Theta")
(fail))
您可以阅读以下文档以了解此代码: