Skip to content

Instantly share code, notes, and snippets.

View tpluscode's full-sized avatar

Tomasz Pluskiewicz tpluscode

View GitHub Profile
@tpluscode
tpluscode / readme.md
Last active March 9, 2021 10:41
Managing multiple resources in one graph

The problem

You only have a single graph for multiple related and unrelated resources, which would be accessed over a web api (Hydra/LDP)

How do you handle updates and deletes to remove only the right triples.

Example

Consider the resources, as can be found in tbbt-ld. Let's take the representation of Amy and Sheldon.

Intro

This document presents some possible ideas for how a server request might get matched to the Hydra's API Documentation.

All turtle snippets ignore prefixes and base URI for bervity and only show the relevant subgraph. All requests assume Content-Type: text/turtle

@tpluscode
tpluscode / readme.md
Last active February 5, 2020 16:11
Alcaeus breaking changes

Main export

-import { Hydra } from 'alcaeus'
+import Hydra from 'alcaeus'

Remove Vocab export

@tpluscode
tpluscode / typedClownface.ts
Created December 16, 2019 18:38
Typed clownface
// WARNING
//
// Ugly implementation and not exactly like in the examples. but similar
import { Literal, NamedNode } from 'rdf-js'
import Clownface from 'clownface/lib/Clownface'
import rdf from 'rdf-ext'
import { TypedClownfaceEntity } from './TypedClownfaceEntity'
const trueLiteral: Literal = rdf.literal(true)
@tpluscode
tpluscode / initialise.ru
Last active September 11, 2019 17:35
API Days demo
PREFIX dataCube: <https://rdf-cube-curation.described.at/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
INSERT DATA {
GRAPH <http://localhost:5678/project/apidays> {
<http://localhost:5678/project/apidays>
a dataCube:Project ;
<http://schema.org/name> "Fact table project" .
}
}
@tpluscode
tpluscode / highlighting.iro
Last active November 15, 2023 15:50
Hypertest code coloring
#################################################################
## Iro
################################################################
##
## * Press Ctrl + '+'/'-' To Zoom in
## * Press Ctrl + S to save and recalculate...
## * Documents are saved to web storage.
## * Only one save slot supported.
## * Matches cannot span lines.
## * Unicode chars must be defined in \u0000 to \uffff format.
@tpluscode
tpluscode / coverage.md
Last active June 20, 2019 07:06
Draft of Hydra API testing tool

Coverage

There could be two separate coverage metrics.

Representation metrics

To verify the contents of resources

I'm not so sure about, but any verification like Expect property xyz (value) could increase this metric.

node_modules/
dist/
@tpluscode
tpluscode / CommentHeaderWriter.cs
Created November 11, 2017 11:46
Prepending a comment before serialized RDF
public class CommentHeaderWriter : BaseRdfWriter
{
private readonly IRdfWriter inner;
private readonly string header;
public CommentHeaderWriter(IRdfWriter writer, string header)
{
this.inner = writer;
this.header = header;
}
@tpluscode
tpluscode / index.html
Created August 28, 2017 19:19
Importing and stamping templates with ES6 and lit-html
<!DOCTYPE html>
<html lang="en">
<body>
<vanilla-lit tagline="Luke"></vanilla-lit>
<script src="bundle.js"></script>
</body>
</html>