ontomde-core 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. data/History.txt +3 -0
  2. data/Manifest.txt +95 -21
  3. data/README.txt +19 -1
  4. data/Rakefile +1 -1
  5. data/bin/ontomde-inspector +6 -0
  6. data/lib/ontomde-core/clone.rb +1 -1
  7. data/lib/ontomde-core/completion.rb +47 -0
  8. data/lib/ontomde-core/context.rb +32 -11
  9. data/lib/ontomde-core/converter-ea/XMI2RDFS.xslt +805 -0
  10. data/lib/ontomde-core/converter-ea/msxsl.exe +0 -0
  11. data/lib/ontomde-core/custom_method_missing.rb +24 -1
  12. data/lib/ontomde-core/fileLoader.rb +71 -14
  13. data/lib/ontomde-core/fileTypes.rb +7 -0
  14. data/lib/ontomde-core/helper.rb +141 -15
  15. data/lib/ontomde-core/inspector/loader.rb +69 -0
  16. data/lib/ontomde-core/inspector/rails/README +203 -0
  17. data/lib/ontomde-core/inspector/rails/Rakefile +10 -0
  18. data/lib/ontomde-core/inspector/rails/app/controllers/application.rb +10 -0
  19. data/lib/ontomde-core/inspector/rails/app/controllers/mtk_controller.rb +349 -0
  20. data/lib/ontomde-core/inspector/rails/app/helpers/application_helper.rb +3 -0
  21. data/lib/ontomde-core/inspector/rails/app/helpers/mtk_helper.rb +20 -0
  22. data/lib/ontomde-core/inspector/rails/app/views/layouts/mtk.rhtml +161 -0
  23. data/lib/ontomde-core/inspector/rails/app/views/mtk/clear.rhtml +5 -0
  24. data/lib/ontomde-core/inspector/rails/app/views/mtk/index.rhtml +1 -0
  25. data/lib/ontomde-core/inspector/rails/app/views/mtk/last_generated.rhtml +7 -0
  26. data/lib/ontomde-core/inspector/rails/app/views/mtk/model.html.erb +6 -0
  27. data/lib/ontomde-core/inspector/rails/app/views/mtk/not_found.rhtml +2 -0
  28. data/lib/ontomde-core/inspector/rails/app/views/mtk/search_form.rhtml +30 -0
  29. data/lib/ontomde-core/inspector/rails/app/views/mtk/search_result.rhtml +8 -0
  30. data/lib/ontomde-core/inspector/rails/app/views/mtk/setup_form.rhtml +42 -0
  31. data/lib/ontomde-core/inspector/rails/app/views/mtk/show.rhtml +172 -0
  32. data/lib/ontomde-core/inspector/rails/app/views/mtk/show_many.rhtml +25 -0
  33. data/lib/ontomde-core/inspector/rails/config/boot.rb +109 -0
  34. data/lib/ontomde-core/inspector/rails/config/database.yml +19 -0
  35. data/lib/ontomde-core/inspector/rails/config/environment.rb +60 -0
  36. data/lib/ontomde-core/inspector/rails/config/environments/development.rb +18 -0
  37. data/lib/ontomde-core/inspector/rails/config/environments/production.rb +19 -0
  38. data/lib/ontomde-core/inspector/rails/config/environments/test.rb +22 -0
  39. data/lib/ontomde-core/inspector/rails/config/initializers/inflections.rb +10 -0
  40. data/lib/ontomde-core/inspector/rails/config/initializers/mime_types.rb +5 -0
  41. data/lib/ontomde-core/inspector/rails/config/routes.rb +35 -0
  42. data/lib/ontomde-core/inspector/rails/doc/README_FOR_APP +2 -0
  43. data/lib/ontomde-core/inspector/rails/log/development.log +0 -0
  44. data/lib/ontomde-core/inspector/rails/log/production.log +0 -0
  45. data/lib/ontomde-core/inspector/rails/log/server.log +0 -0
  46. data/lib/ontomde-core/inspector/rails/log/test.log +0 -0
  47. data/lib/ontomde-core/inspector/rails/public/.htaccess +40 -0
  48. data/lib/ontomde-core/inspector/rails/public/404.html +30 -0
  49. data/lib/ontomde-core/inspector/rails/public/422.html +30 -0
  50. data/lib/ontomde-core/inspector/rails/public/500.html +30 -0
  51. data/lib/ontomde-core/inspector/rails/public/dispatch.cgi +10 -0
  52. data/lib/ontomde-core/inspector/rails/public/dispatch.fcgi +24 -0
  53. data/lib/ontomde-core/inspector/rails/public/dispatch.rb +10 -0
  54. data/lib/ontomde-core/inspector/rails/public/favicon.ico +0 -0
  55. data/lib/ontomde-core/inspector/rails/public/images/logoMDE.gif +0 -0
  56. data/lib/ontomde-core/inspector/rails/public/images/rails.png +0 -0
  57. data/lib/ontomde-core/inspector/rails/public/javascripts/application.js +2 -0
  58. data/lib/ontomde-core/inspector/rails/public/javascripts/controls.js +963 -0
  59. data/lib/ontomde-core/inspector/rails/public/javascripts/dragdrop.js +972 -0
  60. data/lib/ontomde-core/inspector/rails/public/javascripts/effects.js +1120 -0
  61. data/lib/ontomde-core/inspector/rails/public/javascripts/prototype.js +4225 -0
  62. data/lib/ontomde-core/inspector/rails/public/robots.txt +5 -0
  63. data/lib/ontomde-core/inspector/rails/script/about +3 -0
  64. data/lib/ontomde-core/inspector/rails/script/console +3 -0
  65. data/lib/ontomde-core/inspector/rails/script/destroy +3 -0
  66. data/lib/ontomde-core/inspector/rails/script/generate +3 -0
  67. data/lib/ontomde-core/inspector/rails/script/performance/benchmarker +3 -0
  68. data/lib/ontomde-core/inspector/rails/script/performance/profiler +3 -0
  69. data/lib/ontomde-core/inspector/rails/script/performance/request +3 -0
  70. data/lib/ontomde-core/inspector/rails/script/plugin +3 -0
  71. data/lib/ontomde-core/inspector/rails/script/process/inspector +3 -0
  72. data/lib/ontomde-core/inspector/rails/script/process/reaper +3 -0
  73. data/lib/ontomde-core/inspector/rails/script/process/spawner +3 -0
  74. data/lib/ontomde-core/inspector/rails/script/runner +3 -0
  75. data/lib/ontomde-core/inspector/rails/script/server +3 -0
  76. data/lib/ontomde-core/inspector/rails/test/test_helper.rb +38 -0
  77. data/lib/ontomde-core/inspector/rails/vendor/plugins/auto_complete/README +23 -0
  78. data/lib/ontomde-core/inspector/rails/vendor/plugins/auto_complete/Rakefile +22 -0
  79. data/lib/ontomde-core/inspector/rails/vendor/plugins/auto_complete/init.rb +2 -0
  80. data/lib/ontomde-core/inspector/rails/vendor/plugins/auto_complete/lib/auto_complete.rb +47 -0
  81. data/lib/ontomde-core/inspector/rails/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb +143 -0
  82. data/lib/ontomde-core/inspector/rails/vendor/plugins/auto_complete/test/auto_complete_test.rb +67 -0
  83. data/lib/ontomde-core/inspector/setup_rails.sh +39 -0
  84. data/lib/ontomde-core/inspector.rb +21 -0
  85. data/lib/ontomde-core/meta.rb +6 -5
  86. data/lib/ontomde-core/resource.rb +6 -6
  87. data/lib/ontomde-core/resourceSet.rb +7 -6
  88. data/lib/ontomde-core/triplet.rb +2 -0
  89. data/lib/ontomde-core/version.rb +1 -1
  90. data/test/protege/test_demo.rb +1 -1
  91. data/test/test_context.rb +1 -1
  92. data/test/test_protected.rb +11 -11
  93. data/test/test_uri.rb +1 -1
  94. data/test/unit_test_crash.rb +1 -1
  95. metadata +105 -29
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/request'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/inspector'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/reaper'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/spawner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -0,0 +1,38 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require 'test_help'
4
+
5
+ class Test::Unit::TestCase
6
+ # Transactional fixtures accelerate your tests by wrapping each test method
7
+ # in a transaction that's rolled back on completion. This ensures that the
8
+ # test database remains unchanged so your fixtures don't have to be reloaded
9
+ # between every test method. Fewer database queries means faster tests.
10
+ #
11
+ # Read Mike Clark's excellent walkthrough at
12
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
+ #
14
+ # Every Active Record database supports transactions except MyISAM tables
15
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
16
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
17
+ # is recommended.
18
+ #
19
+ # The only drawback to using transactional fixtures is when you actually
20
+ # need to test transactions. Since your test is bracketed by a transaction,
21
+ # any transactions started in your code will be automatically rolled back.
22
+ self.use_transactional_fixtures = true
23
+
24
+ # Instantiated fixtures are slow, but give you @david where otherwise you
25
+ # would need people(:david). If you don't want to migrate your existing
26
+ # test cases which use the @david style and don't mind the speed hit (each
27
+ # instantiated fixtures translates to a database query per test method),
28
+ # then set this back to true.
29
+ self.use_instantiated_fixtures = false
30
+
31
+ # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
32
+ #
33
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
34
+ # -- they do not yet inherit this setting
35
+ fixtures :all
36
+
37
+ # Add more helper methods to be used by all tests here...
38
+ end
@@ -0,0 +1,23 @@
1
+ Example:
2
+
3
+ # Controller
4
+ class BlogController < ApplicationController
5
+ auto_complete_for :post, :title
6
+ end
7
+
8
+ # View
9
+ <%= text_field_with_auto_complete :post, title %>
10
+
11
+ By default, auto_complete_for limits the results to 10 entries,
12
+ and sorts by the given field.
13
+
14
+ auto_complete_for takes a third parameter, an options hash to
15
+ the find method used to search for the records:
16
+
17
+ auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
18
+
19
+ For more examples, see script.aculo.us:
20
+ * http://script.aculo.us/demos/ajax/autocompleter
21
+ * http://script.aculo.us/demos/ajax/autocompleter_customized
22
+
23
+ Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test auto_complete plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for auto_complete plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'Auto Complete'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
@@ -0,0 +1,2 @@
1
+ ActionController::Base.send :include, AutoComplete
2
+ ActionController::Base.helper AutoCompleteMacrosHelper
@@ -0,0 +1,47 @@
1
+ module AutoComplete
2
+
3
+ def self.included(base)
4
+ base.extend(ClassMethods)
5
+ end
6
+
7
+ #
8
+ # Example:
9
+ #
10
+ # # Controller
11
+ # class BlogController < ApplicationController
12
+ # auto_complete_for :post, :title
13
+ # end
14
+ #
15
+ # # View
16
+ # <%= text_field_with_auto_complete :post, title %>
17
+ #
18
+ # By default, auto_complete_for limits the results to 10 entries,
19
+ # and sorts by the given field.
20
+ #
21
+ # auto_complete_for takes a third parameter, an options hash to
22
+ # the find method used to search for the records:
23
+ #
24
+ # auto_complete_for :post, :title, :limit => 15, :order => 'created_at DESC'
25
+ #
26
+ # For help on defining text input fields with autocompletion,
27
+ # see ActionView::Helpers::JavaScriptHelper.
28
+ #
29
+ # For more examples, see script.aculo.us:
30
+ # * http://script.aculo.us/demos/ajax/autocompleter
31
+ # * http://script.aculo.us/demos/ajax/autocompleter_customized
32
+ module ClassMethods
33
+ def auto_complete_for(object, method, options = {})
34
+ define_method("auto_complete_for_#{object}_#{method}") do
35
+ find_options = {
36
+ :conditions => [ "LOWER(#{method}) LIKE ?", '%' + params[object][method].downcase + '%' ],
37
+ :order => "#{method} ASC",
38
+ :limit => 10 }.merge!(options)
39
+
40
+ @items = object.to_s.camelize.constantize.find(:all, find_options)
41
+
42
+ render :inline => "<%= auto_complete_result @items, '#{method}' %>"
43
+ end
44
+ end
45
+ end
46
+
47
+ end
@@ -0,0 +1,143 @@
1
+ module AutoCompleteMacrosHelper
2
+ # Adds AJAX autocomplete functionality to the text input field with the
3
+ # DOM ID specified by +field_id+.
4
+ #
5
+ # This function expects that the called action returns an HTML <ul> list,
6
+ # or nothing if no entries should be displayed for autocompletion.
7
+ #
8
+ # You'll probably want to turn the browser's built-in autocompletion off,
9
+ # so be sure to include an <tt>autocomplete="off"</tt> attribute with your text
10
+ # input field.
11
+ #
12
+ # The autocompleter object is assigned to a Javascript variable named <tt>field_id</tt>_auto_completer.
13
+ # This object is useful if you for example want to trigger the auto-complete suggestions through
14
+ # other means than user input (for that specific case, call the <tt>activate</tt> method on that object).
15
+ #
16
+ # Required +options+ are:
17
+ # <tt>:url</tt>:: URL to call for autocompletion results
18
+ # in url_for format.
19
+ #
20
+ # Addtional +options+ are:
21
+ # <tt>:update</tt>:: Specifies the DOM ID of the element whose
22
+ # innerHTML should be updated with the autocomplete
23
+ # entries returned by the AJAX request.
24
+ # Defaults to <tt>field_id</tt> + '_auto_complete'
25
+ # <tt>:with</tt>:: A JavaScript expression specifying the
26
+ # parameters for the XMLHttpRequest. This defaults
27
+ # to 'fieldname=value'.
28
+ # <tt>:frequency</tt>:: Determines the time to wait after the last keystroke
29
+ # for the AJAX request to be initiated.
30
+ # <tt>:indicator</tt>:: Specifies the DOM ID of an element which will be
31
+ # displayed while autocomplete is running.
32
+ # <tt>:tokens</tt>:: A string or an array of strings containing
33
+ # separator tokens for tokenized incremental
34
+ # autocompletion. Example: <tt>:tokens => ','</tt> would
35
+ # allow multiple autocompletion entries, separated
36
+ # by commas.
37
+ # <tt>:min_chars</tt>:: The minimum number of characters that should be
38
+ # in the input field before an Ajax call is made
39
+ # to the server.
40
+ # <tt>:on_hide</tt>:: A Javascript expression that is called when the
41
+ # autocompletion div is hidden. The expression
42
+ # should take two variables: element and update.
43
+ # Element is a DOM element for the field, update
44
+ # is a DOM element for the div from which the
45
+ # innerHTML is replaced.
46
+ # <tt>:on_show</tt>:: Like on_hide, only now the expression is called
47
+ # then the div is shown.
48
+ # <tt>:after_update_element</tt>:: A Javascript expression that is called when the
49
+ # user has selected one of the proposed values.
50
+ # The expression should take two variables: element and value.
51
+ # Element is a DOM element for the field, value
52
+ # is the value selected by the user.
53
+ # <tt>:select</tt>:: Pick the class of the element from which the value for
54
+ # insertion should be extracted. If this is not specified,
55
+ # the entire element is used.
56
+ # <tt>:method</tt>:: Specifies the HTTP verb to use when the autocompletion
57
+ # request is made. Defaults to POST.
58
+ def auto_complete_field(field_id, options = {})
59
+ function = "var #{field_id}_auto_completer = new Ajax.Autocompleter("
60
+ function << "'#{field_id}', "
61
+ function << "'" + (options[:update] || "#{field_id}_auto_complete") + "', "
62
+ function << "'#{url_for(options[:url])}'"
63
+
64
+ js_options = {}
65
+ js_options[:tokens] = array_or_string_for_javascript(options[:tokens]) if options[:tokens]
66
+ js_options[:callback] = "function(element, value) { return #{options[:with]} }" if options[:with]
67
+ js_options[:indicator] = "'#{options[:indicator]}'" if options[:indicator]
68
+ js_options[:select] = "'#{options[:select]}'" if options[:select]
69
+ js_options[:paramName] = "'#{options[:param_name]}'" if options[:param_name]
70
+ js_options[:frequency] = "#{options[:frequency]}" if options[:frequency]
71
+ js_options[:method] = "'#{options[:method].to_s}'" if options[:method]
72
+
73
+ { :after_update_element => :afterUpdateElement,
74
+ :on_show => :onShow, :on_hide => :onHide, :min_chars => :minChars }.each do |k,v|
75
+ js_options[v] = options[k] if options[k]
76
+ end
77
+
78
+ function << (', ' + options_for_javascript(js_options) + ')')
79
+
80
+ javascript_tag(function)
81
+ end
82
+
83
+ # Use this method in your view to generate a return for the AJAX autocomplete requests.
84
+ #
85
+ # Example action:
86
+ #
87
+ # def auto_complete_for_item_title
88
+ # @items = Item.find(:all,
89
+ # :conditions => [ 'LOWER(description) LIKE ?',
90
+ # '%' + request.raw_post.downcase + '%' ])
91
+ # render :inline => "<%= auto_complete_result(@items, 'description') %>"
92
+ # end
93
+ #
94
+ # The auto_complete_result can of course also be called from a view belonging to the
95
+ # auto_complete action if you need to decorate it further.
96
+ def auto_complete_result(entries, field, phrase = nil)
97
+ return unless entries
98
+ items = entries.map { |entry| content_tag("li", phrase ? highlight(entry[field], phrase) : h(entry[field])) }
99
+ content_tag("ul", items.uniq)
100
+ end
101
+
102
+ # Wrapper for text_field with added AJAX autocompletion functionality.
103
+ #
104
+ # In your controller, you'll need to define an action called
105
+ # auto_complete_for to respond the AJAX calls,
106
+ #
107
+ def text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {})
108
+ (completion_options[:skip_style] ? "" : auto_complete_stylesheet) +
109
+ text_field(object, method, tag_options) +
110
+ content_tag("div", "", :id => "#{object}_#{method}_auto_complete", :class => "auto_complete") +
111
+ auto_complete_field("#{object}_#{method}", { :url => { :action => "auto_complete_for_#{object}_#{method}" } }.update(completion_options))
112
+ end
113
+
114
+ private
115
+ def auto_complete_stylesheet
116
+ content_tag('style', <<-EOT, :type => Mime::CSS)
117
+ div.auto_complete {
118
+ width: 350px;
119
+ background: #fff;
120
+ }
121
+ div.auto_complete ul {
122
+ border:1px solid #888;
123
+ margin:0;
124
+ padding:0;
125
+ width:100%;
126
+ list-style-type:none;
127
+ }
128
+ div.auto_complete ul li {
129
+ margin:0;
130
+ padding:3px;
131
+ }
132
+ div.auto_complete ul li.selected {
133
+ background-color: #ffb;
134
+ }
135
+ div.auto_complete ul strong.highlight {
136
+ color: #800;
137
+ margin:0;
138
+ padding:0;
139
+ }
140
+ EOT
141
+ end
142
+
143
+ end
@@ -0,0 +1,67 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../../../../test/test_helper'))
2
+
3
+ class AutoCompleteTest < Test::Unit::TestCase
4
+ include AutoComplete
5
+ include AutoCompleteMacrosHelper
6
+
7
+ include ActionView::Helpers::UrlHelper
8
+ include ActionView::Helpers::TagHelper
9
+ include ActionView::Helpers::TextHelper
10
+ include ActionView::Helpers::FormHelper
11
+ include ActionView::Helpers::CaptureHelper
12
+
13
+ def setup
14
+ @controller = Class.new do
15
+ def url_for(options)
16
+ url = "http://www.example.com/"
17
+ url << options[:action].to_s if options and options[:action]
18
+ url
19
+ end
20
+ end
21
+ @controller = @controller.new
22
+ end
23
+
24
+
25
+ def test_auto_complete_field
26
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {})\n//]]>\n</script>),
27
+ auto_complete_field("some_input", :url => { :action => "autocomplete" });
28
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:','})\n//]]>\n</script>),
29
+ auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => ',');
30
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:[',']})\n//]]>\n</script>),
31
+ auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => [',']);
32
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {minChars:3})\n//]]>\n</script>),
33
+ auto_complete_field("some_input", :url => { :action => "autocomplete" }, :min_chars => 3);
34
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {onHide:function(element, update){alert('me');}})\n//]]>\n</script>),
35
+ auto_complete_field("some_input", :url => { :action => "autocomplete" }, :on_hide => "function(element, update){alert('me');}");
36
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {frequency:2})\n//]]>\n</script>),
37
+ auto_complete_field("some_input", :url => { :action => "autocomplete" }, :frequency => 2);
38
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {afterUpdateElement:function(element,value){alert('You have chosen: '+value)}})\n//]]>\n</script>),
39
+ auto_complete_field("some_input", :url => { :action => "autocomplete" },
40
+ :after_update_element => "function(element,value){alert('You have chosen: '+value)}");
41
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {paramName:'huidriwusch'})\n//]]>\n</script>),
42
+ auto_complete_field("some_input", :url => { :action => "autocomplete" }, :param_name => 'huidriwusch');
43
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nvar some_input_auto_completer = new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {method:'get'})\n//]]>\n</script>),
44
+ auto_complete_field("some_input", :url => { :action => "autocomplete" }, :method => :get);
45
+ end
46
+
47
+ def test_auto_complete_result
48
+ result = [ { :title => 'test1' }, { :title => 'test2' } ]
49
+ assert_equal %(<ul><li>test1</li><li>test2</li></ul>),
50
+ auto_complete_result(result, :title)
51
+ assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li><li>t<strong class=\"highlight\">est</strong>2</li></ul>),
52
+ auto_complete_result(result, :title, "est")
53
+
54
+ resultuniq = [ { :title => 'test1' }, { :title => 'test1' } ]
55
+ assert_equal %(<ul><li>t<strong class=\"highlight\">est</strong>1</li></ul>),
56
+ auto_complete_result(resultuniq, :title, "est")
57
+ end
58
+
59
+ def test_text_field_with_auto_complete
60
+ assert_match %(<style type="text/css">),
61
+ text_field_with_auto_complete(:message, :recipient)
62
+
63
+ assert_dom_equal %(<input id=\"message_recipient\" name=\"message[recipient]\" size=\"30\" type=\"text\" /><div class=\"auto_complete\" id=\"message_recipient_auto_complete\"></div><script type=\"text/javascript\">\n//<![CDATA[\nvar message_recipient_auto_completer = new Ajax.Autocompleter('message_recipient', 'message_recipient_auto_complete', 'http://www.example.com/auto_complete_for_message_recipient', {})\n//]]>\n</script>),
64
+ text_field_with_auto_complete(:message, :recipient, {}, :skip_style => true)
65
+ end
66
+
67
+ end
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+
3
+ cd `dirname "$0"`
4
+ HERE=`pwd`
5
+ RAILS_VERSION=2.0.2
6
+
7
+ cd "$HERE"
8
+
9
+ echo "********** PROXY:${http_proxy:-none\\n**********\\n********** http_proxy is not set.\\n********** Please set http_proxy if you are behind a firewall.\\n**********\\n********** (example http_proxy=http://yourproxy:yourport)\\n**********}" | sed 's/\\n/\n/g'
10
+
11
+ gem${WINDIR:+.bat} install --no-rdoc --no-ri --version "= $RAILS_VERSION" rails
12
+
13
+
14
+
15
+ cd "$HERE"
16
+ echo "******************************"
17
+ echo "Never overwrite existing files"
18
+ echo " (answer N)"
19
+ echo "******************************"
20
+
21
+ TOBESAVED="rails/app/controllers/application.rb rails/config/routes.rb rails/config/environment.rb"
22
+ for x in $TOBESAVED
23
+ do
24
+ mv $x $x.save
25
+ done
26
+ rails${WINDIR:+.bat} "_${RAILS_VERSION}_" rails
27
+ rm -f rails/public/index.html
28
+
29
+ for x in $TOBESAVED
30
+ do
31
+ mv $x.save $x
32
+ done
33
+
34
+ cd "$HERE/rails"
35
+ ruby script/plugin install auto_complete
36
+
37
+ #if index.html is here there will be no redirection to /mtk
38
+ rm -f public/index.html
39
+
@@ -0,0 +1,21 @@
1
+ require 'ontomde-core'
2
+
3
+ module Kernel
4
+ def model_for_inspector
5
+ return @@model_for_inspector
6
+ end
7
+ def set_model_for_inspector(model)
8
+ @@model_for_inspector=model
9
+ end
10
+ end
11
+
12
+ module Mrdf_Repository
13
+ def inspector_start_daemon(fileName)
14
+
15
+ set_model_for_inspector(self)
16
+ Dir.chdir(File.dirname(__FILE__))
17
+ Dir.chdir("inspector/rails")
18
+ load("script/server")
19
+ end
20
+ end
21
+
@@ -139,7 +139,8 @@ class Crdf_Resource
139
139
  # range: array of types
140
140
  # value: a value
141
141
  # property: name of the property, value comes from (used in error message)
142
- def check_rdfType(range,value,property)
142
+ # src : owner of the property being processed
143
+ def check_rdfType(range,value,property,src=nil)
143
144
  return if value.nil?
144
145
  return if range.empty?
145
146
  range.each { |r|
@@ -150,7 +151,7 @@ class Crdf_Resource
150
151
  <<END
151
152
 
152
153
  ********* ILLEGAL ASSIGNEMENT TYPE **********
153
- ** property #{property}
154
+ ** property #{property} for uri=#{src.nil? ? "" : src.rdf_uri}
154
155
  ** has a range of (valid value types)
155
156
  ** [ #{range} ]
156
157
  ** which is not compatible with type #{value.class.name}
@@ -281,7 +282,7 @@ END
281
282
 
282
283
  if (true)
283
284
  ret << %{def #{sym_short}_typeOk?(val)
284
- check_rdfType(#{range_array},val,:#{sym_short})
285
+ check_rdfType(#{range_array},val,:#{sym_short},self)
285
286
  end
286
287
  }
287
288
  else
@@ -289,7 +290,7 @@ END
289
290
  # investigate reason of multiple execution
290
291
  ret << %{RANGE_#{sym_short}=#{range_array}
291
292
  def #{sym_short}_typeOk?(val)
292
- check_rdfType(RANGE_#{sym_short},val,:#{sym_short})
293
+ check_rdfType(RANGE_#{sym_short},val,:#{sym_short},self)
293
294
  end
294
295
  }
295
296
  end
@@ -345,7 +346,7 @@ END
345
346
  end
346
347
 
347
348
 
348
- module Mrdf_Model
349
+ module Mrdf_Repository
349
350
  def mtk_object_message
350
351
  return ""
351
352
  end
@@ -28,12 +28,12 @@ class Crdf_Resource #< Crdfs_Resource
28
28
  include Mrdf_Resource
29
29
  attr_reader :uri
30
30
  attr_reader :nbrItem
31
- attr_reader :rdf_model
31
+ attr_reader :rdf_Repository
32
32
  @@nbrItem=0
33
33
 
34
34
  # Utiliser pour un hack
35
- def force_rdf_model=(m)
36
- @rdf_model=m
35
+ def force_rdf_Repository=(m)
36
+ @rdf_Repository=m
37
37
  end
38
38
 
39
39
  # Returns a new empty attribute array
@@ -57,13 +57,13 @@ class Crdf_Resource #< Crdfs_Resource
57
57
  end
58
58
 
59
59
  model[uri]=self
60
- @rdf_model=model
60
+ @rdf_Repository=model
61
61
  @uri=uri
62
62
  @@nbrItem=@@nbrItem+1
63
63
  end
64
64
 
65
65
  #List of non resetable variables
66
- @@NonResetableVariables=['@rdf_model','@rdf_type','@uri']
66
+ @@NonResetableVariables=['@rdf_Repository','@rdf_type','@uri',"@ext_isReferencedBy"]
67
67
 
68
68
  #Return true if v is a restable property.
69
69
  def isResetable?(v)
@@ -165,7 +165,7 @@ class Crdf_Resource
165
165
  #Retrieves a uri from a ruby identifier
166
166
  def getRubyNameInverse(identifier)
167
167
  found=nil
168
- rdf_model.each { |k,c|
168
+ rdf_Repository.each { |k,c|
169
169
  next if c.getRubyName!=identifier.to_s
170
170
  log.error("Ruby name clash for #{identifier} and #{k}") unless found.nil?
171
171
  found=k
@@ -1,4 +1,4 @@
1
- module Mrdf_Model
1
+ module Mrdf_Repository
2
2
  end
3
3
 
4
4
  class Crdf_Resource
@@ -9,8 +9,8 @@ class Crdf_Resource
9
9
  end
10
10
 
11
11
  #Class meant to store every element of a model.
12
- class Crdf_Model #< Hash
13
- include Mrdf_Model
12
+ class Crdf_Repository #< Hash
13
+ include Mrdf_Repository
14
14
  attr_reader :updateCount
15
15
 
16
16
  attr :typeIndex
@@ -98,10 +98,10 @@ class Crdf_Model #< Hash
98
98
  end
99
99
 
100
100
  # internal use
101
- def parse(nt,modeData)
102
- if modeData
101
+ def parseNT(nt,modeData)
102
+ if modeData # MODE_parseModelStream_POPULATE_FIELDS
103
103
  parseModeData(nt)
104
- else
104
+ else # MODE_parseModelStream_CREATE_INSTANCES
105
105
  parseModeResource(nt)
106
106
  end
107
107
  end
@@ -164,6 +164,7 @@ class Crdf_Model #< Hash
164
164
  def generateClassesFromMetamodel(outRubyModelFileName)
165
165
  #log.debug("ecriture du metamodele dans: #{outRubyModelFileName}")
166
166
  mtk_default_context(:logFileWrite => false) { mtk_writeSession(outRubyModelFileName) {
167
+ mtk_addTempFileToDelete(outRubyModelFileName)
167
168
  f=self
168
169
  f.write <<END
169
170
  # Start of file #{outRubyModelFileName}
@@ -6,6 +6,7 @@ class UriNamespace
6
6
  # Les 1er sont prioritaire pour unalias ??
7
7
  @urialiases=Hash.new(nil)
8
8
  @urialiases["http:\/\/uml\/2"]="uml"
9
+ #@urialiases["http://schema.omg.org/spec/UML/2.1"]="uml"
9
10
  #@urialiases["http:\/\/uml\/1.4"]="uml"
10
11
  @urialiases["http:\/\/www.w3.org\/2000\/01\/rdf-schema"]="rdfs"
11
12
  @urialiases["http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns"]="rdf"
@@ -14,6 +15,7 @@ class UriNamespace
14
15
  @urialiases["http:\/\/ft\/uml\/2"]="umlx"
15
16
  @urialiases["http:\/\/kb"]="ukb"
16
17
  @urialiases["http:\/\/orange-ftgroup.com\/2007\/rd\/xmda\/bpm"]="bpm"
18
+ @urialiases["http:\/\/protege.stanford.edu\/soa"]="soa"
17
19
  end
18
20
 
19
21
  # Returns unaliases uri for uri
@@ -1,5 +1,5 @@
1
1
  module Ontomde
2
2
  module Core
3
- VERSION='1.0.6'
3
+ VERSION='2.0.0'
4
4
  end
5
5
  end
@@ -36,7 +36,7 @@ end
36
36
  DATADIR=File.dirname(__FILE__)
37
37
 
38
38
  # load meta-model from file
39
- model=Crdf_Model.new
39
+ model=Crdf_Repository.new
40
40
  model.loadMetaModelFromFile("#{DATADIR}/etatCivil.rdfs",true)
41
41
 
42
42
  # load model from file