This file is indexed.

/usr/share/doc/librdf-ruby/examples/example.rb is in librdf-ruby 1.0.13.1-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env ruby
#
# example.rb - Redland example Ruby program
#
# Copyright (C) 2002-2004 David Beckett - http://www.dajobe.org/
# Copyright (C) 2002-2004 University of Bristol - http://www.bristol.ac.uk/
# 
# This package is Free Software and part of Redland http://librdf.org/
# 
# It is licensed under the following three licenses as alternatives:
#   1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
#   2. GNU General Public License (GPL) V2 or any newer version
#   3. Apache License, V2.0 or any newer version
# 
# You may not use this file except in compliance with at least one of
# the above three licenses.
# 
# See LICENSE.html or LICENSE.txt at the top of this package for the
# full license terms.
# 
#
# USAGE: ruby example.rb file:../data/dc.rdf raptor
# 
#

require 'rdf/redland'

uri_string=ARGV[0]
parser_name=ARGV[1]

storage=Redland::TripleStore.new("hashes", "test", "new='yes',hash-type='bdb',dir='.'")
raise "Failed to create RDF storage" if !storage


model=Redland::Model.new(storage)
if !model then
  raise "Failed to create RDF model"
end

parser=Redland::Parser.new(parser_name, "", nil)
if !parser then
  raise "Failed to create RDF parser"
end

uri=Redland::Uri.new(uri_string)
stream=parser.parse_as_stream(uri, uri)

count=0
while !stream.end?()
  statement=stream.current()
  model.add_statement(statement)
  puts "found statement: #{statement}"
  count=count+1
  stream.next()
end

puts "Parsing added #{count} statements"


puts "Printing all statements"
stream=model.as_stream()
while !stream.end?()
  statement=stream.current()
  puts "Statement: #{statement}"
  stream.next()
end

q = Redland::Query.new(" PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?a ?c WHERE { ?a dc:title ?c } ")
puts "Querying for dc:titles:"
results=q.execute(model)
while !results.finished?()
  puts "{"
  for k in 0..results.bindings_count()-1
    puts "  #{k}= #{results.binding_value(k)}"
  end
  puts "}"
  results.next()
end

results=q.execute(model)
size=results.to_string(Redland::Uri.new("http://www.w3.org/2001/sw/DataAccess/json-sparql/")).length()
puts "Serialized query results to JSON as a string size #{size} bytes"

puts "Writing model to test-out.rdf as rdf/xml"
# Use any rdf/xml parser that is available
serializer=Redland::Serializer.new()
serializer.set_namespace("dc", Redland::Uri.new("http://purl.org/dc/elements/1.1/"))
serializer.set_namespace("rdf", Redland::Uri.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#"))
serializer.to_file("test-out.rdf", model)

size=model.to_string(name="ntriples", base_uri=Redland::Uri.new("http://example.org/base#")).length()
puts "Serialized to ntriples as a string size #{size} bytes"

puts "Done"