Skip to content

Instantly share code, notes, and snippets.

[
{
"@context": { "@vocab": "http://todosapp.com/api/vocab#" },
"@id": "http://todosapp.com/api/users/1/todos/1#self",
"title": "Test",
"description": "Test TODO",
"user": { "@id": "http://todosapp.com/api/users/1#self" }
}
]
| ?name | ?todos |
|-----------|----------|
| John Doo | 1 |
|-----------|----------|
PREFIX todos: <http://todosapp.com/api/vocab#>
SELECT ?name (COUNT(?todo) AS ?todos)
WHERE {
?user todos:name ?name .
?todo todos:user ?user
}
GROUP BY ?name
<http://todosapp.com/api/users/1/todos/1> <http://todosapp.com/api/vocab#title> "Test" .
<http://todosapp.com/api/users/1/todos/1> <http://todosapp.com/api/vocab#description> "Test TODO" .
<http://todosapp.com/api/users/1/todos/1> <http://todosapp.com/api/vocab#user> <http://todosapp.com/api/users/1> .
<http://todosapp.com/api/users/1> <http://todosapp.com/api/vocab#name> "John Doo" .
<http://todosapp.com/api/users/1> <http://todosapp.com/api/vocab#email> "john.doo@test.com" .
<http://todosapp.com/api/users/1> <http://todosapp.com/api/vocab#todos> <http://todosapp.com/api/users/1/todos> .
<http://todosapp.com/api/users/1> <http://todosapp.com/api/vocab#name> "John Doo" .
<http://todosapp.com/api/users/1> <http://todosapp.com/api/vocab#email> "john.doo@test.com" .
<http://todosapp.com/api/users/1> <http://todosapp.com/api/vocab#todos> <http://todosapp.com/api/users/1/todos> .
{
"@context": { "@vocab": "http://todosapp.com/api/vocab#" },
"@id": "http://todosapp.com/api/users/1",
"name": "John Doo",
"email": "john.doo@test.com",
"todos": { "@id": "http://todosapp.com/api/users/1/todos" }
}
curl -X GET -H "Accept: application/ld+json" http://todosapp.com/api/version_3/users/1
<http://todosapp.com/api/users/1/todos/1> <http://todosapp.com/api/vocab#title> "Test" .
<http://todosapp.com/api/users/1/todos/1> <http://todosapp.com/api/vocab#description> "Test TODO" .
<http://todosapp.com/api/users/1/todos/1> <http://todosapp.com/api/vocab#user> <http://todosapp.com/api/users/1> .
{
"@id": "http://todosapp.com/api/version_3/users/1/todos/1",
"http://todosapp.com/api/vocab#title": "Test",
"http://todosapp.com/api/vocab#description": "Test TODO",
"http://todosapp.com/api/vocab#user": { "@id": "http://todosapp.com/api/version_3/users/1" }
}
curl -X GET -H "Accept: application/ld+json" http://todosapp.com/api/version_3/users/1/todos/1