{{#title Querying Atomic Data}}
There are multiple ways of getting Atomic Data into some system:
- Subject Fetching requests a single subject right from its source
- Atomic Collections can filter, sort and paginate resources
- Atomic Paths is a simple way to traverse Atomic Graphs and target specific values
- Triple Pattern Fragments allows querying for specific (combinations of) Subject, Property and Value.
- SPARQL is a powerful Query language for traversing linked data graphs
The simplest way of getting Atomic Data when the Subject is an HTTP URL, is by sending a GET request to the subject URL.
Set the Content-Type header to an Atomic Data compatible mime type, such as application/ad+json.
GET https://atomicdata.dev/test HTTP/1.1
Content-Type: application/ad+jsonThe server SHOULD respond with all the Atoms of which the requested URL is the subject:
HTTP/1.1 200 OK
Content-Type: application/ad+json
Connection: Closed
{
"@id": "https://atomicdata.dev/test",
"https://atomicdata.dev/properties/shortname": "1611489928"
}The server MAY also include other resources, if they are deemed relevant.
Collections are Resources that provide simple query options, such as filtering by Property or Value, and sorting. They also paginate resources. Under the hood, Collections are powered by Triple Pattern Fragments. Use query parameters to traverse pages, filter, or sort.
An Atomic Path is a string that consist of one or more URLs, which when traversed point to an item.
Triple Pattern Fragments (TPF) is an interface for querying RDF. It works great for Atomic Data as well.
An HTTP implementation of a TPF endpoint might accept a GET request to a URL such as this:
http://example.org/tpf?subject={subject}&property={property}&value={value}
Make sure to URL encode the subject, property, value strings.
For example, let's search for all Atoms where the value is test.
GET https://atomicdata.dev/tpf?value=0 HTTP/1.1
Content-Type: text/turtleThis is the HTTP response:
HTTP/1.1 200 OK
Content-Type: text/turtle
Connection: Closed
<https://atomicdata.dev/agents> <https://atomicdata.dev/properties/collection/currentPage> "0"^^<https://atomicdata.dev/datatypes/integer> .SPARQL is a powerful RDF query language. Since all Atomic Data is also valid RDF, it should be possible to query Atomic Data using SPARQL. None of the exsisting implementations support a SPARQL endpoint, though.
- Convert / serialize Atomic Data to RDF (for example by using the
/tpfendpoint and anacceptheader:curl -i -H "Accept: text/turtle" "https://atomicdata.dev/tpf") - Load it into a SPARQL engine of your choice