The W3C RDF Data Access Working Group has published the first public working draft of SPARQL Query Language for RDF. According to the introduction,
An RDF graph is a set of triples, each consisting of a subject, an object, and a property relationship between them as defined in RDF Concepts and Abstract syntax. These triples can come from a variety of sources. For instance, they may come directly from an RDF document. They may be inferred from other RDF triples. They may be the RDF expression of data stored in other formats, such as XML or relational databases.
SPARQL is a query language for accessing such RDF graphs. It provides facilities to:
- extract information in the form of URIs, bNodes, plain and typed literals.
- extract RDF subgraphs.
- construct new RDF graphs based on information in the queried graphs.
Here's a simple example SPARQL query adapted from the draft:
PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX : <http://example.org/book/> SELECT ?var WHERE ( :book1 dc:title ?var )The
?
indicates a variable name. This query stores the title of a book in a variable namedvar
. There are boolean and numeric operators as well.