Skip to content

Instantly share code, notes, and snippets.

View timathom's full-sized avatar

Tim Thompson timathom

  • Yale University Library
  • New Haven, CT
View GitHub Profile
@timathom
timathom / jaro-winkler.xqy
Last active February 27, 2024 04:59
Jaro-Winkler similarity in XQuery 4.0
xquery version "4.0";
(:~
:
: Module Name: Jaro-Winkler String Similarity
: Date: February 26, 2024
: License: GPLv3
: XQuery specification: 4.0
: Dependencies: BaseX 11.0
: @author @timathom
@timathom
timathom / basex11beta.xq
Last active November 22, 2023 15:08
Issue in BaseX 11.0 beta?
let $data := map {
"warner bros": [map {
"match": "true",
"uri": "http://id.loc.gov/authorities/names/n50028315 http://id.loc.gov/authorities/names/n85138180 http://id.loc.gov/authorities/names/no2003017455",
"index-type": "x",
"entry-id": "60021fec-672e-4f09-a160-197c1e2c97e1",
"tags": "710",
"lookup": "warner bros",
"source": <key>warner bros</key>,
"file": "lcnaf-2023"

Keybase proof

I hereby claim:

  • I am timathom on github.
  • I am tat2 (https://keybase.io/tat2) on keybase.
  • I have a public key ASCqGFoEyzQPciI6A7rHDldoMusJNh3molcN1xXDoYuG_Ao

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1N1sGc9X21nZXSHiZFnJ8Jbcf1Q24KrzZy https://explorer.blockstack.org/address/1N1sGc9X21nZXSHiZFnJ8Jbcf1Q24KrzZy
@timathom
timathom / pymarc_disco.py
Created September 21, 2017 15:28 — forked from anarchivist/pymarc_disco.py
sample MapReduce tasks for Disco to get tag counts from MARC files/streams
#!/usr/bin/env python
#
# pymarc_disco.py - Mark Matienzo
# sample MapReduce tasks for Disco to get tag counts from MARC files/streams
# usage: python pymarc_disco.py <input1> [input2 ... inputN]
import sys
from disco.core import Disco, result_iterator
from disco.settings import DiscoSettings
import pymarc
@timathom
timathom / turtle.xml
Created March 3, 2016 20:44
Turtle EBNF syntax tree in XML
<?xml version="1.0" encoding="UTF-8"?>
<turtleDoc>
<statement>
<directive>
<prefixID>
<TOKEN>@prefix</TOKEN>
<PNAME_NS>bf:</PNAME_NS>
<IRIREF>&lt;http://bibframe.org/vocab/&gt;</IRIREF>
<TOKEN>.</TOKEN>
</prefixID>
@timathom
timathom / basex-async.xq
Last active March 21, 2016 13:41
Anonymous inline function with asynchronous evaluation in BaseX
(:~
: Anonymous inline function with asynchronous evaluation in BaseX 8.4.1 beta
:
: @param $query Asynchronously evaluated query
: @return XQuery expression, followed by result of async HTTP request.
:
: BaseX Async Module:
: http://docs.basex.org/wiki/Async_Module
:
: Dimitre Novatchev on recursion with anonymous inline functions in XPath 3.0:
@timathom
timathom / turtle.xqm
Created February 26, 2016 17:19
XQuery Turtle parser (generated by Gunther Rademacher's REx)
xquery version "1.0" encoding "UTF-8";
(: This file was generated on Sat Feb 13, 2016 20:32 (UTC-05) by REx v5.35 which is Copyright (c) 1979-2015 by Gunther Rademacher <grd@gmx.net> :)
(: REx command line: turtle.ebnf -faster -xquery -tree :)
(:~
: The parser that was generated for the turtle grammar.
:)
module namespace p="turtle";
declare default function namespace "http://www.w3.org/2005/xpath-functions";
@timathom
timathom / get-turtle.xhtml
Last active September 7, 2016 06:34
XForms doc and RESTXQ module for retrieving Turtle RDF data
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?><?xsltforms-options debug="no"?><?css-conversion no?><?xml-model href="http://www.oxygenxml.com/1999/xhtml/xhtml-xforms.nvdl" schematypens="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:cwb="http://example.org/cwb/"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
@timathom
timathom / sparql-query.xhtml
Last active March 17, 2016 23:08
XForms submission to request non-XML RDF formats from a SPARQL endpoint (DBpedia)
<?xml-stylesheet href="../build/xsltforms.xsl" type="text/xsl"?><?xsltforms-options debug="no"?><?css-conversion no?><?xml-model href="http://www.oxygenxml.com/1999/xhtml/xhtml-xforms.nvdl" schematypens="http://purl.oclc.org/dsdl/nvdl/ns/structure/1.0"?>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:cwb="http://example.org/cwb/"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xs="http://www.w3.org/2001/XMLSchema"