Skip to content

Instantly share code, notes, and snippets.

View kefo's full-sized avatar

Kevin Ford kefo

View GitHub Profile
@kefo
kefo / gist:9506057
Created March 12, 2014 12:35
Handsome coding mistake
000500170000800800410002
800800410002503500210006690600450008
503500210006690600450008701000170013201500120014
690600450008701000170013201500120014902000120016104000180017
701000170013201500120014902000120016104000180017304100140019105000210020
201500120014902000120016104000180017304100140019105000210020524501270022626000480035
902000120016104000180017304100140019105000210020524501270022626000480035330000280040149000330042
104000180017304100140019105000210020524501270022626000480035330000280040149000330042950000170046250000620047
304100140019105000210020524501270022626000480035330000280040149000330042950000170046250000620047950400610054160000320060
105000210020524501270022626000480035330000280040149000330042950000170046250000620047950400610054160000320060260000500063470000200068
@kefo
kefo / Main.java
Created April 10, 2014 19:52
MARC2BIBFRAME using SaxonHE; supports try/catch and logging.
import java.io.FileReader;
import javax.xml.stream.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.dom.*;
/* Saxonica */
import net.sf.saxon.s9api.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@kefo
kefo / dc.html
Created May 2, 2014 19:41
DC in BFE
<!DOCTYPE html>
<html>
<head>
<title>BF Editor: Dublin Core Example</title>
<script type="text/javascript" src="http://bibframe.org/static/bfe/builds/bfe.min.js"></script>
<link rel="stylesheet" href="http://bibframe.org//static/bfe/builds/bfe.min.css" />
<script type="text/javascript">
function myCB(jsonld) {
@kefo
kefo / marcTxt-2-marcXML.xqy
Last active August 29, 2015 14:02
MARC/TXT to MARC/XML
declare namespace marcxml = "http://www.loc.gov/MARC21/slim";
let $mtexts := ('000 02018nas a2200433Ia 450
001 8277786
005 20140505165744.0
008 140505c198u9999cc uu p 0 e0chi d
035 __ |a (OCoLC)ocn879220545
040 __ |a CSt-H |b eng |c PULEA |d OCLCQ |d PULEA
035 __ |a (OCoLC)879220545
043 __ |a a-cc---
@kefo
kefo / test.html
Created July 15, 2014 15:25
zorba outputting variable unexpectedly
<?xml version="1.0" encoding="UTF-8"?>
<div class="row">hollowayemory1885whitmanwalt18191892leavesofgrassengworktext
<div>
<h4>hollowayemory1885whitmanwalt18191892leavesofgrassengworktext (3)</h4>
<div class="panel-group" id="hollowayemory1885whitmanwalt18191892leavesofgrassengworktext">
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-parent="#hollowayemory1885whitmanwalt18191892leavesofgrassengworktext" href="#hollowayemory1885whitmanwalt18191892leavesofgrassengworktext-2">5922543</a>
</div>
<div id="hollowayemory1885whitmanwalt18191892leavesofgrassengworktext-2" class="panel-collapse collapse">
@kefo
kefo / parse-PMYK.xqy
Created September 16, 2014 22:02
parse-PMYK.xqy
xquery version "3.0";
(:
to run:
zorba --serialize-html -f -q parse-PYMK.xqy -e pymkhtml:=file:///home/kefo/workspaces/li/litest.html > out.html
:)
(: IMPORTED MODULES :)
import module namespace http = "http://zorba.io/modules/http-client";
import module namespace file = "http://expath.org/ns/file";
@kefo
kefo / validation-links.html
Last active August 29, 2015 14:07
Validation Notes
@kefo
kefo / sample-mods-with-xsd.xml
Created October 9, 2014 16:29
Sample MODS with XSD
<?xml version="1.0"?>
<mods:mods version="3.5"
xsi:schemaLocation="http://www.loc.gov/mods/v3 http://3windmills.com/lsc615/xml-edit-validate/xsd/mods-3-5.xsd"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mods:titleInfo>
<mods:nonSort>The </mods:nonSort>
<mods:title>Atlantic polka</mods:title>
</mods:titleInfo>
<mods:name>
@kefo
kefo / transitive-closure-with-paths.xqy
Created January 12, 2015 22:38
ML Semantics - transitive closure, with path AND labels.
(:
The bulk of this comes from this gentleman's masterful work found here:
https://github.com/freshie/ml-semantics/blob/master/transitive-closure-with-paths.xqy
I have made it so that the prefLabel (assuming SKOS) comes along with the URI of the node.
This code was taken from the marklogic Semantics functions and was rework in order to have paths shown
:)
xquery version "1.0-ml";
@kefo
kefo / snac2lcnaf.py
Created May 22, 2012 12:52
SNAC 2 ID URIs
#!/usr/bin/env python
"""
This script takes all LC names in the SNAC data dump and tries
to resolve them to ID.LOC.GOV URIS. It requires rdflib to be installed
and outputs an RDF/XML file. Gratitude to Ed Summers whose code at [1]
was used as a foundation.
Run: