« SPARQL Protocol and RDF Query Language/Le protocole SPARQL » : différence entre les versions
Contenu supprimé Contenu ajouté
m Robot : Correction et amélioration des liens wiki |
|||
Ligne 183 :
{{Exemple|titre=Exemple d'entête HTTP GET pour une requête SPARQL|contenu=
<source lang="text">
GET /sparql/?query='''
Host: www.example.org
User-agent: my-sparql-client/0.1
</source>
Ligne 192 :
<source lang="text">
POST /sparql/ HTTP/1.1
Host: www.example.org
User-agent: sparql-client/0.1
Content-Type: application/x-www-form-urlencoded
Content-Length:
query=
</source>
}}
Ligne 219 :
===== Format SPARQL result XML =====
{{Exemple|titre=Exemple de session avec une requête SELECT|contenu=
Voici un exemple de requête SELECT :
<source lang="text">
select * where { ?x ?y ?z .} limit 5
PREFIX dc: <http://purl.org/dc/elements/1.1/> ▼
</source>
Cette requête aura comme entête HTTP :
<source lang="text">
GET /sparql/?query=
Host: www.example.org
User-agent:
</source>
Ligne 236 ⟶ 234 :
<source lang="text">
HTTP/1.1 200 OK
Date: Fri,
Server: Apache/
Connection: close
Content-Type: application/
</source>
Ligne 246 ⟶ 244 :
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<variable name="x"/>
▲ <head>
<variable name="
<variable name="
<results>
<result>
<binding name="
<uri>http://www.example.org/ </binding> <binding name="
<uri>http://xmlns.com/foaf/0.1/primaryTopic</uri>
</result>▼
</binding>
...▼
<binding name="z">
</sparql> ▼
</binding>
▲ </result>
▲ ...
</results>
</source>
}}
Ligne 264 ⟶ 270 :
Voici un exemple de requête '''ASK''' :
<source lang="text">
PREFIX
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
ASK WHERE { ex:ID1 foaf:primaryTopic ex:ID2}
</source>
Cette requête aura comme entête HTTP :
<source lang="text">
GET /sparql/?query=
Host: www.example.org
User-agent:
</source>
Ligne 278 ⟶ 285 :
<source lang="text">
HTTP/1.1 200 OK
Date: Fri,
Server: Apache/
Connection: close
Content-Type: application/
</source>
Ligne 296 ⟶ 303 :
===== Format SPARQL result JSON =====
{{Exemple|titre=Exemple de session avec une requête SELECT et en sortie du JSON|contenu=
Voici un exemple de requête SELECT :
<source lang="text">
select * where { ?x ?y ?z .} limit 5
▲PREFIX dc: <http://purl.org/dc/elements/1.1/>
</source>
Cette requête aura comme entête HTTP :
<source lang="text">
GET /sparql/?query=
Host: www.example.org
User-agent:
</source>
Ligne 313 ⟶ 318 :
<source lang="text">
HTTP/1.1 200 OK
Date: Fri,
Server: Apache/
Connection: close
Content-Type: application/
</source>
Ligne 323 ⟶ 328 :
<?xml version="1.0"?>
{
"head": { "vars": [ "
} ,
"results": {
"bindings": [
{
"
"
"z": { "type": "uri" , "value": "http://www.example.org/ID2" }
} ,
...
Ligne 348 ⟶ 354 :
Voici un exemple de requête '''DESCRIBE''' :
<source lang="text">
PREFIX
DESCRIBE
</source>
Cette requête aura comme entête HTTP :
<source lang="text">
GET /sparql
Host: www.example.org
User-agent:
</source>
Ligne 362 ⟶ 368 :
<source lang="text">
HTTP/1.1 200 OK
Date:
Server: Apache/
Connection: close
Content-Type:
</source>
Et la réponse contiendra le document
<source lang="text">
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
▲<rdf:RDF ...
xmlns:j.1="http://purl.org/dc/terms/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
<rdf:Description rdf:about="http://www.example.org/ID1">
<rdfs:label>Description of a document version of 13/11/2008</rdfs:label>
<j.1:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2008-11-03T20:37:51Z</j.1:created>
<j.1:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2008-11-03T21:12:31Z</j.1:modified>
<j.0:primaryTopic rdf:resource="http://www.example.org/ID2"/>
</rdf:Description>
</rdf:RDF>
Ligne 383 ⟶ 395 :
Voici un exemple de requête '''CONSTRUCT''' :
<source lang="text">
PREFIX
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT { ?x skos:Concept ?z. ?x ?p ?v . }
PREFIX myfoaf: <http://www.example/jose/foaf.rdf#>▼
WHERE { ?x foaf:primaryTopic ?z. ?x ?p ?v . } LIMIT 5
</source>
Cette requête aura comme entête HTTP :
<source lang="text">
GET /sparql?query=PREFIX%20skos:%20%3Chttp://www.w3.org/2008/05/skos%23%3E%20PREFIX%20foaf:%20%3Chttp://xmlns.com/foaf/0.1/%3E%20CONSTRUCT%20{...}%20WHERE%20{...}%20LIMIT%205&output=turtle HTTP/1.1
Host: www.example.org
User-agent:
</source>
Ligne 408 ⟶ 411 :
<source lang="text">
HTTP/1.1 200 OK
Date: Fri,
Server: Apache/
Connection: close
Content-Type: text/turtle
Ligne 418 ⟶ 421 :
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix
@prefix skos: <http://www.w3.org/2008/05/skos#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
ex:ID1 skos:Concept ex:ID2;
foaf:primaryTopic ex:ID2;
▲ foaf:depiction <http://www.example/jose/jose.jpg>;
rdfs:label "Description of a document
purl:created "2008-11-03T20:37:51Z"^^xsd:dateTime;
purl:modified "2008-11-03T21:12:31Z"^^xsd:dateTime.
...
</source>
}}
=== Protocole d'écriture ===
|