gfdnavi 1.3.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.
- data/ChangeLog +10949 -0
- data/LICENCE.txt +57 -0
- data/Makefile +18 -0
- data/TODO +132 -0
- data/app/controllers/analysis_controller.rb +700 -0
- data/app/controllers/application.rb +41 -0
- data/app/controllers/draw_method_controller.rb +172 -0
- data/app/controllers/explorer_controller.rb +197 -0
- data/app/controllers/finder_controller.rb +331 -0
- data/app/controllers/function_controller.rb +204 -0
- data/app/controllers/group_controller.rb +115 -0
- data/app/controllers/keyword_attributes_controller.rb +52 -0
- data/app/controllers/knowledge_controller.rb +928 -0
- data/app/controllers/nodes_controller.rb +515 -0
- data/app/controllers/search_controller.rb +341 -0
- data/app/controllers/user_controller.rb +337 -0
- data/app/helpers/analysis_helper.rb +2 -0
- data/app/helpers/application_helper.rb +105 -0
- data/app/helpers/description_helper.rb +2 -0
- data/app/helpers/function_helper.rb +2 -0
- data/app/helpers/group_helper.rb +2 -0
- data/app/helpers/search_helper.rb +3 -0
- data/app/helpers/user_helper.rb +2 -0
- data/app/helpers/work_flow_helper.rb +92 -0
- data/app/models/actual_file.rb +3 -0
- data/app/models/analysis.rb +715 -0
- data/app/models/analysis_history.rb +42 -0
- data/app/models/cross_array.rb +22 -0
- data/app/models/cross_result.rb +254 -0
- data/app/models/derived_spatial_attribute.rb +3 -0
- data/app/models/diagram_cache.rb +16 -0
- data/app/models/diagram_cache_datum.rb +4 -0
- data/app/models/diagram_cache_session.rb +8 -0
- data/app/models/directory.rb +21 -0
- data/app/models/draw_method.rb +48 -0
- data/app/models/draw_method_attribute.rb +8 -0
- data/app/models/draw_parameter.rb +12 -0
- data/app/models/explorer_query.rb +354 -0
- data/app/models/explorer_result.rb +312 -0
- data/app/models/function.rb +75 -0
- data/app/models/function_argument.rb +6 -0
- data/app/models/function_output.rb +4 -0
- data/app/models/group.rb +153 -0
- data/app/models/image.rb +20 -0
- data/app/models/keyword_attribute.rb +179 -0
- data/app/models/knowledge.rb +94 -0
- data/app/models/knowledge_backup.rb +32 -0
- data/app/models/knowledge_figure.rb +16 -0
- data/app/models/knowledge_figure_backup.rb +16 -0
- data/app/models/knowledge_parser.rb +392 -0
- data/app/models/node.rb +605 -0
- data/app/models/node_entity_abstract.rb +112 -0
- data/app/models/node_lineage.rb +6 -0
- data/app/models/node_relation.rb +4 -0
- data/app/models/path_node.rb +60 -0
- data/app/models/query.rb +193 -0
- data/app/models/query_history.rb +12 -0
- data/app/models/results.rb +48 -0
- data/app/models/sign_up_user.rb +25 -0
- data/app/models/spatial_and_time_attribute.rb +11 -0
- data/app/models/user.rb +115 -0
- data/app/models/user_mailer.rb +48 -0
- data/app/models/value_type.rb +3 -0
- data/app/models/variable.rb +70 -0
- data/app/models/virtual_node.rb +457 -0
- data/app/views/analysis/__help_analysis_tab.en.html +57 -0
- data/app/views/analysis/__help_draw_share.en.html +12 -0
- data/app/views/analysis/__help_draw_tab.en.html +6 -0
- data/app/views/analysis/_analysis_function_settings.rhtml +61 -0
- data/app/views/analysis/_analysis_settings.rhtml +28 -0
- data/app/views/analysis/_diagram.rhtml +70 -0
- data/app/views/analysis/_dimension_option.rhtml +59 -0
- data/app/views/analysis/_draw_general_settings.rhtml +217 -0
- data/app/views/analysis/_draw_settings.rhtml +73 -0
- data/app/views/analysis/_history.rhtml +19 -0
- data/app/views/analysis/_popular_diagrams.rhtml +42 -0
- data/app/views/analysis/_save_form.rhtml +44 -0
- data/app/views/analysis/_variables.rhtml +66 -0
- data/app/views/analysis/_variables_order.rhtml +56 -0
- data/app/views/analysis/index.rhtml +195 -0
- data/app/views/analysis/preview.rhtml +3 -0
- data/app/views/analysis/save.rhtml +73 -0
- data/app/views/analysis/show_diagram.rhtml +42 -0
- data/app/views/cross/_display_map.rhtml +201 -0
- data/app/views/cross/_result.rhtml +205 -0
- data/app/views/cross/_show_result_tree.rhtml +40 -0
- data/app/views/cross/_show_results.rhtml +80 -0
- data/app/views/cross/_style.rhtml +21 -0
- data/app/views/cross/index.rhtml +271 -0
- data/app/views/draw_method/_edit_form.rhtml +110 -0
- data/app/views/draw_method/create.rhtml +8 -0
- data/app/views/draw_method/details.rhtml +113 -0
- data/app/views/draw_method/edit.rhtml +8 -0
- data/app/views/draw_method/list.rhtml +80 -0
- data/app/views/explorer/_display_map.rhtml +199 -0
- data/app/views/explorer/_show_result_tree.rhtml +40 -0
- data/app/views/explorer/_show_results.rhtml +101 -0
- data/app/views/explorer/_style.rhtml +21 -0
- data/app/views/explorer/index.rhtml +214 -0
- data/app/views/finder/_children.html.erb +84 -0
- data/app/views/finder/_children_details.html.erb +74 -0
- data/app/views/finder/_children_details_tr.html.erb +196 -0
- data/app/views/finder/create_tree.html.erb +15 -0
- data/app/views/finder/flex.html.erb +52 -0
- data/app/views/finder/index.html.erb +47 -0
- data/app/views/finder/show_details.html.erb +3 -0
- data/app/views/finder/show_images.html.erb +3 -0
- data/app/views/function/_edit_form.rhtml +106 -0
- data/app/views/function/create.rhtml +8 -0
- data/app/views/function/details.rhtml +96 -0
- data/app/views/function/edit.rhtml +8 -0
- data/app/views/function/list.rhtml +80 -0
- data/app/views/group/add_member.rhtml +13 -0
- data/app/views/group/change_owner.rhtml +15 -0
- data/app/views/group/create.rhtml +11 -0
- data/app/views/group/delete_member.rhtml +14 -0
- data/app/views/group/list.rhtml +63 -0
- data/app/views/knowledge/_backup.rhtml +135 -0
- data/app/views/knowledge/_category.rhtml +58 -0
- data/app/views/knowledge/_category_list.rhtml +34 -0
- data/app/views/knowledge/_category_table.rhtml +23 -0
- data/app/views/knowledge/_comment.rhtml +64 -0
- data/app/views/knowledge/_comment_input_form.rhtml +19 -0
- data/app/views/knowledge/_comments.rhtml +84 -0
- data/app/views/knowledge/_form.rhtml +139 -0
- data/app/views/knowledge/_group_figure_form.rhtml +187 -0
- data/app/views/knowledge/_layout_figure.rhtml +61 -0
- data/app/views/knowledge/_layout_figures_in_a_row_above_text.rhtml +42 -0
- data/app/views/knowledge/_layout_figures_under_text.rhtml +45 -0
- data/app/views/knowledge/_layout_one_figure_above_text.rhtml +28 -0
- data/app/views/knowledge/_summary.rhtml +21 -0
- data/app/views/knowledge/edit.rhtml +37 -0
- data/app/views/knowledge/list.rhtml +287 -0
- data/app/views/knowledge/new.rhtml +23 -0
- data/app/views/knowledge/new_from_analysis.rhtml +21 -0
- data/app/views/knowledge/show.rhtml +196 -0
- data/app/views/layouts/gfdnavi.rhtml +105 -0
- data/app/views/nodes/_ancestors.html.erb +89 -0
- data/app/views/nodes/_description_methods_table.html.erb +75 -0
- data/app/views/nodes/_mode.html.erb +16 -0
- data/app/views/nodes/description.html.erb +181 -0
- data/app/views/nodes/description_methods.html.erb +1 -0
- data/app/views/nodes/edit.html.erb +73 -0
- data/app/views/nodes/index.html.erb +25 -0
- data/app/views/nodes/show.html.erb +20 -0
- data/app/views/search/_children_details_mapsearch.rhtml +68 -0
- data/app/views/search/_children_details_tr.rhtml +205 -0
- data/app/views/search/_show_grouplist.rhtml +74 -0
- data/app/views/search/_show_results.rhtml +43 -0
- data/app/views/search/_show_results_global.rhtml +36 -0
- data/app/views/search/_show_results_partial.rhtml +39 -0
- data/app/views/search/_show_results_partial_groupbyfile.rhtml +50 -0
- data/app/views/search/_show_variablelist.rhtml +28 -0
- data/app/views/search/mapsearch.rhtml +176 -0
- data/app/views/search/remapsearch.rjs +18 -0
- data/app/views/search/show_details.rhtml +3 -0
- data/app/views/user/add_user.rhtml +30 -0
- data/app/views/user/change_password.rhtml +25 -0
- data/app/views/user/edit.html.erb +50 -0
- data/app/views/user/index.rhtml +162 -0
- data/app/views/user/login.rhtml +41 -0
- data/app/views/user/logout.rhtml +4 -0
- data/app/views/user/signup.rhtml +36 -0
- data/app/views/user/signup_succeeded.rhtml +36 -0
- data/app/views/user_mailer/authorization_inform.rhtml +15 -0
- data/app/views/user_mailer/signup_accepted.rhtml +12 -0
- data/app/views/user_mailer/signup_confirm.rhtml +14 -0
- data/app/views/user_mailer/signup_inform.rhtml +13 -0
- data/app/views/user_mailer/signup_rejected.rhtml +11 -0
- data/app/views/work_flow/_push_wsdls.rhtml +55 -0
- data/app/views/work_flow/index.rhtml +46 -0
- data/config/database.yml.example +35 -0
- data/config/environment.rb +68 -0
- data/config/gfdnavi.yml.example +95 -0
- data/config/load_config.rb +151 -0
- data/config/routes.rb +35 -0
- data/consistency_checker.rb +129 -0
- data/data/gfdnavi_docs/how_to_draw_multiple_images.knlge +68 -0
- data/data/gfdnavi_docs/how_to_knowledge.knlge +138 -0
- data/data/gfdnavi_docs/how_to_write_document_about_Gfdnavi.knlge +30 -0
- data/data/samples/jmadata.SIGEN +8 -0
- data/data/samples/jmadata.yml +6 -0
- data/data/samples/jmadata/MSM-P/2006.nc.yml +2 -0
- data/data/samples/jmadata/MSM-P/2006.yml +17 -0
- data/data/samples/jmadata/MSM-P/2006/0101.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0101.nc.yml +13 -0
- data/data/samples/jmadata/MSM-P/2006/0102.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0103.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0104.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0105.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/010[1-3].nc.yml +2 -0
- data/data/samples/jmadata/MSM-P/2006/skip_data.rb +96 -0
- data/data/samples/jmadata/MSM-P/2006/skip_data.sh +6 -0
- data/data/samples/reanalysis.SIGEN +8 -0
- data/data/samples/reanalysis/era40.SIGEN +8 -0
- data/data/samples/reanalysis/era40.yml +2 -0
- data/data/samples/reanalysis/era40/t.jan.nc +0 -0
- data/data/samples/reanalysis/era40/t.jan.nc.yml +1 -0
- data/data/samples/reanalysis/ncep.SIGEN +9 -0
- data/data/samples/reanalysis/ncep/T.jan.100hPa.png +0 -0
- data/data/samples/reanalysis/ncep/T.jan.100hPa.png.yml +43 -0
- data/data/samples/reanalysis/ncep/T.jan.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc.yml +8 -0
- data/data/samples/reanalysis/ncep/T.jan_only_root.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan_only_root.nc.yml +4 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc +0 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc.yml +10 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc.yml.ja +11 -0
- data/data/samples/sonde_operational.yml +5 -0
- data/data/samples/sonde_operational/std_plev.yml +12 -0
- data/data/samples/sonde_operational/std_plev/41256.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/42410.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/43333.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/43346.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/48698.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/61641.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/63741.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/67083.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/72261.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/76805.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/82193.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91165.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91610.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91948.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/94294.spl.nc +0 -0
- data/db/NetCDFparser.rb +406 -0
- data/db/create_derived_spatial_attributes.sql +12 -0
- data/db/draw_methods/line.yml +6 -0
- data/db/draw_methods/scatter.yml +38 -0
- data/db/draw_methods/tone.yml +64 -0
- data/db/draw_methods/vector.yml +19 -0
- data/db/dump_db.rb +43 -0
- data/db/functions/additions.yml +10 -0
- data/db/functions/cut.yml +10 -0
- data/db/functions/division.yml +10 -0
- data/db/functions/mean.yml +28 -0
- data/db/functions/multiplication.yml +10 -0
- data/db/functions/stddev.yml +28 -0
- data/db/functions/subtraction.yml +10 -0
- data/db/migrate/001_initial_scheme.rb +289 -0
- data/db/migrate/002_add_open_id_authentication_tables.rb +20 -0
- data/db/register_directory_tree.rb +760 -0
- data/db/restore_db.rb +60 -0
- data/gfdnavi-install +828 -0
- data/install.rb +828 -0
- data/lib/activerecord_gfdnavi.rb +31 -0
- data/lib/basic_authorization.rb +50 -0
- data/lib/create_activeresources.rb +108 -0
- data/lib/execute_analysis.rb +472 -0
- data/lib/file_gfdnavi.rb +38 -0
- data/lib/gphys_gfdnavi.rb +81 -0
- data/lib/localdir.rb +110 -0
- data/lib/login_system.rb +110 -0
- data/lib/multibytes.rb +20 -0
- data/lib/narray_yaml.rb +58 -0
- data/lib/no_rdb_base.rb +40 -0
- data/lib/opendapdir.rb +171 -0
- data/lib/tar.rb +127 -0
- data/lib/tasks/clean.rake +65 -0
- data/lib/tasks/setup.rake +316 -0
- data/lib/tasks/update.rake +62 -0
- data/lib/vizshot_gfdnavi.rb +224 -0
- data/public/crossdomain.xml +4 -0
- data/public/flex/NodeTreeDescriptor.as +55 -0
- data/public/flex/TreeNode.as +253 -0
- data/public/flex/finder.mxml +304 -0
- data/public/flex/finder.swf +0 -0
- data/public/flex/gfdnavi.mxml +52 -0
- data/public/flex/gfdnavi.swf +0 -0
- data/public/images/Help_S-shots/dir_tree_with_add.jpg +0 -0
- data/public/images/analyze.gif +0 -0
- data/public/images/circle.gif +0 -0
- data/public/images/create_from_analysis_button.png +0 -0
- data/public/images/delete.png +0 -0
- data/public/images/down.png +0 -0
- data/public/images/drawbutton.gif +0 -0
- data/public/images/gfdnavi_home_logo.png +0 -0
- data/public/images/gfdnavi_logo_big.png +0 -0
- data/public/images/gfdnavi_logo_med.png +0 -0
- data/public/images/gfdnavi_logo_mini.png +0 -0
- data/public/images/gfdnavi_logo_nobg_big.png +0 -0
- data/public/images/gfdnavi_logo_nobg_med.png +0 -0
- data/public/images/gfdnavi_logo_nobg_small.png +0 -0
- data/public/images/gfdnavi_logo_small.png +0 -0
- data/public/images/gfdnavi_logo_xsmall.png +0 -0
- data/public/images/hbar.png +0 -0
- data/public/images/helpmark16.png +0 -0
- data/public/images/helpmark18.png +0 -0
- data/public/images/kikyu_g.gif +0 -0
- data/public/images/kikyu_r.gif +0 -0
- data/public/images/map_icon_g.gif +0 -0
- data/public/images/map_icon_r.gif +0 -0
- data/public/images/new_knowledge.png +0 -0
- data/public/images/openid.png +0 -0
- data/public/images/read_in_the_form.png +0 -0
- data/public/images/slider_f.gif +0 -0
- data/public/images/slider_f_red.gif +0 -0
- data/public/images/star1.gif +0 -0
- data/public/images/star2.gif +0 -0
- data/public/images/startanim.gif +0 -0
- data/public/images/stopanim.gif +0 -0
- data/public/images/tree/DL.png +0 -0
- data/public/images/tree/anal_viz.png +0 -0
- data/public/images/tree/analyze_visualize_checked_items.png +0 -0
- data/public/images/tree/binary.png +0 -0
- data/public/images/tree/details.png +0 -0
- data/public/images/tree/download_checked_items.png +0 -0
- data/public/images/tree/folder.png +0 -0
- data/public/images/tree/folder_close.gif +0 -0
- data/public/images/tree/image2.png +0 -0
- data/public/images/tree/knowledge.png +0 -0
- data/public/images/tree/knowledges.png +0 -0
- data/public/images/tree/last.gif +0 -0
- data/public/images/tree/last.png +0 -0
- data/public/images/tree/minus.gif +0 -0
- data/public/images/tree/minus_simple.gif +0 -0
- data/public/images/tree/none.gif +0 -0
- data/public/images/tree/none.png +0 -0
- data/public/images/tree/plus.gif +0 -0
- data/public/images/tree/plus_simple.gif +0 -0
- data/public/images/tree/show.png +0 -0
- data/public/images/tree/show_checked_items.png +0 -0
- data/public/images/tree/t.gif +0 -0
- data/public/images/tree/t.png +0 -0
- data/public/images/tree/tate.gif +0 -0
- data/public/images/tree/tate.png +0 -0
- data/public/images/up.png +0 -0
- data/public/images/vbar.png +0 -0
- data/public/images/white.bmp +0 -0
- data/public/images/x.gif +0 -0
- data/public/index.html +100 -0
- data/public/javascripts/AC_OETags.js +269 -0
- data/public/javascripts/analysis.js +751 -0
- data/public/javascripts/application.js +29 -0
- data/public/javascripts/directory_tree.js +102 -0
- data/public/javascripts/draw_method.js +83 -0
- data/public/javascripts/excanvas.js +704 -0
- data/public/javascripts/function.js +107 -0
- data/public/javascripts/gfdnavi.js +175 -0
- data/public/javascripts/knowledge.js +384 -0
- data/public/javascripts/mapsearch.js +313 -0
- data/public/javascripts/progress.js +42 -0
- data/public/javascripts/resizable_box.js +164 -0
- data/public/javascripts/slider.js +260 -0
- data/public/javascripts/tab.js +17 -0
- data/public/javascripts/work_flow.js +452 -0
- data/public/stylesheets/analysis.css +111 -0
- data/public/stylesheets/description.css +71 -0
- data/public/stylesheets/gfdnavi.css +141 -0
- data/public/stylesheets/knowledge.css +218 -0
- data/public/stylesheets/search.css +184 -0
- data/public/stylesheets/tree.css +45 -0
- data/public/stylesheets/tree_for_ie.css +3 -0
- data/public/stylesheets/work_flow.css +78 -0
- data/script/cleaner +11 -0
- data/script/server_ssl +131 -0
- data/test/fixtures/diagram_cache_data.yml +5 -0
- data/test/fixtures/diagram_cache_sessions.yml +6 -0
- data/test/fixtures/diagram_caches.yml +6 -0
- data/test/fixtures/directories.yml +57 -0
- data/test/fixtures/draw_parameters.yml +6 -0
- data/test/fixtures/function_arguments.yml +15 -0
- data/test/fixtures/function_outputs.yml +15 -0
- data/test/fixtures/functions.yml +29 -0
- data/test/fixtures/group_members.yml +33 -0
- data/test/fixtures/groups.yml +25 -0
- data/test/fixtures/images.yml +12 -0
- data/test/fixtures/keyword_attributes.yml +73 -0
- data/test/fixtures/knowledges.yml +10 -0
- data/test/fixtures/node_relations.yml +11 -0
- data/test/fixtures/nodes.yml +298 -0
- data/test/fixtures/sign_up_users.yml +8 -0
- data/test/fixtures/spatial_and_time_attributes.yml +29 -0
- data/test/fixtures/user_mailer/authorization_inform +11 -0
- data/test/fixtures/user_mailer/signup_accepted +10 -0
- data/test/fixtures/user_mailer/signup_confirm +17 -0
- data/test/fixtures/user_mailer/signup_inform +10 -0
- data/test/fixtures/user_mailer/signup_rejected +9 -0
- data/test/fixtures/users.yml +31 -0
- data/test/fixtures/value_types.yml +10 -0
- data/test/fixtures/variables.yml +17 -0
- data/test/functional/analysis_controller_test.rb +169 -0
- data/test/functional/description_controller_test.rb +18 -0
- data/test/functional/function_controller_test.rb +18 -0
- data/test/functional/group_controller_test.rb +18 -0
- data/test/functional/search_controller_test.rb +83 -0
- data/test/functional/user_controller_test.rb +77 -0
- data/test/functional/webservice_analysis_api_test.rb +12 -0
- data/test/functional/work_flow_controller_test.rb +18 -0
- data/test/test_helper.rb +28 -0
- data/test/unit/diagram_cache_datum_test.rb +10 -0
- data/test/unit/diagram_cache_session_test.rb +10 -0
- data/test/unit/diagram_cache_test.rb +10 -0
- data/test/unit/directory_test.rb +49 -0
- data/test/unit/draw_parameter_test.rb +10 -0
- data/test/unit/function_argument_test.rb +10 -0
- data/test/unit/function_output_test.rb +10 -0
- data/test/unit/function_test.rb +10 -0
- data/test/unit/group_test.rb +48 -0
- data/test/unit/image_test.rb +13 -0
- data/test/unit/keyword_attribute_test.rb +33 -0
- data/test/unit/knowledge_test.rb +13 -0
- data/test/unit/node_relation_test.rb +20 -0
- data/test/unit/node_test.rb +85 -0
- data/test/unit/sign_up_user_test.rb +20 -0
- data/test/unit/spatial_and_time_attribute_test.rb +29 -0
- data/test/unit/user_mailer_test.rb +101 -0
- data/test/unit/user_test.rb +134 -0
- data/test/unit/value_type_test.rb +10 -0
- data/test/unit/variable_test.rb +35 -0
- data/vendor/plugins/acts_as_list/README +23 -0
- data/vendor/plugins/acts_as_list/init.rb +3 -0
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/vendor/plugins/acts_as_tree/README +26 -0
- data/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/vendor/plugins/will_paginate/CHANGELOG +92 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +131 -0
- data/vendor/plugins/will_paginate/Rakefile +62 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +86 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +145 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +247 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +132 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +39 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +373 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +21 -0
- metadata +586 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
require "activerecord_gfdnavi"
|
|
2
|
+
|
|
3
|
+
class ExplorerQuery
|
|
4
|
+
|
|
5
|
+
def make_query(descriptions,user)
|
|
6
|
+
results = Hash.new
|
|
7
|
+
options=Array.new
|
|
8
|
+
@spregion=[10,-80,350,80]
|
|
9
|
+
descriptions.each{ |desc|
|
|
10
|
+
if desc=~/\[(.*)\]/ then
|
|
11
|
+
case $1
|
|
12
|
+
when "K"
|
|
13
|
+
options.push(get_condition4kw(desc))
|
|
14
|
+
when "F"
|
|
15
|
+
options.push(get_condition4fw(desc))
|
|
16
|
+
when "S"
|
|
17
|
+
o=get_condition4space(desc)
|
|
18
|
+
options.push(o)
|
|
19
|
+
@spregion=o[:spregion]
|
|
20
|
+
when "T"
|
|
21
|
+
options.push(get_condition4time(desc))
|
|
22
|
+
when "P"
|
|
23
|
+
options.push(get_condition4path(desc))
|
|
24
|
+
when "N"
|
|
25
|
+
options.push(get_condition4nodetype(desc))
|
|
26
|
+
end
|
|
27
|
+
end #if desc
|
|
28
|
+
}
|
|
29
|
+
if options then
|
|
30
|
+
allqstr = generate_querystring(options,user)
|
|
31
|
+
end
|
|
32
|
+
#puts allqstr
|
|
33
|
+
return allqstr
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def generate_results(rnodes,expres,options)
|
|
37
|
+
limit = 100
|
|
38
|
+
if options[:limit]!=nil then
|
|
39
|
+
limit = options[:limit].to_i
|
|
40
|
+
end
|
|
41
|
+
offset = 0
|
|
42
|
+
if options[:offset]!=nil then
|
|
43
|
+
offset = options[:offset].to_i
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
result_nodes=Array.new
|
|
47
|
+
lcnt=0
|
|
48
|
+
ocnt=0
|
|
49
|
+
rnodes.each{|n|
|
|
50
|
+
if ocnt>=offset then
|
|
51
|
+
node=Hash.new
|
|
52
|
+
node[:type] = Integer=== n.node_type ? Node::NODE_TYPES[n.node_type] : n.node_type
|
|
53
|
+
node[:path] = n.path
|
|
54
|
+
ttl = n.stdname("title")
|
|
55
|
+
node[:title] = ttl ? ttl.value : n.name
|
|
56
|
+
desc = n.stdname("description")
|
|
57
|
+
node[:description] = desc ? desc.value : ''
|
|
58
|
+
node[:name] = n.name
|
|
59
|
+
result_nodes.push(node)
|
|
60
|
+
lcnt=lcnt+1
|
|
61
|
+
end
|
|
62
|
+
ocnt=ocnt+1
|
|
63
|
+
if lcnt>=limit then
|
|
64
|
+
break
|
|
65
|
+
end
|
|
66
|
+
}
|
|
67
|
+
results = Hash.new
|
|
68
|
+
results["nodes"]=result_nodes
|
|
69
|
+
#show keyword facet
|
|
70
|
+
if options["show_kwfacets"].to_i==1 then
|
|
71
|
+
if options["show_kwvalues"].to_i==1 then
|
|
72
|
+
keyname="-"
|
|
73
|
+
kcnt=-1
|
|
74
|
+
keyvalues=Array.new
|
|
75
|
+
keylist = expres.get_keyname_and_keyvalue_list
|
|
76
|
+
if keylist!=nil then
|
|
77
|
+
keywords = Array.new
|
|
78
|
+
keylist.each{ |kl|
|
|
79
|
+
if keyname.downcase!=kl.kname.downcase then
|
|
80
|
+
if kcnt>-1 then
|
|
81
|
+
keycount = Hash.new
|
|
82
|
+
keycount[:keyname]=keyname
|
|
83
|
+
keycount[:count]=kcnt
|
|
84
|
+
keycount[:keyvalues]=keyvalues
|
|
85
|
+
keywords.push(keycount)
|
|
86
|
+
end
|
|
87
|
+
keyvalues=Array.new
|
|
88
|
+
if kl.cnt then
|
|
89
|
+
kcnt=kl.cnt.to_i
|
|
90
|
+
else
|
|
91
|
+
kcnt=0
|
|
92
|
+
end
|
|
93
|
+
keyname=kl.kname
|
|
94
|
+
else
|
|
95
|
+
if kl.cnt then
|
|
96
|
+
kcnt=kcnt+kl.cnt.to_i
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
kvalue=Hash.new
|
|
100
|
+
kvalue[:keyvalue]=kl.kvalue
|
|
101
|
+
if kl.cnt then
|
|
102
|
+
kvalue[:count]=kl.cnt.to_i
|
|
103
|
+
else
|
|
104
|
+
kvalue[:count]=0
|
|
105
|
+
end
|
|
106
|
+
keyvalues.push(kvalue)
|
|
107
|
+
}
|
|
108
|
+
keycount = Hash.new
|
|
109
|
+
keycount[:keyname]=keyname
|
|
110
|
+
keycount[:count]=kcnt
|
|
111
|
+
keycount[:keyvalues]=keyvalues
|
|
112
|
+
keywords.push(keycount)
|
|
113
|
+
keywords.reverse!{|a,b|
|
|
114
|
+
a[:count].to_i<=>b[:count].to_i
|
|
115
|
+
}
|
|
116
|
+
results["keywords"]=keywords
|
|
117
|
+
end
|
|
118
|
+
else
|
|
119
|
+
keylist = expres.get_keyname_list
|
|
120
|
+
if keylist!=nil then
|
|
121
|
+
keywords = Array.new
|
|
122
|
+
keylist.each{ |kl|
|
|
123
|
+
keycount = Hash.new
|
|
124
|
+
keycount[:keyname]=kl.kname
|
|
125
|
+
keycount[:count]=kl.cnt
|
|
126
|
+
keywords.push(keycount)
|
|
127
|
+
}
|
|
128
|
+
results["keywords"]=keywords
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
#show spatial facet
|
|
133
|
+
if options["show_spfacets"].to_i==1 then
|
|
134
|
+
spfacets=Hash.new
|
|
135
|
+
results[:spatial_attributes]=spfacets
|
|
136
|
+
points=Array.new
|
|
137
|
+
spfacets[:points]=points
|
|
138
|
+
expres.points(@spregion[0],@spregion[1],@spregion[2],@spregion[3]).each{|p|
|
|
139
|
+
pnt=Hash.new
|
|
140
|
+
pnt[:latitude_lb]=p.latitude_lb
|
|
141
|
+
pnt[:longitude_lb]=p.longitude_lb
|
|
142
|
+
pnt[:latitude_rt]=p.latitude_rt
|
|
143
|
+
pnt[:longitude_rt]=p.longitude_rt
|
|
144
|
+
pnt[:count]=p.cnt
|
|
145
|
+
points.push(pnt)
|
|
146
|
+
}
|
|
147
|
+
partial_covered_regions=Array.new
|
|
148
|
+
spfacets[:partial_covered]=partial_covered_regions
|
|
149
|
+
expres.partial_covered(@spregion[0],@spregion[1],@spregion[2],@spregion[3]).each{|p|
|
|
150
|
+
rgn=Hash.new
|
|
151
|
+
rgn[:latitude_lb]=p.latitude_lb
|
|
152
|
+
rgn[:longitude_lb]=p.longitude_lb
|
|
153
|
+
rgn[:latitude_rt]=p.latitude_rt
|
|
154
|
+
rgn[:longitude_rt]=p.longitude_rt
|
|
155
|
+
rgn[:count]=p.cnt
|
|
156
|
+
partial_covered_regions.push(rgn)
|
|
157
|
+
}
|
|
158
|
+
all_covered_regions=Array.new
|
|
159
|
+
spfacets[:all_covered]=all_covered_regions
|
|
160
|
+
expres.all_covered(@spregion[0],@spregion[1],@spregion[2],@spregion[3]).each{|p|
|
|
161
|
+
rgn=Hash.new
|
|
162
|
+
rgn[:latitude_lb]=p.latitude_lb
|
|
163
|
+
rgn[:longitude_lb]=p.longitude_lb
|
|
164
|
+
rgn[:latitude_rt]=p.latitude_rt
|
|
165
|
+
rgn[:longitude_rt]=p.longitude_rt
|
|
166
|
+
rgn[:count]=p.cnt
|
|
167
|
+
all_covered_regions.push(rgn)
|
|
168
|
+
}
|
|
169
|
+
end
|
|
170
|
+
return results
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def generate_querystring(options,user)
|
|
174
|
+
cnt=0
|
|
175
|
+
sptmky=Array.new
|
|
176
|
+
sptm_qstr_conditions=Array.new
|
|
177
|
+
node_qstr_conditions=Array.new
|
|
178
|
+
|
|
179
|
+
options.each{ |qh|
|
|
180
|
+
if qh[:querytype] == "keyword" || qh[:querytype]=="keyname" || qh[:querytype] == "freeword" then
|
|
181
|
+
qstr=<<-EOM
|
|
182
|
+
select r.descendant as nid, 'k#{cnt}' as qno, r.rel_depth as relevance
|
|
183
|
+
from keyword_attributes k join node_lineages r on k.node_id = r.ancestor
|
|
184
|
+
where #{qh[:cond]}
|
|
185
|
+
EOM
|
|
186
|
+
sptmky.push(qstr)
|
|
187
|
+
if qh[:querytype] == "freeword" then
|
|
188
|
+
qh[:cond] =~/name like (.*) or/
|
|
189
|
+
qstr=<<-EOM
|
|
190
|
+
select r.descendant as nid, 'k#{cnt}' as qno, r.rel_depth as relevance
|
|
191
|
+
from nodes n join node_lineages r on n.id = r.descendant
|
|
192
|
+
where name like #{$1}
|
|
193
|
+
EOM
|
|
194
|
+
sptmky.push(qstr)
|
|
195
|
+
end
|
|
196
|
+
cnt=cnt+1
|
|
197
|
+
elsif qh[:querytype]=="space" || qh[:querytype]== "time" then
|
|
198
|
+
sptm_qstr_conditions.push(qh[:cond])
|
|
199
|
+
elsif qh[:querytype]=="path" || qh[:querytype]== "nodetype" then
|
|
200
|
+
node_qstr_conditions.push(qh[:cond])
|
|
201
|
+
end
|
|
202
|
+
}
|
|
203
|
+
#�m�[�h�^�C�v���摜�ł�����̂������Ώۂ���O��
|
|
204
|
+
node_qstr_conditions.push("n.node_type!=2")
|
|
205
|
+
|
|
206
|
+
#�A�N�Z�X���̋L�q��������
|
|
207
|
+
access_conditions = Node.conditions_to_read(user)
|
|
208
|
+
if access_conditions then
|
|
209
|
+
node_qstr_conditions.push(access_conditions)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
if node_qstr_conditions.size>0 then
|
|
213
|
+
node_qstr=<<-EOM
|
|
214
|
+
select r.descendant as nid, 'n' as qno, r.rel_depth as relevance
|
|
215
|
+
from nodes n join node_lineages r on n.id = r.descendant
|
|
216
|
+
where #{node_qstr_conditions.join(" and ")}
|
|
217
|
+
EOM
|
|
218
|
+
cnt=cnt+1
|
|
219
|
+
sptmky.push(node_qstr)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
#spatial_and_time_attributes�ɂ����錟���������\������
|
|
223
|
+
if sptm_qstr_conditions.size>0 then
|
|
224
|
+
sptm_qstr=<<-EOM
|
|
225
|
+
select r.descendant as nid, 's' as qno, r.rel_depth as relevance
|
|
226
|
+
from spatial_and_time_attributes s join node_lineages r on s.node_id = r.ancestor
|
|
227
|
+
where #{sptm_qstr_conditions.join(" and ")}
|
|
228
|
+
EOM
|
|
229
|
+
cnt=cnt+1
|
|
230
|
+
sptmky.push(sptm_qstr)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
#��̓�����킹�違nodes�ł̏����ipath�j�����킹��
|
|
235
|
+
allqstr =<<-EOM
|
|
236
|
+
select n.*, sum(score) as score
|
|
237
|
+
from
|
|
238
|
+
(select nid,qno,max(relevance) as score
|
|
239
|
+
from (#{sptmky.join(' union all ')}) ar
|
|
240
|
+
group by nid,qno) q join nodes n on q.nid = n.id
|
|
241
|
+
group by nid
|
|
242
|
+
having count(distinct qno)=#{cnt}
|
|
243
|
+
order by sum(score) desc;
|
|
244
|
+
EOM
|
|
245
|
+
return allqstr
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
def get_condition4kw(description)
|
|
249
|
+
description=~/\[(.*)\](.*)=(.*)/
|
|
250
|
+
qtype=$1
|
|
251
|
+
qname=$2
|
|
252
|
+
qvalue=$3
|
|
253
|
+
options={
|
|
254
|
+
:querytype=>"keyword",
|
|
255
|
+
:cond=>"name = '#{$2}' and value = '#{$3}'",
|
|
256
|
+
:description => description
|
|
257
|
+
}
|
|
258
|
+
return options
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def get_condition4fw(description)
|
|
262
|
+
description=~/\[(.*)\](.*)/
|
|
263
|
+
qtype=$1
|
|
264
|
+
qname=$2
|
|
265
|
+
options={
|
|
266
|
+
:querytype=>"freeword",
|
|
267
|
+
:cond=>"name like '%#{$2}%' or value like '%#{$2}%'",
|
|
268
|
+
:description => description
|
|
269
|
+
}
|
|
270
|
+
return options
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
def get_condition4time(description)
|
|
274
|
+
description =~/\[(.*)\](.*)~(.*)/
|
|
275
|
+
options={
|
|
276
|
+
:querytype=>"time",
|
|
277
|
+
:cond=>"starttime <= '#{$3}' or endtime >= '#{$2}'",
|
|
278
|
+
:description => description
|
|
279
|
+
}
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def get_condition4path(description)
|
|
283
|
+
description=~/\[(.*)\](.*)/
|
|
284
|
+
qtype=$1
|
|
285
|
+
qname=$2
|
|
286
|
+
options={
|
|
287
|
+
:querytype => "path",
|
|
288
|
+
:cond => "n.path = '#{qname}'",
|
|
289
|
+
:description => description
|
|
290
|
+
}
|
|
291
|
+
return options
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def get_condition4nodetype(description)
|
|
295
|
+
description=~/\[(.*)\](.*)/
|
|
296
|
+
qtype=$1
|
|
297
|
+
str=$2
|
|
298
|
+
str.gsub!("data","directory,variable")
|
|
299
|
+
qnames=str.split(/,/)
|
|
300
|
+
|
|
301
|
+
nodetypes={"directory"=>0,
|
|
302
|
+
"variable"=>1,
|
|
303
|
+
"knowledge"=>3,
|
|
304
|
+
"function"=>4,
|
|
305
|
+
"draw_method"=>5}
|
|
306
|
+
|
|
307
|
+
conds=Array.new
|
|
308
|
+
qnames.each{ |qname|
|
|
309
|
+
conds.push("n.node_type = #{nodetypes[qname]}")
|
|
310
|
+
}
|
|
311
|
+
conds_str = conds.join(" or ")
|
|
312
|
+
|
|
313
|
+
options={
|
|
314
|
+
:querytype => "nodetype",
|
|
315
|
+
:cond => "(#{conds_str})",
|
|
316
|
+
:description => description
|
|
317
|
+
}
|
|
318
|
+
return options
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
def get_condition4space(description)
|
|
322
|
+
description=~/\[(.*)\]\((.*),(.*)\)-\((.*),(.*)\)/
|
|
323
|
+
|
|
324
|
+
start_lon = ( $2 != "" ? $2 : "0" )
|
|
325
|
+
start_lat = ( $3 != "" ? $3 : "-90" )
|
|
326
|
+
end_lon = ( $4 != "" ? $4 : "360" )
|
|
327
|
+
end_lat = ( $5 != "" ? $5 : "90" )
|
|
328
|
+
|
|
329
|
+
@dateline=0 # dummy (horinout 2008/07/28): Kept for a while to avoid to be nil, but should be removed in fufure
|
|
330
|
+
|
|
331
|
+
if start_lon.to_f > end_lon.to_f then
|
|
332
|
+
qcond=<<-EOM
|
|
333
|
+
( longitude_lb >= #{start_lon} or longitude_rt <= #{end_lon} )
|
|
334
|
+
and latitude_lb <= #{end_lat} and latitude_rt >= #{start_lat}
|
|
335
|
+
and not(node_id IS NULL)
|
|
336
|
+
EOM
|
|
337
|
+
else
|
|
338
|
+
qcond=<<-EOM
|
|
339
|
+
longitude_lb <= #{end_lon} and longitude_rt >= #{start_lon}
|
|
340
|
+
and latitude_lb <= #{end_lat} and latitude_rt >= #{start_lat}
|
|
341
|
+
and not(node_id IS NULL)
|
|
342
|
+
EOM
|
|
343
|
+
end
|
|
344
|
+
options={
|
|
345
|
+
:querytype=>"space",
|
|
346
|
+
:cond=>qcond,
|
|
347
|
+
:description => description
|
|
348
|
+
}
|
|
349
|
+
options[:spregion]=[start_lon,start_lat,end_lon,end_lat]
|
|
350
|
+
|
|
351
|
+
return options
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
end
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
require "activerecord_gfdnavi"
|
|
2
|
+
|
|
3
|
+
class ExplorerResult
|
|
4
|
+
attr_accessor :id, :keynames, :qsetid, :resulttree, :resultids, :nodes
|
|
5
|
+
def initialize(qsetid)
|
|
6
|
+
@keynames = Array.new
|
|
7
|
+
@resulttree=PathNode.new
|
|
8
|
+
@resulttree.path="/"
|
|
9
|
+
@resultids = Array.new
|
|
10
|
+
@nodes=Array.new
|
|
11
|
+
@qsetid=qsetid
|
|
12
|
+
end
|
|
13
|
+
def reset_resulttree
|
|
14
|
+
@resulttree=PathNode.new
|
|
15
|
+
@resulttree.path="/"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def put_results(nodes)
|
|
19
|
+
@resultids.clear
|
|
20
|
+
@nodes.clear
|
|
21
|
+
@nodes = nodes
|
|
22
|
+
@nodes.each{ |res|
|
|
23
|
+
@resultids.push(res.id)
|
|
24
|
+
}
|
|
25
|
+
@resultids.uniq!
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def resultlist(p)
|
|
29
|
+
reset_resulttree
|
|
30
|
+
dir=Array.new
|
|
31
|
+
res=Array.new
|
|
32
|
+
@nodes.each{ |n|
|
|
33
|
+
if n.node_type==0 then
|
|
34
|
+
dir.push n
|
|
35
|
+
else
|
|
36
|
+
res.push n
|
|
37
|
+
end
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
res.each{ |r|
|
|
41
|
+
flg=0
|
|
42
|
+
dir.each{ |d|
|
|
43
|
+
if r.path=~/#{d.path}/ then
|
|
44
|
+
flg=1
|
|
45
|
+
break
|
|
46
|
+
end
|
|
47
|
+
}
|
|
48
|
+
if flg==0 then
|
|
49
|
+
@resulttree.addpath(r)
|
|
50
|
+
end
|
|
51
|
+
}
|
|
52
|
+
return res
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def count
|
|
56
|
+
return @resultids.size
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def all_covered(slat,slon,elat,elon)
|
|
60
|
+
tablename="nodes"
|
|
61
|
+
|
|
62
|
+
if @qsetid!=0 then
|
|
63
|
+
nodelist = "(select distinct ancestor as id from node_lineages where descendant in (#{@resultids.join(',')})) n"
|
|
64
|
+
if @resultids.length ==0 then
|
|
65
|
+
return []
|
|
66
|
+
end
|
|
67
|
+
else
|
|
68
|
+
nodelist = "nodes n"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
qstr=<<-EOM
|
|
72
|
+
select latitude_lb,longitude_lb, latitude_rt, longitude_rt,
|
|
73
|
+
count(*) as cnt
|
|
74
|
+
from spatial_and_time_attributes s join #{nodelist} on n.id = s.node_id
|
|
75
|
+
where s.latitude_lb<#{slat} and s.latitude_rt>#{elat}
|
|
76
|
+
and s.longitude_lb<#{slon} and s.longitude_rt>#{elon}
|
|
77
|
+
group by s.latitude_lb,s.longitude_lb, s.latitude_rt, s.longitude_rt
|
|
78
|
+
EOM
|
|
79
|
+
return Node.find_by_sql(qstr)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def partial_covered(slat,slon,elat,elon)
|
|
83
|
+
if @qsetid!=0 then
|
|
84
|
+
nodelist = "(select distinct ancestor as id from node_lineages where descendant in (#{@resultids.join(',')})) n"
|
|
85
|
+
if @resultids.length ==0 then
|
|
86
|
+
return []
|
|
87
|
+
end
|
|
88
|
+
else
|
|
89
|
+
nodelist = "nodes n"
|
|
90
|
+
end
|
|
91
|
+
qstr=<<-EOM
|
|
92
|
+
select latitude_lb,longitude_lb, latitude_rt, longitude_rt,
|
|
93
|
+
count(*) as cnt
|
|
94
|
+
from spatial_and_time_attributes s join #{nodelist} on n.id = s.node_id
|
|
95
|
+
where not (latitude_lb<#{slat} and latitude_rt>#{elat}
|
|
96
|
+
and longitude_lb<#{slon} and longitude_rt>#{elon})
|
|
97
|
+
and latitude_lb<>latitude_rt
|
|
98
|
+
and longitude_lb<>longitude_rt
|
|
99
|
+
group by latitude_lb,longitude_lb, latitude_rt, longitude_rt
|
|
100
|
+
EOM
|
|
101
|
+
return Node.find_by_sql(qstr)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def points(slat,slon,elat,elon)
|
|
105
|
+
if @qsetid!=0 then
|
|
106
|
+
nodelist = "(select distinct ancestor as id from node_lineages where descendant in (#{@resultids.join(',')})) n"
|
|
107
|
+
if @resultids.length ==0 then
|
|
108
|
+
return []
|
|
109
|
+
end
|
|
110
|
+
else
|
|
111
|
+
nodelist = "nodes n"
|
|
112
|
+
end
|
|
113
|
+
qstr=<<-EOM
|
|
114
|
+
select latitude_lb,longitude_lb, latitude_rt, longitude_rt,
|
|
115
|
+
count(*) as cnt
|
|
116
|
+
from spatial_and_time_attributes s join #{nodelist} on n.id = s.node_id
|
|
117
|
+
where latitude_lb=latitude_rt
|
|
118
|
+
and longitude_lb=longitude_rt
|
|
119
|
+
group by latitude_lb,longitude_lb
|
|
120
|
+
EOM
|
|
121
|
+
return Node.find_by_sql(qstr)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def get_keyname_list
|
|
125
|
+
if @qsetid!=0 then
|
|
126
|
+
nodelist = "(select distinct ancestor as id from node_lineages where descendant in (#{@resultids.join(',')})) n"
|
|
127
|
+
if @resultids.length ==0 then
|
|
128
|
+
return []
|
|
129
|
+
end
|
|
130
|
+
else
|
|
131
|
+
nodelist = "nodes n"
|
|
132
|
+
end
|
|
133
|
+
igr_attrs=""
|
|
134
|
+
i=0
|
|
135
|
+
GFDNAVI_IGNORED_ATTRS.each{ |iga|
|
|
136
|
+
if i==0 then
|
|
137
|
+
igr_attrs="'#{iga}'"
|
|
138
|
+
else
|
|
139
|
+
igr_attrs="#{igr_attrs},'#{iga}'"
|
|
140
|
+
end
|
|
141
|
+
i=i+1
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
GFDNAVI_INVISIBLE_ATTRS.each{ |iva|
|
|
145
|
+
if i==0 then
|
|
146
|
+
igr_attrs="'#{iva}'"
|
|
147
|
+
else
|
|
148
|
+
igr_attrs="#{igr_attrs}, '#{iva}'"
|
|
149
|
+
end
|
|
150
|
+
i=i+1
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if GFDNAVI_IGNORED_ATTRS.size>0 then
|
|
154
|
+
qstr=<<-EOF
|
|
155
|
+
select k.name as kname,count(distinct n.id) as cnt
|
|
156
|
+
from keyword_attributes k join #{nodelist} on k.node_id = n.id
|
|
157
|
+
where not (k.name in (#{igr_attrs}))
|
|
158
|
+
group by k.name
|
|
159
|
+
order by cnt DESC
|
|
160
|
+
EOF
|
|
161
|
+
else
|
|
162
|
+
qstr=<<-EOF
|
|
163
|
+
select k.name as kname,count(distinct n.id) as cnt
|
|
164
|
+
from keyword_attributes k join #{nodelist} on k.node_id = n.id
|
|
165
|
+
group by k.name
|
|
166
|
+
order by cnt DESC
|
|
167
|
+
EOF
|
|
168
|
+
end
|
|
169
|
+
keylist=KeywordAttribute.find_by_sql(qstr)
|
|
170
|
+
return keylist
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def get_keyname_and_keyvalue_list
|
|
174
|
+
if @qsetid!=0 then
|
|
175
|
+
nodelist = "(select distinct ancestor as id from node_lineages where descendant in (#{@resultids.join(',')})) n"
|
|
176
|
+
if @resultids.length ==0 then
|
|
177
|
+
return []
|
|
178
|
+
end
|
|
179
|
+
else
|
|
180
|
+
nodelist = "nodes n"
|
|
181
|
+
end
|
|
182
|
+
igr_attrs=""
|
|
183
|
+
i=0
|
|
184
|
+
GFDNAVI_IGNORED_ATTRS.each{ |iga|
|
|
185
|
+
if i==0 then
|
|
186
|
+
igr_attrs="'#{iga}'"
|
|
187
|
+
else
|
|
188
|
+
igr_attrs="#{igr_attrs},'#{iga}'"
|
|
189
|
+
end
|
|
190
|
+
i=i+1
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
GFDNAVI_INVISIBLE_ATTRS.each{ |iva|
|
|
194
|
+
if i==0 then
|
|
195
|
+
igr_attrs="#{iga}'"
|
|
196
|
+
else
|
|
197
|
+
igr_attrs="#{igr_attrs}, '#{iva}'"
|
|
198
|
+
end
|
|
199
|
+
i=i+1
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if GFDNAVI_IGNORED_ATTRS.size>0 then
|
|
203
|
+
qstr=<<-EOF
|
|
204
|
+
select k.name as kname,k.value as kvalue, count(distinct n.id) as cnt
|
|
205
|
+
from keyword_attributes k join #{nodelist} on k.node_id = n.id
|
|
206
|
+
where not (k.name in (#{igr_attrs})) and k.value IS NOT NULL
|
|
207
|
+
group by k.name,k.value
|
|
208
|
+
order by k.name,k.value,cnt DESC
|
|
209
|
+
EOF
|
|
210
|
+
else
|
|
211
|
+
qstr=<<-EOF
|
|
212
|
+
select k.name as kname,k.value as kvalue, count(distinct n.id) as cnt
|
|
213
|
+
from keyword_attributes k join #{nodelist} on k.node_id = n.id
|
|
214
|
+
where k.value IS NOT NULL
|
|
215
|
+
group by k.name,k.value
|
|
216
|
+
order by k.name,k.value,cnt DESC
|
|
217
|
+
EOF
|
|
218
|
+
end
|
|
219
|
+
keylist=KeywordAttribute.find_by_sql(qstr)
|
|
220
|
+
return keylist
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def get_path
|
|
225
|
+
if @qsetid>0 then
|
|
226
|
+
res=QueryHistory.find(:all,:conditions=>["queryset_id=? and querytype='path'",@qsetid])
|
|
227
|
+
if res.size>0 then
|
|
228
|
+
res[0].description=~/[P](.*)/
|
|
229
|
+
return $1
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
return "/"
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def get_path_list
|
|
236
|
+
if @qsetid>0 then
|
|
237
|
+
QueryHistory.find(:all,:conditions=>["queryset_id=? and querytype='path'",@qsetid])
|
|
238
|
+
tables="(select v.* from nodes v, gfdnavi_querycache.queryset_#{@qsetid} c where v.id=c.vid)"
|
|
239
|
+
path=get_path
|
|
240
|
+
else
|
|
241
|
+
tables="nodes"
|
|
242
|
+
path="/"
|
|
243
|
+
end
|
|
244
|
+
sql1=<<-EOM
|
|
245
|
+
select d2.path as dpath, count(distinct v.id) as cnt
|
|
246
|
+
from nodes d1,nodes d2,#{tables} v
|
|
247
|
+
where d1.path = ?
|
|
248
|
+
and d2.parent_id = d1.id
|
|
249
|
+
and v.path like #{concat("d2.path","'%'")}
|
|
250
|
+
group by d2.path
|
|
251
|
+
order by cnt DESC
|
|
252
|
+
EOM
|
|
253
|
+
pathlist = Node.find_by_sql([sql1,path])
|
|
254
|
+
return pathlist
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def get_keyvalue_list(keyname)
|
|
258
|
+
if @qsetid!=0 then
|
|
259
|
+
nodelist = "(select distinct ancestor as id from node_lineages where descendant in (#{@resultids.join(',')})) n"
|
|
260
|
+
else
|
|
261
|
+
nodelist = "nodes n"
|
|
262
|
+
end
|
|
263
|
+
qstr=<<-EOF
|
|
264
|
+
select k.value as value, k.num_value as num_value, count(distinct n.id) as cnt
|
|
265
|
+
from #{nodelist} join keyword_attributes k on k.node_id=n.id
|
|
266
|
+
where k.name='#{keyname}'
|
|
267
|
+
group by k.value
|
|
268
|
+
order by cnt DESC
|
|
269
|
+
EOF
|
|
270
|
+
keylist=KeywordAttribute.find_by_sql(qstr)
|
|
271
|
+
return keylist
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def get_querysetids(session_id)
|
|
275
|
+
res=Array.new
|
|
276
|
+
qhistories=QueryHistory.find_by_sql(["select distinct queryset_id from query_histories where session_id=? order by queryset_id;",session_id])
|
|
277
|
+
qhistories.each{ |qh|
|
|
278
|
+
res.push qh.queryset_id
|
|
279
|
+
}
|
|
280
|
+
return res
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
=begin
|
|
284
|
+
def get_result_path_tree
|
|
285
|
+
if id!= 0 then
|
|
286
|
+
reslist=Node.find(:all,:select=>"path, count(*) as cnt",:joins=>"JOIN gfdnavi_querycache.cache_#{@id} ON gfdnavi_querycache.cache_#{@id}.vid=id", :group=>"path", :order=>"path")
|
|
287
|
+
else
|
|
288
|
+
reslist=Node.find(:all,:select=>"path, count(*) as cnt",:group=>"path",:order=>"path")
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
rid=0
|
|
292
|
+
resultpath=PathNode.new
|
|
293
|
+
reslist.each{ |res|
|
|
294
|
+
if resultpath.path=="" then
|
|
295
|
+
resultpath.path=res.path
|
|
296
|
+
resultpath.id=rid
|
|
297
|
+
resultpath.cnt=1
|
|
298
|
+
rid=rid+1
|
|
299
|
+
else
|
|
300
|
+
patharray_res=res.path.split(/\//)
|
|
301
|
+
patharray_node=resultpath.path.split(/\//)
|
|
302
|
+
i=0
|
|
303
|
+
while patharray_res[i]==patharray_node[i] do
|
|
304
|
+
i=i+1
|
|
305
|
+
end
|
|
306
|
+
if patharray_
|
|
307
|
+
end
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
end
|
|
311
|
+
=end
|
|
312
|
+
end
|