Features of this application include:
- Linked-data first structure.
- JSON-LD graph capabillities.
- Automatically generated REST api & queries.
- Schema-less datastore; arbitrary key:val pairs on objects.
- N-to-N directed resource relationships.
- Svelte components, delivered in a SvelteKit application.
- Helpers methods for performing queries and updates via SPARQL graph query language.
$ npm install
$ docker-compose build
$ docker-compose up
- Visit
http://localhost:7878/
- In the little endpoint input, set to
http://localhost:7878/update
- Run the following:
PREFIX vox: <https://vocab.voxmedia.com/#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
INSERT DATA {
<http://localhost:5173> rdf:type <vox:Service> .
<http://localhost:5173> vox:title "Encore" .
}
What's up with those prefix thingies?
vox:
andrdf:
? Those are namespaces. They allow us to disambiguate keys from each other. For this project, you can usevox:
for any key you want. You can also edit thesrc/lib/ld/prefixes.js
file to add other namespaces, if you want to create a new namespace or add extant linked-data terms.
curl --request POST \
--url http://localhost:5173/api/backlinks/create \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data id=uri:uuid:sports \
--data 'vox:context :=chorusNetwork:abc' \
--data vox:terms=sports \
--data 'vox:target :=https://sbn.com/sports'
curl --request GET \
--url 'http://localhost:5173/api/backlinks?context=chorusGroup%3A123'
curl --request POST \
--url http://localhost:5173/api/backlinks/edit \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data '- vox:terms=baseketball' \
--data id=uri:uuid:456
curl --request GET \
--url 'http://localhost:5173/api/backlinks/delete?backlink=uri%3Auuid%3A123'
curl --request GET \
--url 'http://localhost:5173/api/autolinks?context=chorusGroup%3A456&text=%22i%20love%20baseball%20also%20sports%22'
curl --request POST \
--url http://localhost:5173/api/backlinks/edit \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data id=chorusGroup:456 \
--data 'vox:parent :=chorusNetwork:abc'
Create resources via form posts. Request the data for those resources via REST API. Write UI's to present that data via Svelte components.
The CreateResource.svelte
component shows the basics of how to use form posts to create new resources.
The forms action
attribute will be the URL of the new resource. Any inputs with name
attributes will be added as keys to the resource, with the associated input value.
The forms implement the RDF-KV specification for identifying relationships, scalar values, and types for those scalar values.
The TL:DR; on that spec is:
name="rdf:type :" // value is a resource url. Creates a relationship between resources.
name="! rdf:type :" // value is a resource url. Creates an inverted relationship between resources.
name="vox:date ^xsd:date" // sets the scalar value type to Date
HTTP GET from a URL will return the object of that URLs data.
GET http://localhost:5173/resource
A query can be constructed by api/{key}/{value}
, and will return all the objects that contain that key/val pair.
GET http://localhost:5173/api/rdf:type/<vox:Resource>
GET http://localhost:5173/api/vox:title/"SvelteKit Triplestore"
Note the "{value}"
vs <{value}>
. Quotes are for querying scalar values, brackets are for relationships to other objects.