Debian Codegraph @

ruby/lib/rdf/redland.rb

raw symbols SCIP
1 require 'rdf/redland/model'
2 require 'rdf/redland/store'
3 require 'rdf/redland/stream'
4 require 'rdf/redland/statement'
5 require 'rdf/redland/util'
6 require 'rdf/redland/node'
7 require 'rdf/redland/parser'
8 require 'rdf/redland/queryresults'
9 require 'rdf/redland/query'
10 require 'rdf/redland/resource'
11 require 'rdf/redland/serializer'
12 require 'rdf/redland/uri'
13 require 'rdf/redland/resource'
14 require 'rdf/redland/util'
15
16 # This module initialises the Redland library and references all
17 # resources from it.
18
19 module Redland
20
21
22 # Load the interface to the C shared library
23 require 'redland'
24
25 #include Redland
26
27 # Error class specific to this package
28
29 class RedlandError < RuntimeError
30 end
31
32 # Incorrect node type
33
34 class NodeTypeError < RedlandError
35 end
36
37 # The world object is the single global variable in Redland that
38 # all the classes, their factories and implementations reference.
39 #
40 # In most programs there should be only one Redland world, using
41 # multiple models although multiple worlds are possible.
42
43 class World
44 #include Singleton
45 attr_accessor :world
46
47 # Create new RDF World object (constructor)
48 def initialize()
49 @world = Redland::librdf_new_world()
50 Redland::librdf_world_open(@world)
51 ObjectSpace.define_finalizer(self,World.create_finalizer(@world))
52 end
53
54 def World.create_finalizer(world)
55 proc {|id| "Finalizer on #{id}"
56 #log_final.info "closing world"
57 # This is commented out because Ruby fails to guarantee this
58 # is called after all other redland destructors
59 #Redland::librdf_free_world world
60 }
61 end
62 end
63
64 # Initialize Globals
65 $world = Redland::World.new()
66 # $log_final = Log4r::Logger.new('log_final')
67 # outfile = Log4r::FileOutputter.new('final.log',:filename=>"final.log")
68 # $log_final.outputters = outfile
69 # $log_final.level = Log4r::DEBUG
70
71 end
72
73 require 'rdf/redland/constants'
74
75 if $0 == __FILE__
76
77 # world = Redland::World.new()
78 # world = nil
79 puts "listing instances of World: "
80 ObjectSpace.each_object(Redland::World){|obj|
81 p obj
82 }
83 puts "DONE"
84 puts "Running the garbage collector"
85 GC.start
86 puts "Listing remaining instances of World:"
87 ObjectSpace.each_object(Redland::World){|obj|
88 p obj
89 }
90 puts "DONE"
91 end
92
93
94
95
96
97