Skip to content

Instantly share code, notes, and snippets.

View peterstadler's full-sized avatar

Peter Stadler peterstadler

View GitHub Profile
@peterstadler
peterstadler / cmif2graphml.xqm
Last active February 10, 2022 10:25
XQuery module for extracting network information (in GraphML format) from a CMIF file
xquery version "3.1" encoding "UTF-8";
(:~
: XQuery module for extracting network information (in GraphML format) from a CMIF file
:
: CMIF is the Correspondence Metadata Interchange format,
: see https://correspsearch.net/en/documentation.html
: GraphML is an XML-based file format for graphs,
: see http://graphml.graphdrawing.org
:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>Übersicht des Bestands der Musikabteilung der Staatsbibliothek zu Berlin in der WeGA</title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.css"/>
<script type="text/javascript" charset="utf8" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.js"></script>
</head>
<body>
@peterstadler
peterstadler / make-tei.sh
Last active December 17, 2019 13:16
use Docker to build the TEI Guidelines locally
#!/bin/sh
# Docker image to use for building the Stylesheets and TEI Guidelines
#IMAGE=teic/jenkins:dev
IMAGE=teic/teidev-docker
# local path to the TEI Guidelines repo you cloned from https://github.com/teic/tei
TEI_PATH=/Users/pstadler/repos/TEI
# local path to the TEI Stylesheets repo you cloned from https://github.com/teic/stylesheets
@peterstadler
peterstadler / make-stylesheets.sh
Last active December 17, 2019 13:16
use Docker to build the TEI Stylesheets locally
#!/bin/sh
# Docker image to use for building the Stylesheets and TEI Guidelines
#IMAGE=teic/teidev-docker
IMAGE=teic/jenkins
# local path to the TEI Stylesheets repo you cloned from https://github.com/teic/stylesheets
STYLESHEETS_PATH=/Users/pstadler/repos/TEI-Stylesheets
docker run --rm -v $STYLESHEETS_PATH:/stylesheet -w /stylesheet -it --entrypoint "make" $IMAGE $*
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xpath-default-namespace="http://www.w3.org/1999/xhtml"
version="2.0">
<!--
XSL script for transforming TEI readme files to Zenodo descriptions
-->
#!/usr/bin/env python3
# this script adds new (old) versions to the TEI zenodo space
# it assumes the zip archives in the current folder along with
# the readme files. Naming convention is `tei-x.x.x.zip` for the
# archives and `readme-x.x.x.html.xml`(!) for the readme files.
# NB: The readme files (which are to be found in the current release)
# need to be transformed first by tei2zenodo-readme.xsl
import requests
@peterstadler
peterstadler / check-gnds.sh
Last active December 10, 2019 07:36
Check Beacon File for outdated IDs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Script for checking GND IDs.
# 1. Grab all GNDs from the beacon file
# 2. Check every GND by making a HEAD request and see whether the returned status code is 303
import httplib
from urlparse import urlparse
@peterstadler
peterstadler / cmif2kml.xqm
Last active February 10, 2022 10:17
XQuery module for transforming CMIF files to KML
xquery version "3.1" encoding "UTF-8";
(:~
: XQuery module for extracting place information in KML from a CMIF file
:
: CMIF is the Correspondence Metadata Interchange format,
: see http://correspsearch.net/index.xql?id=participate_cmi-format
: The exported KML flavor is based on the europeana connect KML specification,
: see https://www.dropbox.com/s/httk62myn2tsi4p/M3.3.2_eConnect_KML_Specification_v1.0_UGOE.pdf
:)
xquery version "1.0";
declare function local:upload() {
let $filename := request:get-uploaded-file-name('file')
return
<results>
<message>File {$filename} has been stored.</message>
</results>
xquery version "3.1";
declare namespace tei="http://www.tei-c.org/ns/1.0";
(: location of the old translation spreadsheet – translated via oxGarage to TEI :)
declare variable $local:spreadsheet := doc('/db/apps/TEI/tei-de-i18n.xml');
(: location of the TEI ODD customizations :)
declare variable $local:customizations := collection('/db/apps/TEI/odd')//tei:schemaSpec;
(: location of p5subset.xml:)