Skip to content

Instantly share code, notes, and snippets.

View edsu's full-sized avatar

Ed Summers edsu

View GitHub Profile
# RESTful Web Services Cookbook
# http://oreilly.com/catalog/9780596801694
# rdf courtesy of O'Reilly and W3C's RDFa Distiller
curl 'http://www.w3.org/2007/08/pyRdfa/extract?uri=http://oreilly.com/catalog/9780596801694&format=turtle'
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix frbr: <http://vocab.org/frbr/core#> .
@prefix gr: <http://purl.org/goodrelations/v1#> .
(function (a) {
a.browserTest = function (e, g) {
var f = "unknown",
d = "X",
b = function (k, j) {
for (var c = 0; c < j.length; c = c + 1) {
k = k.replace(j[c][0], j[c][1])
}
return k
},
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX lcsh: <http://id.loc.gov/authorities#>
SELECT ?c1 ?c2
WHERE {
?c1 skos:inScheme ?cs1 ;
skos:prefLabel ?l1 ;
skos:broader ?c2 .
?c2 skos:prefLabel ?l2 ;
skos:inScheme ?cs2 .
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:mods="http://www.loc.gov/mods/v3">
<title>Madame Bovary</title>
<id>http://www.feedbooks.com/book/2042</id>
<updated>2009-09-16T11:33:04Z</updated>
<author>
<name>Gustave Flaubert</name>
<uri>http://www.feedbooks.com/author/127</uri>
</author>
<contributor>
<?xml version="1.0" encoding="UTF-8"?>
<role xmlns="http://www.loc.gov/mods/v3">
<roleTerm type="code" authority="marcrelator">trl</roleTerm>
</role>
ed@rorty:~/Projects/linkypedia$ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rdflib
>>> graph = rdflib.Graph()
>>> graph.parse('http://www.rottentomatoes.com/m/watchmen/', format='rdfa')
<Graph identifier=SBETbLNo0 (<class 'rdflib.graph.Graph'>)>
>>> for triples in graph:
... print triples
# OWL ontology for VIAF data
# rapper -o turtle http://viaf.org
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://viaf.org/>
a owl:Ontology ;
New NDNP Specs
batch_dlc_nirvana/
|-- bag-info.txt
|-- bagit.txt
|-- data
| `-- sn83030214
| |-- 1880-01-09
| | |-- ed-1
| | `-- image.tif
#!/usr/bin/env python
import pymarc
for record in pymarc.MARCReader(open('marc.dat')):
print record['245']['a']
<meta property="og:image" content="http://chroniclingamerica.loc.gov/lccn/sn85066387/1903-10-04/ed-1/seq-1/thumbnail.jpg" />
<meta property="og:title" content="The San Francisco call. (San Francisco [Calif.]) 1895-1913, October 04, 1903, Image 1" />
<meta property="og:description" content="The San Francisco call. (San Francisco [Calif.]) 1895-1913, October 04, 1903, Image 1, brought to you by University of California, Riverside; Riverside, CA, and the National Digital Newspaper Program." />