Sample SPARQL queries

This page lists some common SPARQL queries that can be made for searching glycans.

Note that the endpoint is different depending on the type of query. Glycan structures are primarily stored in GlyTouCan, while metadata such as species information can be queried from GlyCosmos.

Find all Glycan structures (WURCS)

PREFIX glycan: <http://purl.jp/bio/12/glyco/glycan#>
PREFIX glytoucan:  <http://www.glytoucan.org/glyco/owl/glytoucan#>

SELECT DISTINCT ?Saccharide ?PrimaryId ?Sequence
FROM <http://rdf.glytoucan.org/core>
FROM <http://rdf.glytoucan.org/sequence/wurcs>
WHERE {
    ?Saccharide glytoucan:has_primary_id ?PrimaryId .
    ?Saccharide glycan:has_glycosequence ?GlycoSequence .
    ?GlycoSequence glycan:has_sequence ?Sequence .
    ?GlycoSequence glycan:in_carbohydrate_format glycan:carbohydrate_format_wurcs.
}
ORDER BY ?PrimaryId
limit 100

This result shows 100 items by “limit” opiton

=> run (limit 100 items)
=> endpoint (https://ts.glytoucan.org/sparql)

Find all Glycan structures (GlycoCT)

PREFIX glycan: <http://purl.jp/bio/12/glyco/glycan#>
PREFIX glytoucan:  <http://www.glytoucan.org/glyco/owl/glytoucan#>

SELECT DISTINCT ?Saccharide ?PrimaryId ?Sequence
FROM <http://rdf.glytoucan.org/core>
FROM <http://rdf.glytoucan.org/sequence/glycoct>
WHERE {
    ?Saccharide glytoucan:has_primary_id ?PrimaryId .
    ?Saccharide glycan:has_glycosequence ?GlycoSequence .
    ?GlycoSequence glycan:has_sequence ?Sequence .
    ?GlycoSequence glycan:in_carbohydrate_format glycan:carbohydrate_format_glycoct.
}
ORDER BY ?PrimaryId
limit 100

This result shows 100 items by “limit” opiton

=> run (limit 100)
=> endpoint (https://ts.glytoucan.org/sparql)

Find the GlyTouCan Accession from GlycomeDB ID

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX glycan: <http://purl.jp/bio/12/glyco/glycan#>
PREFIX glytoucan: <http://www.glytoucan.org/glyco/owl/glytoucan#>

SELECT DISTINCT ?accNum  ?external_id
FROM <http://rdf.glytoucan.org/core>
FROM <http://rdf.glytoucan.org/partner/glycome-db>
WHERE{
  ?saccharide glytoucan:has_primary_id ?accNum .
  ?saccharide glycan:has_resource_entry ?entry .
  ?entry a glycan:Resource_entry .
  ?entry glycan:in_glycan_database glycan:Database_glycomedb .

  VALUES ?external_id {"10923"}
  ?entry dcterms:identifier ?external_id .
}

=> run
=> endpoint (https://ts.glycosmos.org/sparql)

Find Glycan structures (IUPAC Condensed) related to Homo sapiens

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX glycan: <http://purl.jp/bio/12/glyco/glycan#>
PREFIX glytoucan: <http://www.glytoucan.org/glyco/owl/glytoucan#>

SELECT DISTINCT ?accNum ?taxon_id   (str(?sequence) AS ?sequence_list)
WHERE{
	 ?saccharide  glytoucan:has_primary_id ?accNum .
	 ?saccharide glycan:is_from_source ?source.
	 ?source a glycan:Source .

	 VALUES ?taxon_id {"9606"}
	 ?source dcterms:identifier ?taxon_id .
	 ?saccharide glycan:has_glycosequence ?gseq.
	 ?gseq glycan:has_sequence ?sequence.
	 ?gseq glycan:in_carbohydrate_format glycan:carbohydrate_format_iupac_condensed.
} limit 100

=> run
=> endpoint (https://ts.glycosmos.org/sparql)

Find Glycan structures (IUPAC Condensed) related to Mus musculus

PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX glycan: <http://purl.jp/bio/12/glyco/glycan#>
PREFIX glytoucan: <http://www.glytoucan.org/glyco/owl/glytoucan#>

SELECT DISTINCT ?accNum ?taxon_id   (str(?sequence) AS ?sequence_list)
WHERE{
	 ?saccharide  glytoucan:has_primary_id ?accNum .
	 ?saccharide glycan:is_from_source ?source.
	 ?source a glycan:Source .

   VALUES ?taxon_id {"10090"}
	 ?source dcterms:identifier ?taxon_id .
	 ?saccharide glycan:has_glycosequence ?gseq.
	 ?gseq glycan:has_sequence ?sequence.
	 ?gseq glycan:in_carbohydrate_format glycan:carbohydrate_format_iupac_condensed.
} limit 100

=> run
=> endpoint (https://ts.glycosmos.org/sparql)