Skip to content

Instantly share code, notes, and snippets.

Ed Summers edsu

Block or report user

Report or block edsu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:95291
ed@anvil:~$ grep edit /var/log/apache2/openfrbr.org-access.log | cut -f 1 -d ' ' | sort | uniq -c | sort -rn |less
55188 83.233.30.10
14116 94.76.213.204
13624 212.117.188.45
13552 212.117.188.49
11471 212.117.188.133
9877 89.149.208.29
1096 66.249.65.195
816 194.8.74.124
768 208.250.9.1
@edsu
edsu / chronam-rdf.py
Created May 22, 2009
some code to turn some django models into rdf for the chroniclingamerica.loc.gov application
View chronam-rdf.py
from rdflib import ConjunctiveGraph, Namespace, Literal, URIRef, RDF, RDFS
from chronam.utils.rfc3339 import rfc3339
DC = Namespace('http://purl.org/dc/elements/1.1/')
ORE = Namespace('http://www.openarchives.org/ore/terms/')
OWL = Namespace('http://www.w3.org/2002/07/owl#')
RDA = Namespace('http://rdvocab.info/elements/')
XSD = Namespace('http://www.w3.org/2001/XMLSchema#')
BIBO = Namespace('http://purl.org/ontology/bibo/')
View link_places.py
View flickr_chronam.py
#!/usr/bin/env python
"""
Print out a list of links between Flickr and Chronicling America. These are newspaper pages that have had images extracted from them, that have been uploaded to Flickr by Dave Woodward.
"""
import json
import urllib
# http://www.flickr.com/services/api/keys/
View 3831554.ttl
ed@rorty:~$ rapper -o turtle http://sws.geonames.org/3831554/
rapper: Parsing URI http://sws.geonames.org/3831554/ with parser rdfxml
rapper: Serializing with serializer turtle
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://www.geonames.org/ontology#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
<http://sws.geonames.org/3831554/>
View its_all_relative.py
import rdflib
from rdflib import ConjunctiveGraph, URIRef
g = ConjunctiveGraph()
g.add((URIRef('/foo'), URIRef('/bar'), URIRef('/baz')))
g.serialize(base="http://example.com", include_base=True)
View quote.html
<html>
<body xmlns:bibo="http://purl.org/ontology/bibo/"
xmlns:dct="http://purl.org/dc/terms/">
<blockquote about="#quote5" typeof="bibo:Quote">
<p property="bibo:content">
... paper documents, and indeed all documents are static
<em>and</em> changing, fixed <em>and</em> fluid. There is a reason why text and
graphics editors have a Save button, after all.
</p>
<cite>
View quote.ttl
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://inkdroid.org/journal/2009/09/10/documents/#quote5> a bibo:Quote ;
dct:source <http://openlibrary.org/b/OL3947422M> ;
bibo:content "… paper documents, and indeed all documents are static <em xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">and</em> changing, fixed <em xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">and</em> fluid. There is a reason why text and graphics editors have a Save button, after all."^^rdf:XMLLiteral ;
bibo:pages "36"@en .
View linked_decorator.py
"""
Linked data decorator hack for rdf/xml and html representations:
def company(request, company_id):
# return html for company
...
@rdf_view
def company_rdf(request, company_id):
# return rdf/xml for company
We couldn’t find that file to show.
You can’t perform that action at this time.