"Metabolights Studies" linking to the CHEBI:4167-D-glucopyranose compound
This example shows how to retrieve "Metabolights Studies"
linking to the CHEBI:4167-D-glucopyranose compound. This example uses the following SPARQL endpoint https://metabolights.semantic-metabolomics.fr/sparql
HTML
<script src="https://cdn.jsdelivr.net/gh/p2m2/discovery@develop/dist/discovery-web.min.js"></script>
<script>
var config = SWDiscoveryConfiguration
.init()
.sparqlEndpoint("https://metabolights.semantic-metabolomics.fr/sparql");
SWDiscovery(config)
.prefix("obo","http://purl.obolibrary.org/obo/")
.prefix("metabolights","https://www.ebi.ac.uk/metabolights/property#")
.prefix("rdfs","http://www.w3.org/2000/01/rdf-schema#")
.something()
.set(URI("obo:CHEBI_4167"))
.isObjectOf(URI("metabolights:Xref"),"study")
.datatype(URI("rdfs:label"),"label")
.select("study","label")
.commit()
.raw()
.then((response) => {
for (let i=0;i<response.results.bindings.length;i++) {
let study=response.results.bindings[i]["study"].value;
let label=response.results.datatypes["label"][study][0].value;
console.log(study+"-->"+label);
}
}).catch( (error) => {
console.error(" -- catch exception --")
console.error(error)
} );
</script>