Skip to content

Instantly share code, notes, and snippets.

require 'java'
class Java::JavaLang::Object
def inspect()
fs = self.java_class.declared_fields
val = "#<#{self.class}: "
fs.each { |f| f.accessible=true; val += "@#{f.name} = #{f.value(self)}, " }
val += ">"
val
end
require 'java'
Dir.glob("TDB-0.8.4/lib/*.jar") { |jar| require jar }
java_import "com.hp.hpl.jena.tdb.TDB"
java_import "com.hp.hpl.jena.tdb.TDBFactory"
java_import "com.hp.hpl.jena.util.FileManager"
java_import "com.hp.hpl.jena.query.QueryExecutionFactory"
java_import "com.hp.hpl.jena.query.ResultSetFormatter"
require 'java'
class Auth < java.net.Authenticator
def getPasswordAuthentication
if (requesting_host = "www.bbc.co.uk")
return make_auth("libby","bunny")
else
return nil
end
end
public class FieldTest {
public String f = "hi";
public static void main(String[] args) throws Exception {
boolean a = FieldTest.class.getDeclaredField("f").isAccessible();
System.out.println("Got: " + a);
}
}
$ java arq.qparse --opt --print=op 'select* { ?s ?p ?o . filter (?s = <urn:x-foo:bar>) }'
(base <file:///home/pldms/Downloads/>
(filter (= ?s <urn:x-foo:bar>)
(bgp (triple ?s ?p ?o))))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(base <file:///home/pldms/Downloads/>
(assign ((?s <urn:x-foo:bar>))
(bgp (triple <urn:x-foo:bar> ?p ?o))))
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://example.org/basket">
<ex:hasFruit rdf:parseType="Collection">
<rdf:Description rdf:about="http://example.org/banana"/>
<rdf:Description rdf:about="http://example.org/apple"/>
<rdf:Description rdf:about="http://example.org/pear"/>
</ex:hasFruit>
</rdf:Description>
$ jar tf check.jar
META-INF/
META-INF/MANIFEST.MF
foo/
foo/bar.rb
$ export CLASSPATH=check.jar
$ jruby -e 'require "foo/bar"'
hello
$ unzip ~/Downloads/joseki-3.4.1.zip
$ unzip ~/Downloads/tdb-0.8.5.zip
$ cd Joseki-3.4.1/lib
$ cp ../../TDB-0.8.5/lib/*.jar .
$ rm arq-2.8.1* iri-0.7.jar slf4j-*-1.5.6*
$ cd ..
$ cp joseki-config-tdb.ttl joseki-config.ttl
# Plus fix to web.xml, to let joseki handle /update/service
SEVERE: Error: application initialization failed
org.jruby.rack.RackInitializationException: unable to create shared application instance
at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:39)
at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:40)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830)
# DO NOT MODIFY THIS FILE
# Generated by Bundler 0.9.25
require 'digest/sha1'
require 'yaml'
require 'pathname'
require 'rubygems'
Gem.source_index # ensure Rubygems is fully loaded in Ruby 1.9
module Gem