=begin nepomukserver --nofork And then: kcmshell4 kcm_nepouk to set what files to scan. If the environment variable DBUS_SESSION_BUS_ADDRESS is not set then you need to put this in your .xinitrc: eval `dbus-launch --sh-syntax --exit-with-session` =end require 'dbus' class SopranoClient def initialize @bus = DBus::SessionBus.instance proxy = @bus.introspect("org.kde.NepomukStorage", "/org/soprano/Server") model_s = proxy["org.soprano.Server"].createModel("main")[0] @model = @bus.introspect('org.kde.NepomukStorage', model_s) end def each_result(sparql) xyz_s = @model['org.soprano.Model'].executeQuery(sparql, 'SPARQL')[0] xyz = @bus.introspect('org.kde.NepomukStorage', xyz_s) while xyz['org.soprano.QueryResultIterator'].next[0] line = xyz['org.soprano.QueryResultIterator'].current[0][0] yield line end end end sparql = < SELECT ?type ?path ?name ?size WHERE { ?x xes:mimeType ?type . ?x xes:url ?path . ?x xes:name ?name . ?x xes:size ?size . FILTER ( regex(?type, 'image/') ) } END cl = SopranoClient.new cl.each_result(sparql) do |line| type = line['type'][1] path = line['path'][1] name = line['name'][1] size = line['size'][1] puts [type, path, name, size].inspect end