After this part of the tutorial you should
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?website
FROM <http://planetrdf.com/bloggers.rdf>
WHERE { ?person foaf:weblog ?website ;
foaf:name ?name .
?website a foaf:Document
}
http://.../qps? query-lang=http://www.w3.org/TR/rdf-sparql-query/ &graph-id=http://planetrdf.com/bloggers.rdf &query=PREFIX foaf: <http://xmlns.com/foaf/0.1/...
The main RDF query language styles:
Most popular by far are the SQL-like languages.
RDQL/Squish is the most popular SQL-like language with multiple independent implementations.
| Concept | XML | RDF |
|---|---|---|
| Model | Document or Tree or Infoset (PSVI) |
Set of Triples = RDF Graph |
| Atomic Units | Elements, Attributes, Text | Triples, URIs, Blank Nodes, Text |
| Identifiers | Element/Attribute names QNames IDs XPointers / XPaths |
URIs |
| Described by | DTDs W3C XML Schema Relax NG ... |
RDF Schema |
given that RDQL (and others) are widely implemented
So in March 2004 the W3C formed the RDF Data Access Working Group
Some of the use cases DAWG recorded were:
These led to requirements
<URI>@prefix prefix <http://....>:name_:name[]
for a Blank Node used once"Literal""Literal"@language"""Long literal with""""lexical form"^^datatype URIe.g. "10"^^xsd:integer | |
10 | Decimal integer (xsd:integer) |
true | Boolean (xsd:boolean) |
2.5 | Double (xsd:double) |
.:a :b :c . :d :e :f .:a :b :c, :d .:a :b :c . :a :b :d .
:a :b :c; :d :e .
which is the same as: :a :b :c . :a :d :e .
:a :b [ :c :d ]
which is the same as: :a :b _:x . _:x :c :d ._:x
:a :b ( :c :d :e :f )foaf:knows relationship between peoplefoaf:mboxfoaf:namerdfs:seeAlso
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix bio: <http://purl.org/vocab/bio/0.1/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<> rdf:type foaf:PersonalProfileDocument ;
dc:creator <mailto:alice@work.example.com> .
_:a a foaf:Person ;
foaf:name "Alice" ;
foaf:mbox <mailto:alice@work.example.com> ;
foaf:mbox <mailto:alice@home.example.org> ;
foaf:knows _:b ;
bio:event [ a bio:Birth; bio:date "1974-02-28"^^xsd:date ] .
_:b a foaf:Person ;
foaf:name "Bob" ;
foaf:mbox <mailto:bob@work.example.com> ;
bio:event [ a bio:Birth; bio:date "1973-01-02"^^xsd:date ] ;
rdfs:seeAlso <bobFoaf.rdf> ;
rdf:type foaf:Person .
<bobFoaf.rdf> rdf:type foaf:PersonalProfileDocument .
_:a foaf:knows _:c .
_:c foaf:mbox <mailto:eve@work.example.com> .
Note:
@prefixDownload and install:
ARQROOT to the absolute
location of the ARQ-0.95 folder. Add the ARQ-0.95/bin folder to
the console search PATH.
ARQROOT to
the absolute path of the ARQ-0.9.5/lib directory. Add
the ARQ-0.9.5/bin directory to the shell search PATH.
Make all the scripts are executable with chmod u+x bin/*.
$ sparql --query http://www.w3.org/2004/Talks/17Dec-sparql/intro/ex1.rq ------------------------------------------------------------------------- | name | website | ========================================================================= | "Norm Walsh" | <http://norman.walsh.name/> | | "Dave Beckett" | <http://journal.dajobe.org/journal/> | | "Ikki Ohmukai" | <http://www.semblog.org/> | | "W3C Semantic Web News" | <http://www.w3.org/2001/sw/> | | "Danny Ayers" | <http://dannyayers.com/> | ... -------------------------------------------------------------------------
or with XML results:
$ sparql --results rs/xml --query http://www.w3.org/2004/Talks/17Dec-sparql/intro/ex1.rq
<?xml version="1.0"?>
<sparql xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result2" >
<head>
<variable name="name"/>
<variable name="website"/>
</head>
<results>
<result>
...
Run the SPARQL query in http://www.w3.org/2004/Talks/17Dec-sparql/intro/ex1.rq by whichever web based or console method you prefer
Copyright 2005 Dave Beckett, Steve Harris, Eric Prud'hommeaux and Andy Seaborne. Terms of use are given on the main Introduction to RDF Query with SPARQL Tutorial page.