The VMH SPARQL endpoint exposes metabolites, reactions, diseases, genes, microbes, HPO terms, food items, nutrients, and diets as RDF triples queryable with standard SPARQL 1.1.
https://delta.vmh.life/api/public/sparql?query=…) · POST (application/sparql-query)json (default) · csv · tsv · N-Triples (CONSTRUCT/DESCRIBE)Common prefixes are auto-injected — no need to declare PREFIX vmh:, PREFIX rdfs:, or PREFIX xsd: in your queries.
Retrieve the first 10 metabolites present in human metabolism.
SELECT ?met ?abbr ?name WHERE {
?met a vmh:Metabolite ;
vmh:isHuman "true"^^xsd:boolean ;
vmh:abbreviation ?abbr ;
rdfs:label ?name .
} LIMIT 10import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?met ?abbr ?name WHERE {
?met a vmh:Metabolite ;
vmh:isHuman "true"^^xsd:boolean ;
vmh:abbreviation ?abbr ;
rdfs:label ?name .
} LIMIT 10
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Fetch all properties of D-Glucose (abbreviation: glc_D).
SELECT ?property ?value WHERE {
?met vmh:abbreviation "glc_D" .
?met ?property ?value .
}import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?property ?value WHERE {
?met vmh:abbreviation "glc_D" .
?met ?property ?value .
}
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Return metabolites that have an InChIKey recorded.
SELECT ?abbr ?name ?inchiKey WHERE {
?met a vmh:Metabolite ;
vmh:abbreviation ?abbr ;
rdfs:label ?name ;
vmh:inchiKey ?inchiKey .
} LIMIT 20import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?abbr ?name ?inchiKey WHERE {
?met a vmh:Metabolite ;
vmh:abbreviation ?abbr ;
rdfs:label ?name ;
vmh:inchiKey ?inchiKey .
} LIMIT 20
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Find all reactions whose subsystem contains 'glycolysis'.
SELECT ?abbr ?description ?formula WHERE {
?rxn a vmh:Reaction ;
vmh:abbreviation ?abbr ;
rdfs:label ?description ;
vmh:formula ?formula ;
vmh:subsystem ?sub .
FILTER(CONTAINS(LCASE(?sub), "glycolysis"))
} ORDER BY ?abbrimport requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?abbr ?description ?formula WHERE {
?rxn a vmh:Reaction ;
vmh:abbreviation ?abbr ;
rdfs:label ?description ;
vmh:formula ?formula ;
vmh:subsystem ?sub .
FILTER(CONTAINS(LCASE(?sub), "glycolysis"))
} ORDER BY ?abbr
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Find reactions annotated as both human and microbial.
SELECT ?abbr ?sub WHERE {
?rxn a vmh:Reaction ;
vmh:abbreviation ?abbr ;
vmh:subsystem ?sub ;
vmh:isHuman "true"^^xsd:boolean ;
vmh:isMicrobe "true"^^xsd:boolean .
} LIMIT 25import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?abbr ?sub WHERE {
?rxn a vmh:Reaction ;
vmh:abbreviation ?abbr ;
vmh:subsystem ?sub ;
vmh:isHuman "true"^^xsd:boolean ;
vmh:isMicrobe "true"^^xsd:boolean .
} LIMIT 25
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})List diseases that have an associated OMIM disease identifier.
SELECT ?abbr ?name ?omim WHERE {
?d a vmh:Disease ;
vmh:abbreviation ?abbr ;
rdfs:label ?name ;
vmh:omimDisease ?omim .
} ORDER BY ?abbr LIMIT 20import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?abbr ?name ?omim WHERE {
?d a vmh:Disease ;
vmh:abbreviation ?abbr ;
rdfs:label ?name ;
vmh:omimDisease ?omim .
} ORDER BY ?abbr LIMIT 20
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Find diseases that have an IEM code assigned.
SELECT ?abbr ?name ?iemCode WHERE {
?d a vmh:Disease ;
vmh:abbreviation ?abbr ;
rdfs:label ?name ;
vmh:iemCode ?iemCode .
} ORDER BY ?iemCodeimport requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?abbr ?name ?iemCode WHERE {
?d a vmh:Disease ;
vmh:abbreviation ?abbr ;
rdfs:label ?name ;
vmh:iemCode ?iemCode .
} ORDER BY ?iemCode
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Retrieve gene symbols and Entrez IDs.
SELECT ?symbol ?entrezId ?name WHERE {
?g a vmh:Gene ;
vmh:symbol ?symbol ;
vmh:entrezId ?entrezId ;
rdfs:label ?name .
} ORDER BY ?symbol LIMIT 20import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?symbol ?entrezId ?name WHERE {
?g a vmh:Gene ;
vmh:symbol ?symbol ;
vmh:entrezId ?entrezId ;
rdfs:label ?name .
} ORDER BY ?symbol LIMIT 20
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Find microbes with a negative Gram stain.
SELECT ?organism ?phylum ?genus WHERE {
?m a vmh:Microbe ;
vmh:organism ?organism ;
vmh:phylum ?phylum ;
vmh:genus ?genus ;
vmh:gramStain ?gram .
FILTER(LCASE(?gram) = "negative")
} ORDER BY ?organism LIMIT 20import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?organism ?phylum ?genus WHERE {
?m a vmh:Microbe ;
vmh:organism ?organism ;
vmh:phylum ?phylum ;
vmh:genus ?genus ;
vmh:gramStain ?gram .
FILTER(LCASE(?gram) = "negative")
} ORDER BY ?organism LIMIT 20
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Aggregate microbes by phylum.
SELECT ?phylum (COUNT(?m) AS ?count) WHERE {
?m a vmh:Microbe ;
vmh:phylum ?phylum .
} GROUP BY ?phylum ORDER BY DESC(?count)import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?phylum (COUNT(?m) AS ?count) WHERE {
?m a vmh:Microbe ;
vmh:phylum ?phylum .
} GROUP BY ?phylum ORDER BY DESC(?count)
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Find HPO terms whose label contains 'seizure'.
SELECT ?hpoId ?name ?definition WHERE {
?h a vmh:HPOTerm ;
vmh:hpoId ?hpoId ;
rdfs:label ?name .
OPTIONAL { ?h vmh:definition ?definition }
FILTER(CONTAINS(LCASE(?name), "seizure"))
}import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?hpoId ?name ?definition WHERE {
?h a vmh:HPOTerm ;
vmh:hpoId ?hpoId ;
rdfs:label ?name .
OPTIONAL { ?h vmh:definition ?definition }
FILTER(CONTAINS(LCASE(?name), "seizure"))
}
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Retrieve food names and product types.
SELECT ?foodId ?name ?productType WHERE {
?f a vmh:Food ;
vmh:foodId ?foodId ;
rdfs:label ?name .
OPTIONAL { ?f vmh:productType ?productType }
} ORDER BY ?name LIMIT 20import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?foodId ?name ?productType WHERE {
?f a vmh:Food ;
vmh:foodId ?foodId ;
rdfs:label ?name .
OPTIONAL { ?f vmh:productType ?productType }
} ORDER BY ?name LIMIT 20
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Find all nutrient values recorded for apple (food_id: F001). Replace F001 with the actual food_id.
SELECT ?nutrientLabel ?value ?unit ?category WHERE {
?obs a vmh:NutritionObservation ;
vmh:food ?food ;
vmh:nutrient ?nutrient ;
vmh:value ?value .
?food vmh:foodId "F001" .
?nutrient rdfs:label ?nutrientLabel ;
vmh:category ?category .
OPTIONAL { ?obs vmh:unit ?unit }
} ORDER BY ?category ?nutrientLabelimport requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?nutrientLabel ?value ?unit ?category WHERE {
?obs a vmh:NutritionObservation ;
vmh:food ?food ;
vmh:nutrient ?nutrient ;
vmh:value ?value .
?food vmh:foodId "F001" .
?nutrient rdfs:label ?nutrientLabel ;
vmh:category ?category .
OPTIONAL { ?obs vmh:unit ?unit }
} ORDER BY ?category ?nutrientLabel
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Summarise how many distinct nutrients exist in each category.
SELECT ?category (COUNT(DISTINCT ?n) AS ?count) WHERE {
?n a vmh:Nutrient ;
vmh:category ?category .
} GROUP BY ?category ORDER BY DESC(?count)import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?category (COUNT(DISTINCT ?n) AS ?count) WHERE {
?n a vmh:Nutrient ;
vmh:category ?category .
} GROUP BY ?category ORDER BY DESC(?count)
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Show diet names and their total energy in kcal.
SELECT ?name ?kcal WHERE {
?d a vmh:Diet ;
vmh:dietName ?name ;
vmh:totalEnergyKcal ?kcal .
} ORDER BY DESC(?kcal)import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?name ?kcal WHERE {
?d a vmh:Diet ;
vmh:dietName ?name ;
vmh:totalEnergyKcal ?kcal .
} ORDER BY DESC(?kcal)
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Compare percentage energy from carbs, proteins and lipids across all diets.
SELECT ?name ?carbPerc ?proteinPerc ?lipidPerc WHERE {
?d a vmh:Diet ;
vmh:dietName ?name ;
vmh:carbohydratesPercEnergy ?carbPerc ;
vmh:proteinsPercEnergy ?proteinPerc ;
vmh:lipidsPercEnergy ?lipidPerc .
} ORDER BY DESC(?carbPerc)import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
SELECT ?name ?carbPerc ?proteinPerc ?lipidPerc WHERE {
?d a vmh:Diet ;
vmh:dietName ?name ;
vmh:carbohydratesPercEnergy ?carbPerc ;
vmh:proteinsPercEnergy ?proteinPerc ;
vmh:lipidsPercEnergy ?lipidPerc .
} ORDER BY DESC(?carbPerc)
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Boolean check: is 'atp' a known VMH metabolite?
ASK {
?m vmh:abbreviation "atp" .
}import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
ASK {
?m vmh:abbreviation "atp" .
}
"""
params = {"query": query}
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
# Print variable names and first binding
print("Variables:", data["head"]["vars"])
for binding in data["results"]["bindings"][:5]:
print({k: v["value"] for k, v in binding.items()})Build an RDF subgraph of all diseases with their OMIM IDs (returns N-Triples).
CONSTRUCT {
?d a vmh:Disease ;
rdfs:label ?name ;
vmh:omimDisease ?omim .
} WHERE {
?d a vmh:Disease ;
rdfs:label ?name ;
vmh:omimDisease ?omim .
} LIMIT 50import requests
endpoint = "https://delta.vmh.life/api/public/sparql"
query = """
CONSTRUCT {
?d a vmh:Disease ;
rdfs:label ?name ;
vmh:omimDisease ?omim .
} WHERE {
?d a vmh:Disease ;
rdfs:label ?name ;
vmh:omimDisease ?omim .
} LIMIT 50
"""
params = {"query": query}
params["format"] = "ntriples"
response = requests.get(endpoint, params=params, timeout=30)
response.raise_for_status()
data = response.json()
print(response.text[:500])