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
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 |
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 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/') |
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
""" | |
Little utility for linking up Place model instances (from MARC 752 field) to dbpedia/geonames, extracting/persisting lon/lat, and saving off as JSON fixture. The JSON step is there so that | |
we don't have to do the lookups every time we set up a new instance of the application. | |
""" | |
import logging | |
import urllib2 | |
from django.core import serializers | |
from django.core.management.base import BaseCommand |
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 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/ |
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
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/> |
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
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) |
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
<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> |
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
@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 . |
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
""" | |
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 |