public
Last active

  • Download Gist
ons/ron/chebi mashup.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
var ons = rdf.createStore()
// output: RDFStore: 0 triples
 
rdf.importURL(ons,
"http://github.com/egonw/onssolubility/raw/master/ons.solubility.rdf/ons.rdf")
// output: RDFStore: 1206 triples
 
var results = rdf.sparql(ons, "PREFIX owl: <http://www.w3.org/2002/07/owl#> " +
"PREFIX ons: <http://spreadsheet.google.com/plwwufp30hfq0udnEmRD1aQ/onto#> " +
"SELECT DISTINCT ?same WHERE { " +
" ?solvent a ons:Solvent . " +
" ?solvent owl:sameAs ?same" +
"}"
)
 
for (i=0; i<results.size(); i++) {
var row = results.get(i);
for (j=0; j<row.size(); j++) {
// use the owl:sameAs to find more triples
var uri = row.get(j);
print("Adding " + uri + "...\n");
rdf.importURL(ons, uri);
}
}
 
rdf.sparql(ons, "PREFIX owl: <http://www.w3.org/2002/07/owl#> " +
"PREFIX ons: <http://spreadsheet.google.com/plwwufp30hfq0udnEmRD1aQ/onto#> " +
"PREFIX rdfonm: <http://rdf.openmolecules.net/#> " +
"PREFIX dc: <http://purl.org/dc/elements/1.1/> " +
"SELECT DISTINCT ?title ?chebi WHERE { " +
" ?solvent a ons:Solvent . " +
" ?solvent dc:title ?title . " +
" ?solvent owl:sameAs ?same ." +
" ?same rdfonm:chebiid ?chebi" +
"}"
)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.