Skip to content

Instantly share code, notes, and snippets.

View jeswr's full-sized avatar
🚀
building the things

Jesse Wright jeswr

🚀
building the things
View GitHub Profile
var SWIPL = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(SWIPL) {
SWIPL = SWIPL || {};
var Module = typeof SWIPL != "undefined" ? SWIPL : {};
var readyPromiseResolve, readyPromiseReject;
Module["ready"] = new Promise(function(resolve, reject) {
import { QueryEngine } from '@comunica/query-sparql-solid';
(async () => {
const qpfEndpoint = 'https://fragments.dbpedia.org/2016-04/en';
const myEngine = new QueryEngine();
const query = '?s ?p ?o'
const logStream = await myEngine.queryBindings(`
PREFIX dcterms: <http://purl.org/dc/terms/>
SELECT * WHERE {
?s ?p ?o
(?p1 http://www.w3.org/2002/07/owl#sameAs ?p2) ^ (?p1 ?pp ?o) -> (?p2 ?pp ?o)
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
foaf:Person owl:sameAs <http://example.org/jesse#Person> .
This specification MUST be implmented by POD providers.
The Background Agent Service Specification (BASS) is developed as a way to enable *internet based* agents to *READ*, *MODIFY* and *WRITE* to PODS.
If there is a file `./agents.(ttl|rdf|xml|...)` located in the ROOT of a users POD then the provider MUST attempt to parse the file - if the file contains valid RDF data then it MUST execute the following logic
# Note this step may not be necessary, or, may be generalized to more similar contexts
?1) MUST apply RDF reasoning over the file, BASS ontology, and all imports of the BASS ontology. For security reasons, imports from the agents file SHOULD NOT be included.
2) TODO: Discuss how a file that looks like what is below should be processed
public async execute({ rules, context }: IActionRdfReasonExecute): Promise<void> {
const nodes: IRuleNode[] = rules.map(rule => ({ rule, next: [] }));
// Creating rule dependencies
for (const n1 of nodes) {
for (const n2 of nodes) {
if (n1.rule.conclusion === false) {
continue;
}
@jeswr
jeswr / test.ts
Created March 24, 2022 02:55
AsyncIterator Performance Testing
import { CLOSED, ENDED } from 'asynciterator';
import { ArrayIterator as OldArrayIterator } from 'asynciterator';
import { ArrayIterator, AsyncIterator, range } from './asynciterator'
type Transform = {
type: 'filter';
function: (elem: any) => boolean
} | {
type: 'map';
function: (elem: any) => any
@jeswr
jeswr / gist:e17029d06a5cf25ce2c59eae4196a5a5
Created March 24, 2022 02:54
AsyncIterator performance tests
import { CLOSED, ENDED } from 'asynciterator';
import { ArrayIterator as OldArrayIterator } from 'asynciterator';
import { ArrayIterator, AsyncIterator, range } from './asynciterator'
type Transform = {
type: 'filter';
function: (elem: any) => boolean
} | {
type: 'map';
function: (elem: any) => any
@jeswr
jeswr / next-infer.hylar
Created December 31, 2021 14:13
next-infer
(?uuu rdfs:subClassOf ?xxx) ^ (?vvv rdf:type ?uuu) -> (?vvv rdf:type ?xxx)
@jeswr
jeswr / hylar
Created December 28, 2021 00:12
owl2rl
(?p http://www.w3.org/2000/01/rdf-schema#domain ?c) ^ (?x ?p ?y) -> (?x http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?c)
(?p http://www.w3.org/2000/01/rdf-schema#range ?c) ^ (?x ?p ?y) -> (?y http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?c)
(?p http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#FunctionalProperty) ^ (?x ?p ?y1) ^ (?x ?p ?y2) -> (?y1 http://www.w3.org/2002/07/owl#sameAs ?y2)
(?p http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#InverseFunctionalProperty) ^ (?x1 ?p ?y) ^ (?x2 ?p ?y) -> (?x1 http://www.w3.org/2002/07/owl#sameAs ?x2)
(?p http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#IrreflexiveProperty) ^ (?x ?p ?x) -> false
(?p http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#SymmetricProperty) ^ (?x ?p ?y) -> (?y ?p ?x)
(?p http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2002/07/owl#AsymmetricProperty) ^ (?x ?p ?y) ^ (?y ?p ?x) -> false
(?p http://www.w3.or