Skip to content

Instantly share code, notes, and snippets.

View jamesshipton's full-sized avatar

James Shipton jamesshipton

View GitHub Profile
@jamesshipton
jamesshipton / sesame_connection.rb
Created May 11, 2011 15:53
Ruby::TripleStore::Sesame connect to triplestore using sesame and find statements
require 'java'
dir = Dir.new('***classpath_dir***')
dir.each {|file| $CLASSPATH << dir.path + file if file.end_with?('jar')}
java_import org.openrdf.repository.Repository;
java_import org.openrdf.repository.RepositoryConnection;
java_import org.openrdf.repository.http.HTTPRepository;
java_import org.openrdf.model.URI;
java_import org.openrdf.repository.RepositoryException;
@jamesshipton
jamesshipton / n3_to_json.rb
Created May 11, 2011 15:51
Ruby::TripleStore::Tripod - convert n3 to rdf/json
require 'java'
dirs = [Dir.new('***classpath_dir***')]
dirs.each {|dir| dir.each{|file| $CLASSPATH << dir.path + file if file.end_with?('jar')}}
java_import '***.ContentNegotiator'
java_import '***.JsonRdfSerializer'
java_import '***.JenaOntologyHelper'
@jamesshipton
jamesshipton / ruby_triple_store_jena.rb
Created May 11, 2011 15:17
Ruby::TripleStore::Jena input an rdf/xml file, with reified addition/removals for a changeset and output either the additions or removals as triples
require 'java'
dir = Dir.new("***CLASSPATH_DIR***")
dir.each {|file| $CLASSPATH << dir.path + file if file.end_with?('jar')}
java_import com.hp.hpl.jena.rdf.model.ModelFactory;
java_import com.hp.hpl.jena.rdf.model.impl.StatementImpl;
java_import java.lang.System;