talia_core 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/README.rdoc +41 -0
  2. data/bin/talia +33 -0
  3. data/lib/JXslt/jxslt.rb +60 -0
  4. data/lib/acts_as_roled.rb +11 -0
  5. data/lib/core_ext/platform.rb +9 -0
  6. data/lib/core_ext/string.rb +6 -0
  7. data/lib/core_ext.rb +1 -0
  8. data/lib/custom_template.rb +4 -0
  9. data/lib/loader_helper.rb +62 -0
  10. data/lib/mysql.rb +1214 -0
  11. data/lib/progressbar.rb +236 -0
  12. data/lib/role.rb +12 -0
  13. data/lib/talia_cl/command_line.rb +39 -0
  14. data/lib/talia_cl/commands/standalone/cl_options.rb +9 -0
  15. data/lib/talia_cl/commands/standalone/standalone_generate.rb +75 -0
  16. data/lib/talia_cl/commands/standalone.rb +25 -0
  17. data/lib/talia_cl/commands/talia_console/cl_options.rb +55 -0
  18. data/lib/talia_cl/commands/talia_console/console_commands.rb +37 -0
  19. data/lib/talia_cl/commands/talia_console/talia_commands.rb +131 -0
  20. data/lib/talia_cl/commands/talia_console.rb +47 -0
  21. data/lib/talia_cl/core_commands.rb +11 -0
  22. data/lib/talia_cl.rb +47 -0
  23. data/lib/talia_core/active_source.rb +372 -0
  24. data/lib/talia_core/active_source_parts/class_methods.rb +378 -0
  25. data/lib/talia_core/active_source_parts/predicate_handler.rb +89 -0
  26. data/lib/talia_core/active_source_parts/rdf.rb +131 -0
  27. data/lib/talia_core/active_source_parts/sql_helper.rb +36 -0
  28. data/lib/talia_core/active_source_parts/xml/base_builder.rb +47 -0
  29. data/lib/talia_core/active_source_parts/xml/generic_reader.rb +363 -0
  30. data/lib/talia_core/active_source_parts/xml/rdf_builder.rb +88 -0
  31. data/lib/talia_core/active_source_parts/xml/source_builder.rb +73 -0
  32. data/lib/talia_core/active_source_parts/xml/source_reader.rb +20 -0
  33. data/lib/talia_core/agent.rb +14 -0
  34. data/lib/talia_core/background_jobs/job.rb +82 -0
  35. data/lib/talia_core/background_jobs/progress_job.rb +68 -0
  36. data/lib/talia_core/collection.rb +13 -0
  37. data/lib/talia_core/data_types/data_loader.rb +92 -0
  38. data/lib/talia_core/data_types/data_record.rb +105 -0
  39. data/lib/talia_core/data_types/delayed_copier.rb +76 -0
  40. data/lib/talia_core/data_types/file_record.rb +59 -0
  41. data/lib/talia_core/data_types/file_store.rb +306 -0
  42. data/lib/talia_core/data_types/iip_data.rb +153 -0
  43. data/lib/talia_core/data_types/iip_loader.rb +127 -0
  44. data/lib/talia_core/data_types/image_data.rb +32 -0
  45. data/lib/talia_core/data_types/media_link.rb +19 -0
  46. data/lib/talia_core/data_types/mime_mapping.rb +45 -0
  47. data/lib/talia_core/data_types/path_helpers.rb +77 -0
  48. data/lib/talia_core/data_types/pdf_data.rb +42 -0
  49. data/lib/talia_core/data_types/simple_text.rb +36 -0
  50. data/lib/talia_core/data_types/temp_file_handling.rb +85 -0
  51. data/lib/talia_core/data_types/xml_data.rb +169 -0
  52. data/lib/talia_core/dc_resource.rb +20 -0
  53. data/lib/talia_core/dummy_handler.rb +34 -0
  54. data/lib/talia_core/dummy_source.rb +20 -0
  55. data/lib/talia_core/errors.rb +25 -0
  56. data/lib/talia_core/initializer.rb +427 -0
  57. data/lib/talia_core/ordered_source.rb +228 -0
  58. data/lib/talia_core/rails_ext/actionpack/action_controller/record_identifier.rb +13 -0
  59. data/lib/talia_core/rails_ext/actionpack/action_controller.rb +1 -0
  60. data/lib/talia_core/rails_ext/actionpack.rb +1 -0
  61. data/lib/talia_core/rails_ext.rb +1 -0
  62. data/lib/talia_core/rdf_import.rb +90 -0
  63. data/lib/talia_core/rdf_resource.rb +159 -0
  64. data/lib/talia_core/semantic_collection_item.rb +93 -0
  65. data/lib/talia_core/semantic_collection_wrapper.rb +324 -0
  66. data/lib/talia_core/semantic_property.rb +7 -0
  67. data/lib/talia_core/semantic_relation.rb +67 -0
  68. data/lib/talia_core/source.rb +323 -0
  69. data/lib/talia_core/source_transfer_object.rb +38 -0
  70. data/lib/talia_core/workflow/base.rb +15 -0
  71. data/lib/talia_core/workflow/publication_workflow.rb +62 -0
  72. data/lib/talia_core/workflow.rb +300 -0
  73. data/lib/talia_core.rb +9 -0
  74. data/lib/talia_dependencies.rb +12 -0
  75. data/lib/talia_util/bar_progressor.rb +15 -0
  76. data/lib/talia_util/configuration/config_file.rb +48 -0
  77. data/lib/talia_util/configuration/database_config.rb +40 -0
  78. data/lib/talia_util/configuration/mysql_database_setup.rb +104 -0
  79. data/lib/talia_util/data_import.rb +91 -0
  80. data/lib/talia_util/image_conversions.rb +82 -0
  81. data/lib/talia_util/import_job_helper.rb +132 -0
  82. data/lib/talia_util/io_helper.rb +54 -0
  83. data/lib/talia_util/progressable.rb +38 -0
  84. data/lib/talia_util/progressbar.rb +236 -0
  85. data/lib/talia_util/rdf_update.rb +80 -0
  86. data/lib/talia_util/some_sigla.xml +1960 -0
  87. data/lib/talia_util/test_helpers.rb +151 -0
  88. data/lib/talia_util/util.rb +226 -0
  89. data/lib/talia_util/yaml_import.rb +80 -0
  90. data/lib/talia_util.rb +13 -0
  91. data/lib/user.rb +116 -0
  92. data/lib/version.rb +15 -0
  93. data/test/core_ext/string_test.rb +11 -0
  94. data/test/custom_template_test.rb +8 -0
  95. data/test/talia_core/active_source_predicate_test.rb +54 -0
  96. data/test/talia_core/active_source_rdf_test.rb +89 -0
  97. data/test/talia_core/active_source_test.rb +631 -0
  98. data/test/talia_core/data_types/data_loader_test.rb +123 -0
  99. data/test/talia_core/data_types/data_record_test.rb +40 -0
  100. data/test/talia_core/data_types/file_record_test.rb +171 -0
  101. data/test/talia_core/data_types/iip_data_test.rb +130 -0
  102. data/test/talia_core/data_types/image_data_test.rb +88 -0
  103. data/test/talia_core/data_types/pdf_data_test.rb +68 -0
  104. data/test/talia_core/data_types/xml_data_test.rb +134 -0
  105. data/test/talia_core/generic_xml_test.rb +83 -0
  106. data/test/talia_core/initializer_test.rb +36 -0
  107. data/test/talia_core/ordered_source_test.rb +398 -0
  108. data/test/talia_core/rdf_resource_test.rb +115 -0
  109. data/test/talia_core/semantic_collection_item_test.rb +129 -0
  110. data/test/talia_core/source_reader_test.rb +33 -0
  111. data/test/talia_core/source_test.rb +484 -0
  112. data/test/talia_core/source_transfer_object_test.rb +24 -0
  113. data/test/talia_core/workflow/publication_workflow_test.rb +242 -0
  114. data/test/talia_core/workflow/user_class_for_workflow.rb +35 -0
  115. data/test/talia_core/workflow/workflow_base_test.rb +21 -0
  116. data/test/talia_core/workflow_test.rb +19 -0
  117. data/test/talia_util/import_job_helper_test.rb +46 -0
  118. data/test/test_helper.rb +68 -0
  119. metadata +262 -0
@@ -0,0 +1,77 @@
1
+ module TaliaCore
2
+ module DataTypes
3
+
4
+ # Contains the helpers to obtain path information for data storage
5
+ module PathHelpers
6
+
7
+ module ClassMethods
8
+ # Path used to store temporary files.
9
+ def tempfile_path
10
+ @@tempfile_path ||= File.join(TALIA_ROOT, 'tmp', 'data_records')
11
+ end
12
+
13
+ # Path used to store data files.
14
+ def data_path
15
+ @@data_path ||= File.join(TALIA_ROOT, 'data')
16
+ end
17
+
18
+
19
+
20
+ # Extract the filename.
21
+ def extract_filename(file_data)
22
+ file_data.original_filename if file_data.respond_to?(:original_filename)
23
+ end
24
+
25
+ end
26
+
27
+ # Return the full file path related to the data directory
28
+ def file_path(relative = false)
29
+ File.join(data_directory(relative), self.id.to_s)
30
+ end
31
+
32
+ # Gets the path that will be used for serving the image as a static
33
+ # resource. Nil if the prefix isn't set
34
+ def static_path
35
+ prefix = TaliaCore::CONFIG['static_data_prefix']
36
+ return unless(prefix)
37
+ prefix = N::LOCAL + prefix unless(prefix =~ /:\/\//)
38
+ "#{prefix}/#{class_name}/#{("00" + self.id.to_s)[-3..-1]}/#{self.id}"
39
+ end
40
+
41
+ # Path used to store temporary files.
42
+ # This is a wrapper for the tempfile_path class method.
43
+ def tempfile_path
44
+ self.class.tempfile_path
45
+ end
46
+
47
+ # Return the data directory for a specific data file
48
+ def data_directory(relative = false)
49
+ class_name = self.class.name.gsub(/(.*::)/, '')
50
+ if relative == false
51
+ File.join(TaliaCore::CONFIG["data_directory_location"], class_name, ("00" + self.id.to_s)[-3..-1])
52
+ else
53
+ File.join(class_name, ("00" + self.id.to_s)[-3..-1])
54
+ end
55
+ end
56
+
57
+ # Path used to store data files.
58
+ # This is a wrapper for the data_path class method.
59
+ def data_path
60
+ self.class.data_path
61
+ end
62
+
63
+ # Return the full path of the current attachment.
64
+ def full_filename
65
+ @full_filename ||= self.file_path #File.join(data_path, class_name, location)
66
+ end
67
+
68
+ # Extract the filename.
69
+ # This is a wrapper for the extract_filename class method.
70
+ def extract_filename(file_data)
71
+ self.class.extract_filename(file_data)
72
+ end
73
+
74
+ end
75
+
76
+ end
77
+ end
@@ -0,0 +1,42 @@
1
+ module TaliaCore
2
+ module DataTypes
3
+
4
+ # Class to manage PDF data type
5
+ class PdfData < FileRecord
6
+
7
+ # return the mime_type for a file
8
+ def extract_mime_type(location)
9
+ 'application/pdf'
10
+ end
11
+
12
+ # Create the PDF data from a PDF writer. This method needs a block
13
+ # which will be called with the writer object
14
+ def create_from_writer(writer_opts = {})
15
+ activate_pdf
16
+ writer = PDF::Writer.new(writer_opts) do |pdf|
17
+ yield(pdf)
18
+ end
19
+ filename = File.join(Dir.tmpdir, "#{rand 10E16}.pdf")
20
+ writer.save_as(filename)
21
+ self.create_from_file('', filename, true) # set to delete tempfile on create
22
+ self
23
+ end
24
+
25
+ private
26
+
27
+ # Little helper method - no need to load the pdf classes unless needed,
28
+ # but if called every time round it will slow things down (in Rails it will).
29
+ def self.activate_pdf
30
+ return if(@pdf_active)
31
+ require 'pdf/writer'
32
+ @pdf_active = true
33
+ end
34
+
35
+ def activate_pdf
36
+ self.class.activate_pdf
37
+ end
38
+
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,36 @@
1
+ require 'talia_core/data_types/file_store'
2
+
3
+ # Class to manage data stored in a text file
4
+ module TaliaCore
5
+ module DataTypes
6
+
7
+ class SimpleText < FileRecord
8
+
9
+ # return the mime_type for a file
10
+ def extract_mime_type(location)
11
+ 'text/plain'
12
+ end
13
+
14
+ # Get a line from a text file.
15
+ # At the end of file: close the file and return
16
+ def get_line(close_after_single_read=false)
17
+ if !is_file_open?
18
+ open_file
19
+ end
20
+
21
+ # get a new line and return nil is EOF
22
+ line = @file_handle.gets
23
+
24
+ if line == nil or close_after_single_read
25
+ close_file
26
+ end
27
+
28
+ # update the position of reading cursors
29
+ @position += line.length
30
+
31
+ return line
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,85 @@
1
+ require 'fileutils'
2
+
3
+ module TaliaCore
4
+ module DataTypes
5
+
6
+ # Module for the handling of temporary files in data storage objects
7
+ module TempFileHandling
8
+
9
+ module ClassMethods
10
+
11
+ # Copies the given file path to a new tempfile, returning the closed tempfile.
12
+ def copy_to_temp_file(file, temp_base_name)
13
+ create_tempfile_path
14
+ returning Tempfile.new(temp_base_name, self.tempfile_path) do |tmp|
15
+ tmp.close
16
+ FileUtils.cp file, tmp.path
17
+ end
18
+ end
19
+
20
+ # Writes the given data to a new tempfile, returning the closed tempfile.
21
+ def write_to_temp_file(data, filename)
22
+ create_tempfile_path
23
+ returning Tempfile.new(filename, self.tempfile_path) do |tmp|
24
+ tmp.binmode
25
+ tmp.write data
26
+ tmp.close
27
+ end
28
+ end
29
+
30
+ def create_tempfile_path
31
+ FileUtils.mkdir_p(tempfile_path) unless File.exists?(tempfile_path)
32
+ end
33
+
34
+ end
35
+
36
+ # Gets the latest temp path from the collection of temp paths. While working with an attachment,
37
+ # multiple Tempfile objects may be created for various processing purposes (resizing, for example).
38
+ # An array of all the tempfile objects is stored so that the Tempfile instance is held on to until
39
+ # it's not needed anymore. The collection is cleared after saving the attachment.
40
+ def temp_path
41
+ p = temp_paths.first
42
+ p.respond_to?(:path) ? p.path : p.to_s
43
+ end
44
+
45
+ # Gets an array of the currently used temp paths. Defaults to a copy of #full_filename.
46
+ def temp_paths
47
+ @temp_paths ||= (new_record? || !File.exist?(full_filename)) ? [] : [copy_to_temp_file(full_filename)]
48
+ end
49
+
50
+ # Adds a new temp_path to the array. This should take a string or a Tempfile. This class makes no
51
+ # attempt to remove the files, so Tempfiles should be used. Tempfiles remove themselves when they go out of scope.
52
+ # You can also use string paths for temporary files, such as those used for uploaded files in a web server.
53
+ def temp_path=(value)
54
+ temp_paths.unshift value
55
+ temp_path
56
+ end
57
+
58
+ # Gets the data from the latest temp file. This will read the file into memory.
59
+ def temp_data
60
+ save_attachment? ? File.read(temp_path) : nil
61
+ end
62
+
63
+ # Writes the given data to a Tempfile and adds it to the collection of temp files.
64
+ def temp_data=(data)
65
+ self.temp_path = write_to_temp_file data unless data.nil?
66
+ end
67
+
68
+ # Copies the given file to a randomly named Tempfile.
69
+ def copy_to_temp_file(file)
70
+ self.class.copy_to_temp_file file, random_tempfile_filename
71
+ end
72
+
73
+ # Writes the given file to a randomly named Tempfile.
74
+ def write_to_temp_file(data)
75
+ self.class.write_to_temp_file data, self.location
76
+ end
77
+
78
+ # Generates a unique filename for a Tempfile.
79
+ def random_tempfile_filename
80
+ "#{rand Time.now.to_i}#{location || 'attachment'}"
81
+ end
82
+
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,169 @@
1
+ require 'talia_core/data_types/file_store'
2
+ require 'rexml/document'
3
+ # require 'xml/xslt'
4
+
5
+ begin
6
+ # if tidy is not present, disable it
7
+ require 'tidy'
8
+
9
+ # Tidy_enable constant is not defined?
10
+ if ((defined? Tidy_enable) == nil)
11
+ if ENV['TIDYLIB'].nil?
12
+ # disable tidy
13
+ Tidy_enable = false
14
+ else
15
+ # set path and enable tidy
16
+ Tidy.path = ENV['TIDYLIB']
17
+ Tidy_enable = true
18
+ end
19
+ end
20
+
21
+ rescue LoadError
22
+ # disable tidy
23
+ Tidy_enable = false if ((defined? Tidy_enable) == nil)
24
+ end
25
+
26
+
27
+ module TaliaCore
28
+ module DataTypes
29
+
30
+ # Class to manage XML and HTML data type
31
+ class XmlData < FileRecord
32
+
33
+ # return the mime_type for a file
34
+ def extract_mime_type(location)
35
+ case File.extname(location).downcase
36
+ when '.htm', '.html','.xhtml'
37
+ 'text/html'
38
+ when '.hnml'
39
+ 'text/hnml'
40
+ when '.xml'
41
+ 'text/xml'
42
+ end
43
+ end
44
+
45
+ # return the mime subtype for this specified class
46
+ def mime_subtype
47
+ mime_type.split(/\//)[1]
48
+ end
49
+
50
+ # return contect of the object as REXML::Elements
51
+ # * options: Options for getting context. Default nil.
52
+ # * options[:xsl_file]: xsl file path for transformation.
53
+ def get_content(options = nil)
54
+ text_to_parse = all_text
55
+
56
+ if (!options.nil?)
57
+ # if xsl_file option is specified, execute transformation
58
+ if (!options[:xsl_file].nil?)
59
+ text_to_parse = xslt_transform(file_path, options[:xsl_file])
60
+ end
61
+ end
62
+
63
+ # create document object
64
+ document = REXML::Document.new text_to_parse
65
+
66
+ # get content
67
+ if ((mime_subtype == "html") or
68
+ ((mime_subtype == "xml") and (!options.nil?) and (!options[:xsl_file].nil?)))
69
+ content = document.elements['//body'].elements
70
+ elsif ((mime_subtype == "xml") or (mime_subtype == "hnml"))
71
+ content = document.root.elements
72
+ end
73
+
74
+ # adjust/replace items path
75
+ content.each { |i| wrapItem i }
76
+
77
+ # return content
78
+ return content
79
+ end
80
+
81
+ # Returns an xml string of the elements returned by get_content
82
+ def get_content_string(options = nil)
83
+ xml_str = ''
84
+ get_content(options).each do |element|
85
+ xml_str << element.to_s
86
+ end
87
+ xml_str
88
+ end
89
+
90
+ # Returns an xml string that is escaped for HTML inclusing
91
+ def get_escaped_content_string(options = nil)
92
+ get_content_string(options).gsub(/</, "&lt;").gsub(/>/, "&gt;")
93
+ end
94
+
95
+ # Add data as string into file
96
+ # * location: location
97
+ # * data: data to write
98
+ # * options: options
99
+ # * options[:tidy]: enable or disable tidy (convert html into xhtml). Default value is true
100
+ def create_from_data(location, data, options = {:tidy => true})
101
+ # check tidy option
102
+ if (((options[:tidy] == true) and (Tidy_enable == true)) and
103
+ ((File.extname(location) == '.htm') or (File.extname(location) == '.html') or (File.extname(location) == '.xhtml')))
104
+
105
+ # apply tidy on data
106
+ data_to_write = Tidy.open(:show_warnings => false) do |tidy|
107
+ tidy.options.output_xhtml = true
108
+ tidy.options.tidy_mark = false
109
+ xhtml = tidy.clean(data)
110
+ xhtml
111
+ end
112
+ else
113
+ data_to_write = data
114
+ end
115
+
116
+ # write data
117
+ super(location, data_to_write, options)
118
+ end
119
+
120
+ private
121
+ # adjusted/replaced items path
122
+ # * item: REXML::Element to parse
123
+ def wrapItem item
124
+ if item.class == REXML::Element
125
+ # recursive execution
126
+ item.each_child { |subItem| wrapItem subItem}
127
+
128
+ case item.name
129
+ when "img"
130
+ if item.attributes.include? "src"
131
+ # get path
132
+ path = Pathname.new(item.attributes['src']).split
133
+ # adjust src attribute
134
+ item.attributes['src'] = "/source_data/image_data/#{path[1].to_s}" if path[0].relative?
135
+ end
136
+ when "a"
137
+ if item.attributes.include? "href"
138
+ # get path
139
+ path = Pathname.new(item.attributes['href']).split
140
+ # adjust href attribute
141
+ case File.extname(path[1].to_s)
142
+ when ".txt"
143
+ item.attributes['href'] = "/source_data/simple_text/#{path[1].to_s}" if path[0].relative?
144
+ when '.htm', '.html','.xhtml','.hnml','.xml'
145
+ item.attributes['href'] = "/source_data/xml_data/#{path[1].to_s}" if path[0].relative?
146
+ end
147
+ end
148
+ end
149
+
150
+ end
151
+ end
152
+
153
+ # execute xslt transformation
154
+ # * document: xml document. Can be file path as string or REXML::Document
155
+ # * xsl_file: xsl file for transformation. Can be file path as string or REXML::Document
156
+ def xslt_transform(document, xsl_file)
157
+ xslt = XML::XSLT.new()
158
+ # get xml document
159
+ xslt.xml = document
160
+ # get xslt document
161
+ xslt.xsl = xsl_file
162
+
163
+ # return transformation output
164
+ return xslt.serve()
165
+ end
166
+
167
+ end
168
+ end
169
+ end
@@ -0,0 +1,20 @@
1
+ module TaliaCore
2
+
3
+ # A generic resource that should contain the most important
4
+ # Dublin Core metadata fields
5
+ class DcResource < Source
6
+
7
+ # General metadata
8
+ singular_property :identifier, N::DCNS.identifier
9
+ simple_property :creators, N::DCNS.creator
10
+ singular_property :date, N::DCNS.date
11
+ singular_property :description, N::DCNS.description
12
+ simple_property :publishers, N::DCNS.publisher
13
+ singular_property :language, N::DCNS.language
14
+ simple_property :subjects, N::DCNS.subject
15
+ singular_property :rights, N::DCNS.rights
16
+ singular_property :title, N::DCNS.title
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,34 @@
1
+ require 'active_rdf'
2
+ require 'semantic_naming'
3
+ require 'assit'
4
+ require 'errors'
5
+
6
+ module TaliaCore
7
+
8
+ # This is an internal class for "dummy handler invocations" on sources
9
+ # The problem is that invocations like source.namespace::name are
10
+ # evaluated to (source.namespace).name
11
+ # This means that source.namespace must return an object on which
12
+ # "name" can be called with the desired effect. This is the "dummy handler"
13
+ class DummyHandler
14
+
15
+ # Create the new handler
16
+ def initialize(namespace, subject)
17
+ assit_kind_of(N::URI, namespace)
18
+ assit_kind_of(TaliaCore::Source, subject)
19
+
20
+ @namespace = namespace.to_s
21
+ @subject = subject
22
+ end
23
+
24
+ # Catch the invocations
25
+ def method_missing(method, *args)
26
+ # read value
27
+ raise(SemanticNamingError, "Wrong number of arguments") if(args.size != 0)
28
+ @subject[@namespace + method.to_s]
29
+ end
30
+
31
+ # remove the type call
32
+ private :type
33
+ end
34
+ end
@@ -0,0 +1,20 @@
1
+ module TaliaCore
2
+
3
+ # Dummy source class. This will be created by some mechanisms that need to create a relation to a
4
+ # not-yet-existing source. The DummySource should only exist temporarily, if some are found inside
5
+ # the data store it may be a sign of an inconsistent or not completely initialized store.
6
+ class DummySource < Source
7
+
8
+ # Converts the current source into one with a "real" klass. Returns the new, converted sourc
9
+ def self.make_real(klass)
10
+ assit_kind_of(Class, klass)
11
+ self['type'] = klass.name
12
+ save!
13
+ new_src = ActiveSource.find(uri)
14
+ assit_kind_of(klass, new_src)
15
+ new_src
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -0,0 +1,25 @@
1
+ # This file contains all the errors that can be raised in the
2
+ # Talia core. Since these are not useful classes, they are grouped
3
+ # together in one file.
4
+
5
+ # Indicates that it was tried to create an object with
6
+ # an identifier (e.g. an URI) which already exists in the
7
+ # system.
8
+ class DuplicateIdentifierError < RuntimeError
9
+ end
10
+
11
+ # Indicates an error during initialization
12
+ class SystemInitializationError < RuntimeError
13
+ end
14
+
15
+ # Indicates an error with the predicate naming
16
+ class SemanticNamingError < RuntimeError
17
+ end
18
+
19
+ # Indicates an attempt to save attributes on an unsaved source
20
+ class UnsavedSourceError < RuntimeError
21
+ end
22
+
23
+ # Indicates an error in a query
24
+ class QueryError < RuntimeError
25
+ end