Skip to content

Instantly share code, notes, and snippets.

View dajobe's full-sized avatar

Dave Beckett dajobe

View GitHub Profile
def namespaces_seen(self):
"""Get a dictionary of prefix/URI pairs for namespaces seen during parsing.
"""
count = Redland.librdf_parser_get_namespaces_seen_count(self._parser)
nspaces={}
for index in range(0, count-1):
prefix=Redland.librdf_parser_get_namespaces_seen_prefix(self._parser, index)
uri_obj=Redland.librdf_parser_get_namespaces_seen_uri(self._parser, index)
if uri_obj is None:
uri=None
@dajobe
dajobe / sqlite3.h.patch
Created August 12, 2009 16:38
patch to sqlite3.h 3.6.17 header to make it usable again. See also gentoo bug http://bugs.gentoo.org/281226 for redland and sqlite bug http://www.sqlite.org/cvstrac/chngview?cn=6971
--- /opt/local/include/sqlite3.h.broken 2009-08-12 09:19:35.000000000 -0700
+++ /opt/local/include/sqlite3.h 2009-08-12 09:33:27.000000000 -0700
@@ -56,10 +56,6 @@
#endif
-#ifndef SQLITE_API
-# define SQLITE_API
-#endif
-
#!/usr/bin/perl -pi~
if(!/^\s+\*/) {
# Skip lex <TOKEN> lines
if(!/^</) {
# Put spaces around assignment and comparitor ops
s{([\w\)\]])([=<>]|==)([\w\(\[])}{$1 $2 $3}g;
s{(\S)([-+*/~|=]=)(\S)}{$1 $2 $3}g;
}
diff --git a/src/raptor_uri.c b/src/raptor_uri.c
index 888c266..10b1c56 100644
--- a/src/raptor_uri.c
+++ b/src/raptor_uri.c
@@ -439,9 +439,12 @@ raptor_uri_equals(raptor_uri* uri1, raptor_uri* uri2)
if(uri1 == uri2)
return 1;
else if (uri1->length != uri2->length)
+ /* Different if lengths are different */
return 0;
$ cat tests/sparql/examples/ex11_0.rq
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?annot
WHERE { ?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> .
?annot dc:created ?date .
FILTER ( ?date < xsd:dateTime("2005-01-01T00:00:00Z") ) }
@dajobe
dajobe / roqet-sparql-protocol.log
Created October 18, 2010 06:26
sparql protocol
$ utils/roqet -r table -p http://triplr.org/sparql 'PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?nick, ?name FROM <http://www.dajobe.org/foaf.rdf> WHERE { ?x a foaf:Person . ?x foaf:nick ?nick . ?x foaf:name ?name } ' 2>/dev/null
----------------------------------------------------
| nick | name |
====================================================
| string("danbri") | string("Dan Brickley") |
| string("libby") | string("Libby Miller") |
| string("sbp") | string("Sean B. Palmer") |
| string("ndw") | string("Norm Walsh") |
| string("mortenf") | string("Morten Frederiksen") |
| string("zool") | string("Jo Walsh") |
@dajobe
dajobe / matplotlib-debian.txt
Created February 1, 2011 18:19
Strata big data bootcamp matplotlib work in debian
Debian way to do the data bootcamp matplotlib work
Install packages
$ sudo apt-get install python-matplotlib python-scipy
NOTE 1: You MUST have X running and DISPLAY set for the plt.plot step.
NOTE 2: Slides have a typo. Use random_numbers for both lines
Render:
@dajobe
dajobe / test-b13.log
Created February 3, 2011 19:10
rdql test B-13
$ cd rasqal-0.9.24
$ PATH=$PWD/utils:$PATH
$ type -a roqet
roqet is /Users/dajobe/dev/redland/rasqal/releases/rasqal-0.9.24/utils/roqet
roqet is /Users/dajobe/bin/roqet
$ cd tests/rdql/testsuite/
@dajobe
dajobe / turtle-streaming-parser.log
Created May 11, 2011 05:10
Raptor2 streaming Bison parsing for Turtle and TRiG. NOT streaming lexing yet
# raptor GIT head
$ utils/rapper -c -i trig part-m-00008.trig
lt-rapper: Parsing URI file:///home/dajobe/dev/redland/raptor/part-m-00008.trig with parser trig
lt-rapper: Parsing returned 1737049 triples
# raptor 2.0.2 release
$ /usr/bin/rapper -c -i trig part-m-00008.trig
rapper: Parsing URI file:///home/dajobe/dev/redland/raptor/part-m-00008.trig with parser trig
rapper: Error - URI file:///home/dajobe/dev/redland/raptor/part-m-00008.trig:56164 - memory exhausted
@dajobe
dajobe / gist:1008454
Created June 4, 2011 22:50
rasqal_expression variable binding ambiguity
; Current API cannot distinguish these since (variable, binding expr) are in same
; structure identified globally by variable name.
1.
SELECT ((1+1) AS ?foo)
WHERE { ... }
GROUP BY ?foo
2.