Skip to main content

SPARQL by Example

March 30, 2012 by jesandco

Just thought we'd share some useful SPARQL queries that we use from time to time.

  1. Find out if an ASN URI (http://asn.jesandco.org/resources/S102511A) comes from a Published Standards Document:

    ASK
    {
    <http://asn.jesandco.org/resources/S102511A> dcterms:isPartOf ?standardsDocument.
    ?standardsDocument asn:publicationStatus <http://purl.org/ASN/scheme/ASNPublicationStatus/Published>.
    }

    SPARQL response in HTML: http://tinyurl.com/7fpq4hc

  2. Return to me just the state codes and corresponding ASN URI's for a particular ASN Standards Document (http://asn.jesandco.org/resources/D2362333):

    SELECT DISTINCT ?statementNotation ?asnURI WHERE
    {
    ?asnURI dcterms:isPartOf <http://asn.jesandco.org/resources/D2362333>.
    ?asnURI asn:statementNotation ?statementNotation.
    }

    SPARQL response in HTML: http://tinyurl.com/6qrcpnj

  3. Give me the preferred labels and the corresponding ASN URI's for the ASN Education Level and Topic Vocabularies:

    SELECT DISTINCT ?prefLabel ?URI
    FROM <http://purl.org/ASN/scheme/ASNEducationLevel/>
    FROM <http://purl.org/ASN/scheme/ASNTopic/>
    WHERE
    {
    ?prefLabel skos:prefLabel ?URI.
    }

    SPARQL response in HTML: http://tinyurl.com/6voxx2b

  4. Give me the ASN URI that has this description, "1. Count to 100 by ones and by tens.":

    SELECT ?asnUri WHERE
    {
    ?asnUri dcterms:description ?description.
    ?description bif:contains "'1. Count to 100 by ones and by tens.'".
    }

    SPARQL response in HTML: http://tinyurl.com/7l8nva6

For more information about the ASN SPARQL endpoint see our documentation.

Premium Drupal Themes by Adaptivethemes