Skip to content

Instantly share code, notes, and snippets.

View tpluscode's full-sized avatar

Tomasz Pluskiewicz tpluscode

View GitHub Profile
@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 / 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 / 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 / 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

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 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.

@tpluscode
tpluscode / api.ttl
Last active April 14, 2021 10:54
Hydra relative
<api>
a hydra:ApiDocumentation ;
hydra:supportedClass :UserCollection ;
.
:UserCollection
a hydra:Class ;
hydra:supportedProperty [
hydra:property :searchUsers ;
] ;
@tpluscode
tpluscode / data.ttl
Created December 9, 2021 16:34
SHACL Compound properties
<data-file>
a schema:MediaObject ;
schema:identifier "sample-data.csv" ;
schema:encodingFormat "text/csv";
schema:contenUrl <https://s3.link/ugly-guid-link-whatever.csv>
.
@tpluscode
tpluscode / readme.md
Last active December 14, 2021 06:43
Annotating Hydra collection search template with SHACL Advanced Features

This is an idea for how SHACL AF Node Expression can be used to annotate a hydra search template so that values coming from the request query string would be transformed to SPARQL patterns an injeced into the resulting query

The collection resource <shapes> supports a targetNode query string parameter which should be translated to a SPARQL union like below. The $this token will represent each collection member (instance of shape). For example, when requesting shapes?targetNode=foobar, the generated patterns could be:

{
  # query the target node directly
  $this sh:targetNode <foobar>
}
UNION
@tpluscode
tpluscode / .gitignore
Last active January 13, 2022 11:25
esbuild mirador
node_modules/
js/