(in-package :cl-user) ;; examples of bnode usage ;; should be owl full (with-ontology foo () ((object-property !has) (individual !a (value !has !blank:a)) (individual !b (value !has !blank:a))) (print-db (get-owl-species (kb foo))) (print-db (check-abox-consistency (kb foo))) (sparql '(:select (?a) () (?a !has :_b)) :kb foo :trace "Has bnodes bound to variables?" :use-reasoner :pellet)) ;; should be owl-full (with-ontology foo () ((object-property !R) (object-property !S) (individual !blank:a (value !R !blank:b)) (individual !blank:b (value !S !blank:a))) (let ((kb (kb foo))) (print-db (get-owl-species kb)) (print-db (check-abox-consistency kb)) (sparql '(:select (?a ?b) () (?a !R ?b)) :kb kb :trace "R related" :use-reasoner :pellet) (sparql '(:select (?a ?b) () (?a !S ?b)) :kb kb :trace "S related" :use-reasoner :pellet))) ;; Ian Horrocks example of how to write negation of anonymous individual. ;; individual(John value(hasMother individual(value(hasMother Jane)))) ;; individual(John type(restriction(hasMother someValuesFrom(restriction(hasMother someValuesFrom(oneOf(Jane))))))) ;; ontology inconsisent, as it should be. (with-ontology foo () ((object-property !hasFriend) (individual !jane) (individual !john (value !hasFriend (individual (value !hasFriend !jane)))) (individual !john (type (complement-of (restriction !hasFriend (some-values-from (intersection-of (restriction !hasFriend (some-values-from (one-of !jane))))))))) ) (check *default-kb*))