This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Lookup PMIDS and parse the returned metadata into the BibJSON format. | |
See: http://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch | |
""" | |
from lxml import etree | |
import urllib | |
from pprint import pprint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<link rel="stylesheet" href="http://blueprintcss.org/blueprint/screen.css" type="text/css"> | |
<link rel="stylesheet" href="http://blueprintcss.org/blueprint/plugins/fancy-type/screen.css" type="text/css" media="screen, projection"> | |
<style> | |
body { | |
padding: 3em; | |
} | |
h2 a, a.number:hover, p.startover a:hover { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check to see if a given integer is prime. | |
* | |
* Adapted from this Python implementation http://pthree.org/2007/09/05/prime-numbersin- python/ | |
* This list of the first 10,000 prime numbers is also helpful http://primes.utm.edu/lists/small/10000.txt | |
* | |
* @param int $number the number to check to see if it is prime. | |
* @return boolean true if the number is prime, false if not. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- test.php ---- | |
/** | |
* Unit tests for the prime number calculator included | |
* | |
* | |
*/ | |
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#removes expired searches in Vufind search history table | |
EXPIRE_DATE=`date --date="-2 day" +%Y-%m-%d` | |
echo "Vufind - deleting expired search sessions from $EXPIRE_DATE." | |
mysql -u $1 --password=$2 -e "delete from search where (saved=0 AND created<=\"${EXPIRE_DATE}\")" vufind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Vivo vocab generated with jena.schemagen. | |
""" | |
from com.hp.hpl.jena.rdf.model import * | |
from com.hp.hpl.jena.ontology import * | |
class Vivo(object): | |
def __init__(self): | |
m_model = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM, None ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Use saxon to do XSLT with Jython | |
See http://codingwithpassion.blogspot.com/2011/03/saxon-xslt-java-example.html | |
Pass in arguments | |
- 1 xslt | |
- 2 xml source | |
- 3 xml output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Get the nextURI for the given namespace. | |
Jython interpretation of getNextURI here: | |
http://svn.code.sf.net/p/vivo/vitro/code/branches/dev-sdb/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/jena/JenaIngestUtils.java | |
""" | |
def get_next_uri(namespace, model): | |
from com.hp.hpl.jena.rdf.model import SimpleSelector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env jython | |
""" | |
Load a graph into a given SDB model. | |
""" | |
import glob | |
import sys | |
import os | |
import optparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from SPARQLWrapper import SPARQLWrapper, JSON, N3 | |
exists = """ | |
SELECT * | |
WHERE { | |
OPTIONAL{<%(next_uri)s> ?p ?o}. | |
OPTIONAL{?s2 ?p2 <%(next_uri)s>}. | |
} | |
""" |