Skip to content

Instantly share code, notes, and snippets.

Avatar
🕹️

Emmanuel Oga EmmanuelOga

🕹️
View GitHub Profile
@EmmanuelOga
EmmanuelOga / bike.pl
Last active Jun 19, 2021
A bike in prolog
View bike.pl
basicpart(rim).
basicpart(spoke).
basicpart(rearframe).
basicpart(handles).
basicpart(gears).
basicpart(bolt).
basicpart(nut).
basicpart(fork).
assembly(bike, [wheel, wheel, frame]).
View Quadstore.kt
import it.unimi.dsi.fastutil.objects.ObjectAVLTreeSet
data class Quad(val s: String = "", val p: String = "", val o: Comparable<Any>? = null, val c: String = "") :
Comparable<Quad> {
override fun compareTo(other: Quad): Int = compareValuesBy(this, other, Quad::s, Quad::p, Quad::o, Quad::c)
override fun toString(): String = "Q<S=$s P=$p O=$o C=$c>"
}
@EmmanuelOga
EmmanuelOga / XsltSparql.kt
Created Jan 11, 2021
Run SPARQL queries from Saxon using Rdf4J
View XsltSparql.kt
package com.emmanueloga.xml
import com.emmanueloga.Config
import com.emmanueloga.FISHX
import com.emmanueloga.NAMESPACES
import com.emmanueloga.logger
import net.sf.saxon.s9api.*
import net.sf.saxon.s9api.ItemType.*
import net.sf.saxon.s9api.OccurrenceIndicator.*
import net.sf.saxon.s9api.SequenceType.makeSequenceType
@EmmanuelOga
EmmanuelOga / website.rf
Last active Jan 20, 2021
Rainbowfish file format.
View website.rf
.prefix : "https://emmanueloga.com/"
.prefix dc: "https://dc.com/rdf"
.prefix rdf: "https://w3.org/rdf"
.prefix rf: "https://rainbow.fish/"
.prefix schema: "https://google.com/schema"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rf:topic(:)
@EmmanuelOga
EmmanuelOga / package.json
Last active Dec 9, 2020
Nice reloadable boilerplate for JavScript projects with esbuild, chokidar and browser-sync.
View package.json
{
"devDependencies": {
"browser-sync": "^2.26.13",
"chokidar": "^3.4.3",
"esbuild": "^0.8.21"
},
"dependencies": {
"cytoscape": "^3.17.0",
"lodash": "^4.17.20"
},
@EmmanuelOga
EmmanuelOga / short.request
Last active Nov 30, 2020
Caddy verbose and short configurations
View short.request
GET http://localhost:2019/config/
HTTP/1.1 200 OK
Content-Type: application/json
Date: Mon, 30 Nov 2020 11:58:35 GMT
Content-Length: 389
Connection: close
{
"apps": {
@EmmanuelOga
EmmanuelOga / tdb-query.json
Created Nov 30, 2020
A fishy unicode character in a TDB query
View tdb-query.json
{
"@type": "woql:And",
"woql:query_list": [
{
"@type": "woql:QueryListElement",
"woql:index": {
"@type": "xsd:nonNegativeInteger",
"@value": 0
},
"woql:query": {
@EmmanuelOga
EmmanuelOga / schema.nquads
Created Nov 28, 2020
A TerminusDB request to add a schema of Topics
View schema.nquads
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <woql:When> ;
<woql:consequent> _:b1 ;
<woql:query> _:b102 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <woql:And> ;
<woql:query_list> _:b12, _:b17, _:b2, _:b22, _:b27, _:b32, _:b37, _:b42, _:b47, _:b52, _:b57, _:b62, _:b67, _:b7, _:b72, _:b77, _:b82, _:b87, _:b92, _:b97 .
_:b10 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <woql:Node> ;
<woql:node> "rdfs:subClassOf" .
@EmmanuelOga
EmmanuelOga / json-ld.js
Created Nov 27, 2020
From JSON-LD to TriG, requires "jsonld" and "n3" npm packages.
View json-ld.js
import * as jsonld from "jsonld";
import * as n3 from "n3";
const doc = { "YOUR" : "JSONLD" };
const nquads = await jsonld.toRDF(doc, { format: "application/n-quads" });
const parser = new n3.Parser({ format: "application/n-quads" });
const writer = new n3.Writer({ format: "application/trig" });
await parser.parse(nquads, (error, quad, prefixes) => {