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
#!/bin/bash | |
# usage: rdfdiff <file1> <file2> [git-diff options...] | |
# set base URI with the BASE environment variable, if necessary | |
# requires a "release" build of sophia examples 'parse' and 'canonicalize' | |
# in a clone of https://github.com/pchampin/sophia_rs | |
# indicated by SOPHIA_HOME (defaults to ~/dev/sophia_rs) | |
# | |
# To produce them, run |
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
@prefix s: <http://schema.org/>. | |
# simple (unqualified) statement | |
:dr_strangelove a s:Movie ; | |
s:actor :peter_sellers. | |
# RDF-star with "ocurrence" nodes |
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
#!/usr/bin/env python | |
# | |
# Command-line JSON-LD processor based on PyLD | |
# | |
# Copyright © 2021-2022 Pierre-Antoine Champin <[email protected]> | |
import argparse | |
import json | |
import sys | |
from urllib.parse import urljoin, urlsplit |
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
#!/usr/bin/env python3 | |
""" | |
This script checks different triple stores implementing RDF*, | |
to see how opaque/transparent are the terms used in embedded triples. | |
""" | |
from sys import argv, stderr | |
import base64 | |
try: | |
import requests | |
except: |
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
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. | |
@prefix math: <http://www.w3.org/2000/10/swap/math#>. | |
@prefix : <#>. | |
{ (?lst 1) :memberAt ?elt } <= { ?lst rdf:first ?elt. }. | |
{ (?lst ?i) :memberAt ?elt } <= { ?lst rdf:first ?elt. ?i math:equalTo 1. }. | |
{ (?lst ?i) :memberAt ?elt } <= { ?lst rdf:rest ?rest. (?rest ?j) :memberAt ?elt. (?j 1) math:sum ?i. }. | |
{ ((41) 1) :memberAt 41 } => { :TEST :PASS 1 }. | |
{ ((41) 1.0) :memberAt 41 } => { :TEST :PASS 2 }. |
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 is an experiment on how to get rid of lifetime parameters in | |
//! Sopghia's Graph and Dataset traits. It demonstrates the general idea | |
//! on a simplified version of Triple and Graph. | |
//! | |
//! Graph iterators no longer return Graph::Triple's, | |
//! they return a safe abstraction around it: GuardedTRiple<'a, Graph::Triple>. | |
//! | |
//! Graph::Triple itself can be one of several options: | |
//! * T (where T implements Triple) | |
//! * *const T (where T implements Triple) |
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
from collections import namedtuple | |
from timeit import default_timer | |
from itertools import repeat | |
class Classic(object): | |
def __init__(self, a, b, c): | |
self.a = a | |
self.b = b | |
self.c = c |
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
from rdflib import BNode, URIRef | |
from rdflib.plugins.stores.sparqlstore import SPARQLUpdateStore, _node_to_sparql, _node_from_result, SPARQL_NS | |
from uuid import uuid4 | |
def _virtuoso_compatible_generator(): | |
return unicode(uuid4().int % 2**61) | |
# monkey patch BNode to make it virtuoso compatible | |
BNode.__new__.func_defaults = (None, _virtuoso_compatible_generator, 'b') |
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
/* global Promise */ | |
/** | |
* An IterablePromise is used to combine the ease of use of loops, | |
* with the power of Promises. | |
* | |
* Assume you want to apply an asynchronous function process(), | |
* returning a Promise, to each item of an array ``a``, | |
* but wait for each element to be processed before processing the next one. | |
* You would do it like this: |
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
#!/usr/bin/env python | |
""" | |
This simple service is aimed at web application developers. It allows them to | |
specify in the URL the HTTP response they want to get, in order to test the | |
behaviour of client codes. | |
The PATH_INFO is the desired status code, optionnally followed by a custom | |
message, e.g.: | |
/200 |
NewerOlder