-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
182 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ root = true | |
[*] | ||
indent_size = 2 | ||
indent_style = space | ||
end_of_line = lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
BASE=$1; | ||
|
||
curl "$BASE/api/User" --upload-file resources/api/User.ttl | ||
curl "$BASE/api/UsersCollection" --upload-file resources/api/UsersCollection.ttl | ||
curl "$BASE/users" --upload-file resources/users.ttl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@prefix dash: <http://datashapes.org/dash#> . | ||
@prefix bio: <http://purl.org/vocab/bio/0.1/> . | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | ||
@prefix code: <https://code.described.at/> . | ||
@prefix schema: <http://schema.org/> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix hydra: <http://www.w3.org/ns/hydra/core#> . | ||
|
||
</api/User> | ||
a hydra:Class, sh:NodeShape ; | ||
hydra:supportedOperation | ||
[ | ||
a schema:ReplaceAction ; | ||
hydra:method "PUT" ; | ||
hydra:title "Update User" ; | ||
code:implementedBy | ||
[ | ||
a code:EcmaScript ; | ||
code:link <node:@hydrofoil/knossos/resource#put> | ||
] ; | ||
] ; | ||
sh:property | ||
[ | ||
sh:path foaf:email ; | ||
sh:name "Email" ; | ||
sh:minCount 1 ; | ||
sh:maxCount 1 ; | ||
sh:order 10 ; | ||
], | ||
[ | ||
sh:path foaf:nick ; | ||
sh:maxCount 1 ; | ||
sh:order 20 ; | ||
], | ||
[ | ||
sh:path foaf:img ; | ||
sh:nodeKind sh:IRI ; | ||
sh:maxCount 1 ; | ||
sh:order 30 ; | ||
], | ||
[ | ||
sh:path bio:biography ; | ||
dash:singleLine false ; | ||
sh:maxCount 1 ; | ||
sh:order 40 ; | ||
] ; | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@prefix knossos: <https://hypermedia.app/knossos#> . | ||
@prefix code: <https://code.described.at/> . | ||
@prefix hydra: <http://www.w3.org/ns/hydra/core#> . | ||
|
||
</api/UsersCollection> | ||
a hydra:Class ; | ||
knossos:createWithPUT true ; | ||
hydra:supportedOperation | ||
[ | ||
hydra:method "POST" ; | ||
hydra:title "Register" ; | ||
code:implementedBy | ||
[ | ||
a code:EcmaScript ; | ||
code:link <node:@hydrofoil/knossos/collection#post> ; | ||
] ; | ||
] ; | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix hydra: <http://www.w3.org/ns/hydra/core#> . | ||
|
||
</users> | ||
a </api/UsersCollection>, hydra:Collection ; | ||
hydra:manages | ||
[ | ||
hydra:property rdf:type ; | ||
hydra:object </api/User> ; | ||
] ; | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# @hydrofoil/knossos | ||
|
||
Knossos is a high level Hydra server, which allows rapidly deploying Hydra-powered APIs backed by a triplestore. | ||
|
||
### Low friction | ||
|
||
No initial setup, you only need to create an RDF database with SPARQL Query/Update functionality. | ||
|
||
### Turtles all the way down | ||
|
||
The entire API is stored as RDF graph: | ||
|
||
- The proper API resources | ||
- Hydra API Documentation | ||
- The data models, using SHACL Shapes | ||
|
||
### Eating its own dog food | ||
|
||
The API itself is also controlled using HTTP interface: | ||
|
||
- Creating data models | ||
- Exposing functionality as Hydra Supported Operations | ||
- Fine-grained access control | ||
|
||
## TODOs | ||
|
||
- Control the implicit `PUT` on per-class basis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import namespace from '@rdfjs/namespace' | ||
|
||
type KnossosTerms = 'createWithPUT' | ||
|
||
export const knossos = namespace<KnossosTerms>('https://hypermedia.app/knossos#') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters