Skip to content

Instantly share code, notes, and snippets.

@kburger
kburger / extract.py
Created November 4, 2025 13:00
Script to extract shapes from an ITB validator, output the shapes into one file per class, and attempt to generate a properties file for the SchemaTool.
from hashlib import md5
import requests
from rdflib import Graph, RDF, SH, DCAT, Namespace, Node, URIRef
from rdflib.namespace import split_uri
import yaml
ENDPOINT = "https://www.itb.ec.europa.eu/shacl/hda-be"
DASH = Namespace("http://datashapes.org/dash#")
IDX_PREDICATE = 1
@kburger
kburger / navigational-shapes.ttl
Last active May 1, 2020 07:32
Navigational structure for the core metadata shapes.
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix core: <http://purl.org/fair-metadata/shape/core#> .
@prefix r3d: <http://www.re3data.org/schema/3-0#> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
core:RepositoryShape # re-use shape identifier and therefore building on top of it? Or keep things separate?
a sh:NodeShape ;
sh:targetClass r3d:Repository ;
sh:property [
sh:path r3d:dataCatalog ; # or a custom mapped sub-property
@kburger
kburger / metadata.ttl
Created April 24, 2020 12:11
FAIR Metadata metadata model
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix meta: <http://purl.org/fair-metadata/shape/metadata#> .
@prefix x: <http://example.com/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
meta:MetadataShape a sh:NodeShape ;
sh:targetClass x:Metadata ;
sh:property [
sh:path dct:issued ;
@kburger
kburger / core-shapes.ttl
Last active April 28, 2020 06:05
Core shape definitions
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix core: <http://purl.org/fair-metadata/shape/core#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix r3d: <http://www.re3data.org/schema/3-0#> .
@prefix r3voc: <http://www.re3data.org/vocab/> .
@kburger
kburger / profile.ttl
Last active May 1, 2020 07:27
Core profile
@prefix core: <http://purl.org/fair-metadata/profile/core#> .
@prefix prof: <http://www.w3.org/ns/dx/prof/> .
@prefix role: <http://www.w3.org/ns/dx/prof/role> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
core:Profile a prof:Profile ;
rdfs:label "FAIR metadata profile" ;
rdfs:comment "" ;
@kburger
kburger / log.py
Created October 30, 2018 13:37
logging stuff
import threading
import time
import subprocess
from datetime import datetime
CMD = "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport"
ARGS = "-I"
quit_triggered = False
log = open('txrate.log', 'a')
@kburger
kburger / get-events.py
Created September 25, 2018 13:18
Python script to retrieve events from a calendar and print them
from __future__ import print_function
from oauth2client import file, client, tools
from googleapiclient.discovery import build
from httplib2 import Http
import datetime
SCOPE = 'https://www.googleapis.com/auth/calendar.readonly'
# for a python calendar API reference, see https://developers.google.com/resources/api-libraries/documentation/calendar/v3/python/latest/
@ApiOperation(value = "Raw search (returns ES response)")
@RequestMapping(value = {"/rs/**"}, method = {RequestMethod.GET, RequestMethod.POST, RequestMethod.HEAD} /*, produces = "text/json" */)
@ResponseStatus(HttpStatus.OK)
//@ResponseBody
public void rawSearch(@RequestBody(required = false) String body, HttpMethod method, HttpServletRequest request,
HttpServletResponse response, HttpEntity<String> httpEntity) throws FairSearchServiceException, IOException, Exception {
String server = "http://localhost:9200/";
String jsonContent = "";
URI uri;