Skip to content

Instantly share code, notes, and snippets.

@fumi
Created July 1, 2010 02:05
Show Gist options
  • Save fumi/459459 to your computer and use it in GitHub Desktop.
Save fumi/459459 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rdf'
require 'rdf/raptor'
repo = RDF::Repository.new
count = 0
while true
repo.load("test.ttl")
count += 1
puts count
end
@prefix rdfs: <http://www.w3.org/2000/01/01/rdf-schema#> .
<http://example.org/1> rdfs:label "Test" .
@jfieber
Copy link

jfieber commented Jul 1, 2010

From the trace in http://github.com/bendiken/rdf/issues/#issue/33/comment/294533 it looks like rdf/raptor is falling back to the cli implementation, which happens if it cannot locate the libraptor library. Try setting the RDF_RAPTOR_LIBPATH environment variable to the full path of your libraptor library and see if that solves the problem. That doesn't fix what appears to be a bug in the cli implementation, but the ffi implementation is faster.

@fumi
Copy link
Author

fumi commented Jul 1, 2010

It works great and makes faster after setting RDF_RAPTOR_LIBPATH=/opt/local/lib/libraptor.dylib. Thanks! I should add the /opt/local/lib directory into the library path anyway...

@jfieber
Copy link

jfieber commented Jul 1, 2010

Please do file a bug against rdf-raptor for the cli implementation though, referencing this and the issue filed against rdf. Thanks.

@fumi
Copy link
Author

fumi commented Jul 1, 2010

will do

@fumi
Copy link
Author

fumi commented Jul 1, 2010

@artob
Copy link

artob commented Jul 6, 2010

I suppose we could also consider improving rdf-raptor's CLI/FFI mode autodetection to look for the FFI library in some well-known locations such as this one. For instance, most Mac OS X users would benefit from it trying the MacPorts location of /opt/local/lib, yet that path will rarely be in the system's library path since that is known to cause conflicts and general weirdness (hence the numerous DYLD_FALLBACK_LIBRARY_PATH hacks out there, and so on). Something I'll try and keep in mind for the next point release (please feel free to open a ticket if you'd like to see this feature).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment