(defun value-partition (spec &key (disjoint t) (covering t)) (setq spec (eval-uri-reader-macro spec)) (let ((parent (car spec)) (children (rest spec))) (list* (if (and covering (> (length children) 1)) (class parent :complete (apply 'union-of (mapcar (lambda(el) (if (listp el) (car el) el)) children)))) (if (and disjoint (> (length children) 1)) (apply 'disjoint-classes (mapcar (lambda(el) (if (listp el) (car el) el)) children))) (loop for child in children when (listp child) append (value-partition child :disjoint disjoint :covering covering) collect (class (if (listp child) (car child) child) :partial parent))))) (defun existential-hierarchy (relation spec &key necessary) (setq spec (eval-uri-reader-macro spec)) (let ((parent (car spec)) (children (rest spec))) (loop for child in children when (listp child) append (existential-hierarchy relation child) collect (class (if (listp child) (car child) child) (if necessary :complete :partial) (restriction relation (some-values-from parent)))))) (defun individual-hierarchy (type relation spec) (setq spec (eval-uri-reader-macro spec)) (let ((parent (car spec)) (children (rest spec))) (loop for child in children when (listp child) append (individual-hierarchy type relation child) collect (individual (if (listp child) (car child) child) (type type) (value relation parent))))) (defun skos-concept-hierarchy (spec) (individual-hierarchy !skos:Concept !skos:narrower spec)) ;(skos-concept-hierarchy '(!activation !allosteric-inhibition !allosteric-activation)) (defun classprops (&rest plist-pairs) (apply 'intersection-of (loop for (prop class) on plist-pairs by #'cddr collect (restriction prop (some-values-from class)))))