amalgame/commit
renaming: improve names of urls and predicates, get rid of the old eq_* name convention
author | Jacco van Ossenbruggen |
---|---|
Wed Jul 16 12:58:38 2014 +0200 | |
committer | Jacco van Ossenbruggen |
Wed Jul 16 12:58:38 2014 +0200 | |
commit | aa590b49641cfd736739bc1004a80161394f066b |
tree | ba69b2601990141c780310b14056d14cad090887 |
parent | 91b41f1ceb20fd185cb3ed851cd5e648ce25c7a0 |
Diff style: patch stat
diff --git a/api/hints.pl b/api/hints.pl index 882ba13..53a54fb 100644 --- a/api/hints.pl +++ b/api/hints.pl @@ -206,7 +206,7 @@ find_hint(Strategy, Context, Hint) :- N > 0, N < 51, !, format(atom(Text), 'Evaluate: this dataset only contains ~w non-ambigious mappings, that is good! It has not yet been evaluated, however. Manual inspection could help you decide if the quality is sufficient.', [N]), - http_link_to_id(http_eq_evaluate, [alignment(Strategy), focus(Focus)],EvalPage), + http_link_to_id(http_ag_evaluate, [alignment(Strategy), focus(Focus)],EvalPage), Hint = json([ event(evaluate), data(json([ @@ -244,7 +244,7 @@ find_hint(Strategy, Context, Hint) :- find_hint(Strategy, Context, Hint) :- option(focus(Focus), Context), is_known_to_be_disambiguous(Strategy, Focus, Mapping), - http_link_to_id(http_eq_evaluate, [alignment(Strategy), focus(Mapping)],EvalPage), + http_link_to_id(http_ag_evaluate, [alignment(Strategy), focus(Mapping)],EvalPage), format(atom(Text), 'Evaluate: ~p contains ambiguous mappings. Maybe you can select the good ones after looking at what is causing the problem.', [Mapping]), Hint = json([ event(evaluate), diff --git a/api/mapping.pl b/api/mapping.pl index b173197..1a40b7a 100644 --- a/api/mapping.pl +++ b/api/mapping.pl @@ -1,4 +1,4 @@ -:- module(eq_mapping, +:- module(ag_mapping, [ ]). @@ -342,8 +342,8 @@ html_evidences([E|Es],Source,Target) --> html_evidence_graph([],_,_) --> !. html_evidence_graph(Graph,Node,Layout) --> graphviz_graph(evidence_graph(Graph,Node), - [shape_hook(eq_mapping:evidence_shape), - label_hook(eq_mapping:evidence_label), + [shape_hook(ag_mapping:evidence_shape), + label_hook(ag_mapping:evidence_label), graph_attributes([rankdir(Layout)])]). diff --git a/api/mappinglist.pl b/api/mappinglist.pl index 5c9e919..fa871af 100644 --- a/api/mappinglist.pl +++ b/api/mappinglist.pl @@ -1,4 +1,4 @@ -:- module(eq_voc_api, +:- module(ag_voc_api, [ ]). diff --git a/api/node_info.pl b/api/node_info.pl index 7361674..b6ef9c1 100644 --- a/api/node_info.pl +++ b/api/node_info.pl @@ -10,7 +10,6 @@ :- use_module(library(semweb/rdfs)). :- use_module(library(amalgame/amalgame_modules)). :- use_module(library(amalgame/ag_stats)). -:- use_module(library(amalgame/ag_provenance)). :- use_module(library(amalgame/voc_stats)). :- use_module(library(amalgame/caching)). :- use_module(library(amalgame/util)). @@ -29,7 +28,7 @@ :- rdf_meta label_stats(r, r, r, -). -%% http_eq_info(+Request) +%% http_node_info(+Request) % % Emit HTML snippet with information about an amalgame URI diff --git a/applications/analyser.pl b/applications/analyser.pl index 6f53072..c9a7926 100644 --- a/applications/analyser.pl +++ b/applications/analyser.pl @@ -1,4 +1,4 @@ -:- module(eq_analyser, +:- module(ag_analyser, []). :- use_module(library(semweb/rdf_db)). :- use_module(library(http/http_dispatch)). @@ -16,18 +16,18 @@ ag:menu_item/2. % temp commented out -% ag:menu_item(240=http_eq_analyse, 'analyse'). +% ag:menu_item(240=http_ag_analyse, 'analyse'). % http handlers for this applications -:- http_handler(amalgame(analyse), http_eq_analyse, []). +:- http_handler(amalgame(analyse), http_ag_analyse, []). :- http_handler(amalgame(analyse/agreement), http_agreement, []). -%% http_equalizer(+Request) +%% http_ag_analyse(+Request) is det % % Emit html page with for the alignment analyser. -http_eq_analyse(Request) :- +http_ag_analyse(Request) :- http_parameters(Request, [ alignment(Alignment, [uri, optional(true), @@ -51,7 +51,7 @@ html_page(Alignment, Mapping) :- ]), \html_requires(css('eq.css')), \html_requires(css('analyser.css')), - \html_eq_header([active(http_eq_analyse), + \html_ag_header([active(http_ag_analyse), strategy(Alignment), focus(Mapping) ]), diff --git a/applications/builder.pl b/applications/builder.pl index 8fee178..af6795c 100644 --- a/applications/builder.pl +++ b/applications/builder.pl @@ -1,4 +1,4 @@ -:- module(eq_builder, []). +:- module(ag_builder, []). :- use_module(library(semweb/rdf_db)). :- use_module(library(semweb/rdfs)). @@ -24,9 +24,9 @@ ag:menu_item/2. % http handlers for this applications -:- http_handler(amalgame(build), http_eq_build, []). +:- http_handler(amalgame(build), http_ag_build, []). -ag:menu_item(200=http_eq_build, 'build'). +ag:menu_item(200=http_ag_build, 'build'). backward_compatibilty_fixes(Strategy) :- @@ -48,12 +48,12 @@ precalc_voc_stats(Strategy) :- ). -%% http_eq_build(+Request) +%% http_ag_build(+Request) % % HTTP handler for web page with interactive vocabulary alignment % builder. -http_eq_build(Request) :- +http_ag_build(Request) :- % authorized(write(default, _)), http_parameters(Request, [ alignment(Alignment, @@ -91,8 +91,8 @@ html_page(Strategy, Focus) :- 'cssfonts/fonts-min.css' ]), div(class('yui3-skin-sam yui-skin-sam'), - [ \html_eq_header([ - active(http_eq_build), + [ \html_ag_header([ + active(http_ag_build), strategy(Strategy), focus(Focus)]), div([class('yui3-g'), id(layout)], @@ -194,8 +194,8 @@ js_path(info, Path) :- http_location_by_id(http_node_info, Path). js_path(hint, Path) :- http_location_by_id(http_json_hint, Path). -js_path(eq_evaluate, Path) :- - http_location_by_id(http_eq_evaluate , Path). +js_path(ag_evaluate, Path) :- + http_location_by_id(http_ag_evaluate , Path). js_path(mapping, Path) :- http_location_by_id(http_data_mapping, Path). js_path(evaluate, Path) :- diff --git a/applications/evaluater.pl b/applications/evaluater.pl index 469bc57..d3df8f0 100644 --- a/applications/evaluater.pl +++ b/applications/evaluater.pl @@ -1,4 +1,4 @@ -:- module(eq_evaluater, +:- module(ag_evaluater, []). :- use_module(library(semweb/rdfs)). @@ -22,17 +22,17 @@ amalgame_module(amalgame:'EvaluationProcess'). :- multifile ag:menu_item/2. -ag:menu_item(210=http_eq_evaluate, 'evaluate'). +ag:menu_item(210=http_ag_evaluate, 'evaluate'). % http handlers for this applications -:- http_handler(amalgame(evaluate), http_eq_evaluate, []). +:- http_handler(amalgame(evaluate), http_ag_evaluate, []). -%% http_eq_evaluate(+Request) +%% http_ag_evaluate(+Request) % % Emit html page with for the alignment analyser. -http_eq_evaluate(Request) :- +http_ag_evaluate(Request) :- authorized(write(default, _)), http_parameters(Request, [ alignment(Alignment, @@ -61,7 +61,7 @@ html_page(Alignment, Mapping) :- 'cssgrids/grids-min.css', 'cssfonts/fonts-min.css' ]), - \html_eq_header([active(http_eq_evaluate), + \html_ag_header([active(http_ag_evaluate), strategy(Alignment), focus(Mapping) ]), diff --git a/applications/publisher.pl b/applications/publisher.pl index 7ed7c02..4143363 100644 --- a/applications/publisher.pl +++ b/applications/publisher.pl @@ -87,7 +87,7 @@ html_page(Alignment, Focus) :- [ \html_requires(css('eq.css')), div(class('yui3-skin-sam yui-skin-sam'), - [ \html_eq_header( + [ \html_ag_header( [active(http_ag_publish_form), focus(Focus), strategy(Alignment)]), diff --git a/applications/selecter.pl b/applications/selecter.pl index 50b239a..ce4ef14 100644 --- a/applications/selecter.pl +++ b/applications/selecter.pl @@ -1,4 +1,4 @@ -:- module(eq_selecter, +:- module(ag_main_page, [html_schemes_only//0 % for backward compat with europeana demo ]). @@ -22,29 +22,36 @@ :- use_module(applications(skos_browser)). -% http handlers for this applications -:- http_handler(amalgame(eq), http_eq, []). -:- http_handler(amalgame(new), http_eq_new, []). -:- http_handler(amalgame(select), http_eq_select, []). -:- http_handler(amalgame(load/url), http_eq_upload_url, []). -:- http_handler(amalgame(load/data), http_eq_upload_data, []). -:- http_handler(amalgame(load/reference), http_eq_ref_file_upload, []). +% main http handler for amalgame: +:- http_handler(amalgame(.), http_amalgame_main_page, []). -%% http_eq(+Request) +% handlers for the different forms on the main page. +% most handle the form request and then redirect to some other page, +% such as the strategy builder or the main page: +:- http_handler(amalgame(form/new), http_ag_form_new_strategy, []). +:- http_handler(amalgame(form/select), http_ag_form_select_strategy, []). +:- http_handler(amalgame(form/url), http_ag_form_upload_strategy_resource, []). +:- http_handler(amalgame(form/data), http_ag_form_upload_strategy_data, []). +:- http_handler(amalgame(form/reference), http_ag_form_upload_alignment, []). + +% Backward compatibility +:- http_handler(amalgame(eq), http_redirect(moved, amalgame(.)), []). + +%% http_amalgame_main_page(+Request) is det. % % Emit html page to start a new or select/upload an existing % alignment strategy. -http_eq(_Request) :- - html_page. +http_amalgame_main_page(Request) :- + html_main_page(Request). -%% http_eq_select(+Request) +%% http_ag_form_select_strategy(+Request) % % Execute action on selected strategy and redirect to % appropriate page. -http_eq_select(Request) :- +http_ag_form_select_strategy(Request) :- http_parameters(Request, [ alignment(Strategies, @@ -66,11 +73,11 @@ http_eq_select(Request) :- -> delete_redirect(Request, Strategies) ). -%% http_eq_new(+Request) +%% http_ag_form_new_strategy(+Request) % -% Handler to create a new alignment +% Handle form data to create a new alignment -http_eq_new(Request) :- +http_ag_form_new_strategy(Request) :- http_parameters(Request, [ scheme(Schemes, [zero_or_more, @@ -81,11 +88,11 @@ http_eq_new(Request) :- -%% http_eq_upload_data(+Request) +%% http_ag_form_upload_strategy_data(+Request) is det. % -% Handler for strategy data import +% Handler for strategy form data import. -http_eq_upload_data(Request) :- +http_ag_form_upload_strategy_data(Request) :- authorized(write(default, _)), http_parameters(Request, [ data(Data, @@ -101,7 +108,23 @@ http_eq_upload_data(Request) :- )), cp_strategy_from_tmp(Request, TmpGraph). -http_eq_ref_file_upload(Request) :- +%% http_ag_form_upload_strategy_resource(+Request) is det. +% +% Handler for strategy form resource import. + +http_ag_form_upload_strategy_resource(Request) :- + authorized(write(default, _)), + http_parameters(Request, + [ url(URL, []) + ]), + rdf_bnode(TmpGraph), + rdf_load(URL, [graph(TmpGraph)]), + cp_strategy_from_tmp(Request, TmpGraph). + +%% http_ag_form_upload_alignment(+Request) is det. +% +% Handle form to upload an existing alignment +http_ag_form_upload_alignment(Request) :- authorized(write(default, _)), http_parameters(Request, [ data(Data, @@ -122,18 +145,6 @@ http_eq_ref_file_upload(Request) :- http_redirect(moved, ListGraph, Request). - - -http_eq_upload_url(Request) :- - authorized(write(default, _)), - http_parameters(Request, - [ url(URL, []) - ]), - rdf_bnode(TmpGraph), - rdf_load(URL, [graph(TmpGraph)]), - cp_strategy_from_tmp(Request, TmpGraph). - - find_schemes(Schemes) :- findall(C, ( is_vocabulary(C), @@ -148,7 +159,7 @@ scheme_label(URI, Key-URI) :- graph_label(URI, CasedKey), downcase_atom(CasedKey, Key). -html_page :- +html_main_page(_Request) :- findall(A-S, amalgame_alignment(A, S), Alignments), find_schemes(ConceptSchemes), reply_html_page(cliopatria(main), @@ -201,7 +212,7 @@ html_new(Schemes) --> }, html_acc_item(new, 'new alignment strategy', - [ form(action(location_by_id(http_eq_new)), + [ form(action(location_by_id(http_ag_form_new_strategy)), [ ButtonsTop, \html_vocab_table(Schemes), ButtonsBottom @@ -212,7 +223,7 @@ html_new(Schemes) --> html_new(_) --> { - http_location_by_id(http_eq, This), + http_location_by_id(http_amalgame_main_page, This), http_link_to_id(cliopatria_openid:login_page, ['openid.return_to'(This)], Login) }, @@ -291,11 +302,11 @@ html_open(Alignments) --> }, html_acc_item(open, 'edit/delete pre-loaded alignment strategy', - [ form(action(location_by_id(http_eq_select)), + [ form(action(location_by_id(http_ag_form_select_strategy)), [ ButtonsTop, \html_strategy_table(Alignments, - [linkto(http_eq_build)]), + [linkto(http_ag_build)]), ButtonsBottom ]) @@ -375,7 +386,7 @@ html_scheme_labels([S|Ss]) --> html_strategy_name(Graph, Options) --> { graph_label(Graph, Label), - option(linkto(LinkTo), Options, http_eq_build), + option(linkto(LinkTo), Options, http_ag_build), http_link_to_id(LinkTo, [alignment(Graph)], Link) }, html(a([href(Link)],Label)). @@ -397,7 +408,7 @@ html_reference --> }, html_acc_item(reference, 'upload existing/reference alignment', - form([action(location_by_id(http_eq_ref_file_upload)), + form([action(location_by_id(http_ag_form_upload_alignment)), method('POST'), enctype('multipart/form-data') ], [ p(['Upload an exisiting alignment to build upon, ', @@ -419,14 +430,16 @@ html_import --> }, html_acc_item(import, 'upload strategy or clone execution trace', - [ form(action(location_by_id(http_eq_upload_url)), + [ form([action(location_by_id(http_ag_form_upload_strategy_resource)), + method('POST') + ], [ 'URL: ', input([type(text), name(url), value('http://'), autocomplete(off), size(50) ]), input([type(submit), value('Upload')]) ]), - form([action(location_by_id(http_eq_upload_data)), + form([action(location_by_id(http_ag_form_upload_strategy_data)), method('POST'), enctype('multipart/form-data') ], @@ -552,7 +565,7 @@ cp_strategy_from_tmp(Request, TmpGraph) :- build_redirect(Request, [Strategy]). build_redirect(Request, [Strategy|_]) :- - http_link_to_id(http_eq_build, [alignment(Strategy)], Redirect), + http_link_to_id(http_ag_build, [alignment(Strategy)], Redirect), http_redirect(moved, Redirect, Request). delete_redirect(Request, Strategies) :- @@ -565,7 +578,7 @@ delete_redirect(Request, Strategies) :- rdf_unload_graph(Strategy) ) ), - http_link_to_id(http_eq, [], Redirect), + http_link_to_id(http_amalgame_main_page, [], Redirect), http_redirect(moved, Redirect, Request). merge_redirect(Request, Strategies) :- @@ -582,7 +595,7 @@ merge_redirect(Request, Strategies) :- merge_strategy_nodes(Strategies, New), % Redirect to builder - http_link_to_id(http_eq_build, [alignment(New)], Redirect), + http_link_to_id(http_ag_build, [alignment(New)], Redirect), http_redirect(moved, Redirect, Request). merge_strategy_nodes([], _New) :- !. diff --git a/config-available/ag_menu.pl b/config-available/ag_menu.pl index 6755e67..9dce404 100644 --- a/config-available/ag_menu.pl +++ b/config-available/ag_menu.pl @@ -13,5 +13,5 @@ This module is a ClioPatria plugin that extends the ClioPatria menu. % Provide the Amalgame extensions to the Cliopatria menu. cliopatria:menu_popup_order(amalgame, 120). -cliopatria:menu_item(100=amalgame/http_eq, 'Alignment interface'). +cliopatria:menu_item(100=amalgame/http_amalgame_main_page, 'Alignment interface'). cliopatria:menu_item(250=amalgame/http_skos_browser, 'Vocabulary browser'). diff --git a/config-available/ag_skin.pl b/config-available/ag_skin.pl index 01a206e..4782320 100644 --- a/config-available/ag_skin.pl +++ b/config-available/ag_skin.pl @@ -66,7 +66,7 @@ cliopatria:predicate_order(P, 405) :- user:body(amalgame(search), Body) --> { - http_link_to_id(http_eq, [], BackOfficeLink) + http_link_to_id(http_amalgame_main_page, [], BackOfficeLink) }, html_requires(cliopatria), html(body(class(['yui-skin-sam', ag_search, cliopatria]), diff --git a/lib/amalgame/ag_controls.pl b/lib/amalgame/ag_controls.pl index f3e3c65..ede96a9 100644 --- a/lib/amalgame/ag_controls.pl +++ b/lib/amalgame/ag_controls.pl @@ -3,7 +3,7 @@ html_parameter_form//1, module_input_type/2, module_special_type/2, - status_option/1, % Move to eq_util? + status_option/1, % Move to amalgame(util)? html_options//2 % idem ]). diff --git a/lib/amalgame/util.pl b/lib/amalgame/util.pl index 3c69d6b..7655e2f 100644 --- a/lib/amalgame/util.pl +++ b/lib/amalgame/util.pl @@ -1,6 +1,6 @@ :- module(ag_util_components, [ - html_eq_header//1, + html_ag_header//1, html_showlist//1, mint_node_uri/3, @@ -74,11 +74,11 @@ has_write_permission :- logged_on(User, anonymous), catch(check_permission(User, write(default,_)), _, fail). -%% html_eq_header(+Active, +Alignment) +%% html_ag_header(+Active, +Alignment) % % Emit page header with menu bar -html_eq_header(Options) --> +html_ag_header(Options) --> { findall(Rank-(Path-Label), ag:menu_item(Rank=Path, Label), Items0), keysort(Items0, ItemsSorted), @@ -86,14 +86,14 @@ html_eq_header(Options) --> }, html(div(id(header), [ div(class(title), - a(href(location_by_id(http_eq)), 'Amalgame')), - ul(\html_eq_menu(Items, Options)) + a(href(location_by_id(http_amalgame_main_page)), 'Amalgame')), + ul(\html_ag_menu(Items, Options)) ])). -html_eq_menu([], _) --> !. -html_eq_menu([Handler-Label|Is], Options) --> +html_ag_menu([], _) --> !. +html_ag_menu([Handler-Label|Is], Options) --> html_menu_item(Handler, Label, Options), - html_eq_menu(Is, Options). + html_ag_menu(Is, Options). html_menu_item(Handler, Label, Options) --> { option(active(Handler), Options) @@ -103,7 +103,7 @@ html_menu_item(Handler, Label, Options) --> html_menu_item(Handler, Label, Options) --> { option(strategy(Strategy), Options), option(focus(Focus), Options, Strategy), - http_link_to_id(http_eq_build, + http_link_to_id(http_ag_build, [alignment(Strategy)], ReturnToAfterLogin), http_link_to_id(Handler, [ 'openid.return_to'(ReturnToAfterLogin), diff --git a/web/js/builder.js b/web/js/builder.js index 45347d8..1b4c6ff 100644 --- a/web/js/builder.js +++ b/web/js/builder.js @@ -258,7 +258,7 @@ YUI.add('builder', function(Y) { _onEvaluate : function(e) { var focus = e.data.focus; if(focus) { - window.location = this.get("paths").eq_evaluate + window.location = this.get("paths").ag_evaluate +'?alignment='+encodeURIComponent(this.get("alignment")) +"&focus="+encodeURIComponent(focus); }