Skip to content

Instantly share code, notes, and snippets.

View njh's full-sized avatar

Nicholas Humfrey njh

View GitHub Profile
@njh
njh / gist:385526
Created April 30, 2010 17:34
Ruby code to build a fake FOAF social network of 20 people and insert it into RedStore
require 'rubygems'
require 'rdf'
require 'rdf/redstore'
require 'spira'
require 'faker'
class Person
include Spira::Resource
type RDF::FOAF.Person
#!/usr/bin/env ruby
require 'rubygems'
require 'spira'
require 'rdf'
include RDF
class Person
include Spira::Resource
@njh
njh / sinatra-linkeddata-example.rb
Created May 26, 2010 09:31
Example of using Sinatra and Spira with Rack::LinkedData for content negotiation.
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'spira'
require 'rack/linkeddata'
use Rack::LinkedData::ContentNegotiation, :default => 'text/turtle'
include RDF
@njh
njh / rdfa-load
Created June 3, 2010 11:30
Example of parsing RDFa into a graph
#!/usr/bin/env ruby
require 'rubygems'
require 'rdf/rdfa'
graph = RDF::Graph.load('http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml', :base_uri => 'http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml')
graph.each_statement do |statement|
statement.inspect!
end
#!/usr/bin/env ruby
require 'rubygems'
require 'rack/test'
require 'erb'
require 'rdf/json'
require 'rdf/rdfxml'
require 'rdf/ntriples'
require 'rdf/rdfa'
#!/usr/bin/env ruby
require 'rubygems'
require 'rdf'
require 'rdf/ntriples'
require 'rdf/rdfxml'
graph = RDF::Graph.new
diff --git a/src/rdf_init.c b/src/rdf_init.c
index 1509f1c..d2edac1 100644
--- a/src/rdf_init.c
+++ b/src/rdf_init.c
@@ -306,6 +306,45 @@ librdf_world_open(librdf_world *world)
/**
+ * librdf_world_set_rasqal:
+ * @world: librdf_world object
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
xmlns:mo="http://purl.org/ontology/mo/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<mo:Record>
<dc:title>Only Revolutions</dc:title>
diff --git a/src/raptor_uri.c b/src/raptor_uri.c
index f147bb9..cda374d 100644
--- a/src/raptor_uri.c
+++ b/src/raptor_uri.c
@@ -466,8 +466,11 @@ raptor_uri_compare(raptor_uri* uri1, raptor_uri* uri2)
if(uri1 == uri2)
return 0;
- if(uri1 && uri2)
- return strcmp((const char*)uri1->string, (const char*)uri2->string);
@njh
njh / build-minimal-php.pl
Last active September 23, 2015 19:07
Given a URL to a tarball, build a PHP CLI binary, with minimal dependancies.
#!/usr/bin/env perl
#
# Script to build a minimal version of PHP
#
# https://gist.github.com/njh/601712
#
use File::Basename;
use strict;