W3C home > Mailing lists > Public > public-semweb-lifesci@w3.org > March 2006


From: Alan Ruttenberg <alanruttenberg@gmail.com>
Date: Wed, 8 Mar 2006 19:10:25 -0500
Message-Id: <06B22311-D229-4C46-B1CC-3CB536B5ABF9@gmail.com>
To: systemsbiology <public-semweb-lifesci@w3.org>

In the teleconference there was some interest in poking around my  
example code for doing sparql and I said I would send a pointer to it.

The code lives at http://svn.mumble.net:8080/svn/lsw/trunk

If you check it out (with svn co http://svn.mumble.net:8080/svn/lsw/ 
trunk) you will see README.txt with some information on running it.

What this is doing is described a bit at http://karma.med.harvard.edu/ 

Start it up:
(load "start")

Some instructions will print out when you start it up. You might want  
to skip most of them and do just


if you are only interested in the sparql aspect of things.
You should see something like the listing at the end of this message.

If anyone actually tries this and wants to work more with it I will  
be happy to spend more time documenting and helping out, give write  
access to the repository, etc.


What small molecules are associated with KEGG id C00645?
---- Query (lisp) ----
(sparql '(:select (?mol) nil (?mol "bug:classifiedByKEGG" ?kegg)
           (?kegg "bug:hasID" "C00645"))

---- Query (sparql) ----
?mol <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#classifiedByKEGG> ?kegg.
?kegg <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasID> "C00645". }
---- Result ----

What small molecules have the chemical formula c6h15o9p, and what are  
their names, cas, kegg ids?
---- Query (lisp) ----
(sparql '(:select (?name ?cas ?kegg) (:distinct t)
           (?formula "bug:hasFormula" "c6h15o9p")
           (?mol "bug:hasChemicalFormula" ?formula)
           (?mol "bug:hasName" ?name)
           (:optional (?mol "bug:definedByCAS" ?casf)
            (?casf "bug:hasID" ?cas))
           (:optional (?mol "bug:classifiedByKEGG" ?keggf)
            (?keggf "bug:hasID" ?kegg)))

---- Query (sparql) ----
SELECT DISTINCT ?name ?cas ?kegg
?formula <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasFormula> "c6h15o9p".
?mol <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasChemicalFormula> ?formula.
?mol <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasName> ?name.
?mol <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#definedByCAS> ?casf.
?casf <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasID> ?cas. }.
?mol <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#classifiedByKEGG> ?keggf.
?keggf <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasID> ?kegg. }.}
---- Result ----
INFO: This is not an ABox query:  
org.mindswap.pellet.exceptions.UnsupportedQueryException: Nested  
query patterns are not supported

(("mannitol-1-phosphate" "15806-48-1" nil)
("Galactitol 1-phosphate" nil "C06311")
("galactitol-1-phosphate" nil nil)
("D-sorbitol 6-phosphate" "108392-12-7" "C01096")
("D-Sorbitol 6-phosphate" "108392-12-7" "C01096")
("D-Mannitol 1-phosphate" nil "C00644"))
Which pairs (only show 10) of molecules have the same name? don't use  
reasoner here - it has a bug
---- Query (lisp) ----
(sparql '(:select (?mol1 ?mol2 ?name) (:limit 10)
           (?mol1 "bug:hasName" ?name) (?mol2 "bug:hasName" ?name)
           (:filter (not (equal ?mol1 ?mol2))))

---- Query (sparql) ----
SELECT ?mol1 ?mol2 ?name
?mol1 <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasName> ?name.
?mol2 <http://karma.med.harvard.edu/wiki/Debugging_the_bug/ 
bug.owl#hasName> ?name.
FILTER (!((?mol1 = ?mol2)))} LIMIT 10
---- Result ----

   "1-deoxy-D-xylulose 5-phosphate")
("http://ecocyc.org/compound/ctp" "http://gcrg.ucsd.edu/ijr904/ctp"

Received on Thursday, 9 March 2006 00:10:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:20:13 UTC