2007 prototype queries/Part of inference

Here's how I used LSW to compute the inferred part of relations using Pellet for the gene ontology cellular component and biological process ontologies. (there was only 1 part of relation in molecular function)

(defun do-inferred-part-of (source dest)
  ;; read the KB
  (setq *default-kb* (load-kb-jena  source))
  ;; loop through all classes c asking for the subclass of (some part_of c)
  (time (setq 
	 *inferred-part-of*
	 (loop for c in (descendants !owl:Thing *default-kb*) 
	    for part-of = (descendants (manch (some !<http://purl.org/obo/owl/obo#part_of> c))
                                                    *default-kb*)
	    when part-of collect (cons c part-of)) foo nil))
  ;; create a simple ontology with just these part relations and dump it.
  (with-ontology inferred-part-of-ont ()
      ((annotation-property !<http://purl.org/obo/owl/obo#part_of>)
       (loop for c in (loop for i in *inferred-part-of* collect (car i))
	  collect (class c :partial))
       (loop for (whole . parts) in *inferred-part-of*
	  collect
	    (loop for p in parts 
                collect 
                 (class p :partial (annotation !<http://purl.org/obo/owl/obo#part_of> whole)))))
    (write-rdfxml inferred-part-of-ont dest)))

Generates a bunch of stuff that looks like this:

  <owl:Class rdf:about="http://purl.org/obo/owl/GO#GO_0000015">
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0005575"/>
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0005622"/>
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0005623"/>
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0005737"/>
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0005829"/>
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0044424"/>
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0044444"/>
    <obo:part_of rdf:resource="http://purl.org/obo/owl/GO#GO_0044464"/>
  </owl:Class>

For cellular component, there are 810 explicit part of relations, and 20000 inferred.