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 coordination.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rda: <http://RDVocab.info/Elements/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix lcsh: <http://id.loc.gov/authorities/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix ex: <http://example.org/coordination#> .
<http://lccn.heroku.com/36029351#i>
rda:titleProper "Charlotte Temple" ;
dct:subject [
View crawlable
#!/usr/bin/env python
import sys
import urlparse
import robotparser # yes it's part of the python core!
try:
ua, url = sys.argv[0:2]
except:
print "usage: crawlable googlebot http://example.com/awesome.html"
View urls.py
from routes import Mapper
map = Mapper()
map.connect('book', '/book/{isbn}', controller='item', action='book')
map.connect('journal', '/journal/{issn}', controller='item', action='journal')
View oreilly-rdfa.py
#!/usr/bin/env python
"""
Extract some RDF from O'Reilly's not well-formed Book Catalog RDFa.
"""
from rdflib.graph import ConjunctiveGraph
g = ConjunctiveGraph()
g.parse('http://oreilly.com/catalog/9780596516499/', format='rdfa', lax=True)
View quads.py
#!/usr/bin/env python
from rdflib.graph import ConjunctiveGraph
g = ConjunctiveGraph()
g.parse("http://inkdroid.org/journal/network", format='rdfa', lax=True)
g.parse("http://danbri.org/words/network", format='rdfa', lax=True)
for q in g.quads((None, None, None)):
print q
View amps.py
#!/usr/bin/env python
"""
Look for odd ampersands in URIs in O'Reilly data and print out the
context URI (where the assertions came from).
Output looks something like:
ed@inkdroid:~/bzr/oreilly-crawler$ ./amps.py
<http://oreilly.com/catalog/0636920001744/> a rdfg:Graph;rdflib:storage [a rdflib:Store;rdfs:label 'Sleepycat'].
<http://oreilly.com/catalog/9781593271749/> a rdfg:Graph;rdflib:storage [a rdflib:Store;rdfs:label 'Sleepycat'].
View scottros.txt
# generated with http://inkdroid.org/bzr/twitterator/friends.py
Adam from Twibes [twibes]
Felicity Barringer [felicitybarr]
George Frink [gwfrink3]
Dharmishta Rood [Dharmishta]
Adina Levin [alevin]
Keith Dawson [kdawson]
Ann Handley [MarketingProfs]
Michael Kinsley [michaelkinsley]
View rdflib_nosetests.txt
ed@rorty:~/Projects/rdflib$ python setup.py nosetests --tests rdflib.graph
running nosetests
running egg_info
unrecognized .svn/entries format; skipping .
writing rdflib.egg-info/PKG-INFO
error: rdflib.egg-info/PKG-INFO: Permission denied
View ez_setup_install.txt
ed@rorty:~$ sudo python ez_setup.py
Downloading http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
Processing setuptools-0.6c11-py2.6.egg
Copying setuptools-0.6c11-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Removing setuptools 0.6c9 from easy-install.pth file
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.6 script to /usr/local/bin
Installed /usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg
View test_output
Failed example:
print triples_to_n3(cg2-cg1)
Expected:
<http://example.org> <http://example.org/ns#rel> <http://example.org/b> .
<http://example.org> <http://example.org/ns#rel> _:cb1634787881 .
_:cb1634787881 <http://example.org/ns#label> "B" .
Got:
<http://example.org> <http://example.org/ns#rel> <http://example.org/b> .
<http://example.org> <http://example.org/ns#rel> _:cb8496374808470151721 .
_:cb8496374808470151721 <http://example.org/ns#label> "B" .
You can’t perform that action at this time.