Skip to content

Instantly share code, notes, and snippets.

View jindrichmynarz's full-sized avatar

Jindřich Mynarz jindrichmynarz

View GitHub Profile
@jindrichmynarz
jindrichmynarz / wikitrends.py
Last active July 7, 2019 18:42
Displays a graph of the most visited entities in Wikipedia, in Bash and Python versions
#!/usr/bin/env python3
from argparse import ArgumentParser, ArgumentTypeError
from datetime import date, datetime, timedelta
import json
import re
from string import Template
import urllib.parse
import urllib.request
import webbrowser
@jindrichmynarz
jindrichmynarz / count_class_instances_from_lod_laundromat.sh
Last active August 18, 2018 09:11
Count class instances from LOD Laundromat
#!/usr/bin/env bash
#
# A demo script that retrieves counts of class instances from LOD Laundromat datasets
# Usage:
# Reads a list of newline separated class IRIs either from its first argument or standard input.
# $ count_class_instances_from_lod_laundromat.sh < classes.txt
#
# Caveat:
# Since we use an old-school shell script, class IRIs that contain special characters,
# like %-encoding or commas will break the CSV output.
@jindrichmynarz
jindrichmynarz / obfuscate_rdf.ru
Created June 5, 2018 13:26
Basic obfuscation of RDF data using SHA hashes + UUID salt
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
###############
# Create salt #
###############
INSERT {
GRAPH :mappings {
@jindrichmynarz
jindrichmynarz / core_test.clj
Created November 12, 2015 22:31
Example of generative testing of a SOAP API in Clojure
(ns soap-test.core-test
(:require [clojure.test :refer :all]
[clojure.test.check.generators :as gen]
[clojure.test.check.properties :as prop]
[clojure.test.check.clojure-test :refer [defspec]]
[clj-soap.core :as soap :refer [obj->soap-str]]))
; Boilerplace method required by the clj-soap library
(defmethod obj->soap-str :currency [obj argtype] (str obj))
@jindrichmynarz
jindrichmynarz / generate_rdf.rq
Created April 7, 2017 09:44
Generate 0 to 10 random RDF triples
PREFIX : <http://localhost/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
CONSTRUCT {
?s ?p ?o .
}
WHERE {
# Generate 0 to 10 triples
VALUES ?n { 0 1 2 3 4 5 6 7 8 9 10 }
@jindrichmynarz
jindrichmynarz / cedr_download.sh
Created October 10, 2016 12:31
Stažení dumpů CEDRu
#!/bin/bash
#
# Stažení dumpů CEDRu
set -e
# URL SPARQL endpointu CEDRu
ENDPOINT="http://cedropendata.mfcr.cz/c3lod/cedr/sparql"
# SPARQL dotaz pro získání URL dumpů
@jindrichmynarz
jindrichmynarz / fuse_less_described.sparql
Last active October 6, 2016 20:53
Fuse subset descriptions
PREFIX : <http://example.com/>
DELETE {
?r1 ?outP ?outO .
?inS ?inP ?r1 .
}
INSERT {
?inS ?inP ?r2 .
}
WHERE {
@jindrichmynarz
jindrichmynarz / fuse_by_key.sparql
Created October 6, 2016 06:40
Fuse resources by key
PREFIX : <http://example.com/>
DELETE {
?r ?outP ?outO .
?inS ?inP ?r .
}
INSERT {
?sampleR ?outP ?outO .
?inS ?inP ?sampleR .
}
@jindrichmynarz
jindrichmynarz / fuse_equivalent_hashes.sparql
Created October 5, 2016 16:47
Fuse equivalent resources by hash
PREFIX : <http://example.com/>
DELETE {
?r ?outP ?outO .
?inS ?inP ?r .
}
WHERE {
{
SELECT (SAMPLE(?r) AS ?sampleR) ?hash
WHERE {
@jindrichmynarz
jindrichmynarz / data.ttl
Created October 5, 2016 16:43
Sample dataset for RDF data fusion
@prefix : <http://example.com/> .
:r1 a :C ;
:name "a" .
:r2 a :C ;
:name "a" .
:r3 a :C ;
:name "a" ;