amalgame/commit
first steps for improved amalgame module registration
author | Michiel Hildebrand |
---|---|
Mon May 2 22:16:00 2011 +0200 | |
committer | Michiel Hildebrand |
Mon May 2 22:16:00 2011 +0200 | |
commit | 34e9cb6ddbfb1126ecc07096ee6182f53b3ce966 |
tree | 33f2a02da76b30137f1931fd67b74a3166fb6d68 |
parent | ea68d536c4239d035e167cad2e25a2b6876b5d6e |
Diff style: patch stat
diff --git a/applications/equalizer/controls.pl b/applications/equalizer/controls.pl index 860e643..5807aa7 100644 --- a/applications/equalizer/controls.pl +++ b/applications/equalizer/controls.pl @@ -8,26 +8,7 @@ :- use_module(library(amalgame/amalgame_modules)). -html_controls --> - { amalgame_class_modules(amalgame:'Matcher', Matchers), - amalgame_class_modules(amalgame:'Selecter', Selecters) - }, - - html(div([class('yui3-accordion')], - [ \html_accordion_item(infobox, 'Properties', - 'yui3-accordion-item-active info', []), - \html_accordion_item(match, 'Match', vocab, - [\html_align_select, - \html_tab_view(Matchers) - ]), - %\html_accordion_item(merge, 'Merge', vocab, []), - \html_accordion_item(filter, 'Filter', mapping, - \html_tab_view(Matchers)), - \html_accordion_item(select, 'Select', mapping, - \html_tab_view(Selecters)) - ]) - ). - +/* html_align_select --> html(table([tr([td(input([type(button), id(sourcebtn), value('set as source')])), td(input([type(text), id(source), name(source), size(40), autocomplete(off)])) @@ -36,55 +17,63 @@ html_align_select --> td(input([type(text), id(target), name(target), size(40), autocomplete(off)])) ]) ])). +*/ -%% html_accordion_item(+Id, +Label, +CSSClass, +Disabled, +Body) +html_controls --> + { findall(URI-M, current_amalgame_module(URI, M), Modules) + }, + html([div(id(infobox), []), + div([class('yui3-accordion')], + \html_modules(Modules)) + ]). + +%% html_modules(+Modules:uri-module) % -% Emit YUI3 node accordion html markup. +% Emit YUI3 node accordion items for each module. + +html_modules([]) --> !. +html_modules([URI-Module|Ms]) --> + html_module(URI, Module), + html_modules(Ms). -html_accordion_item(Id, Label, Class, Body) --> - html(div([id(Id), class('yui3-accordion-item '+Class)], +html_module(URI, Module) --> + { amalgame_module_parameters(Module, Params), + Class = 'mapping' + }, + html(div([id(Module), class('yui3-accordion-item '+Class)], [ div(class('yui3-accordion-item-hd'), a([href('javascript:void(0)'), class('yui3-accordion-item-trigger')], - Label)), + \module_label(URI))), div(class('yui3-accordion-item-bd'), - Body) - ])). - -%% html_tab_view(+Modules) -% -% Emit YUI3 tabview html markup. -% -html_tab_view(Modules) --> - html(div(class('yui3-tabview'), - [ ul(\html_tab_list(Modules)), - div(\html_tab_panel(Modules)) + [ div(class(desc), + \module_desc(URI)), + form(id(URI), + [ table(tbody(\html_parameter_form(Params))), + div(class('control-buttons'), + input([type(button), class('control-submit'), value('Go')])) + ]) + ]) ])). -html_tab_list([]) --> !. -html_tab_list([URI-Module|Ms]) --> - { module_label(URI, Label) +module_label(M) --> + { rdf_label(M, Lit), + !, + literal_text(Lit, Label) }, - html(li(a([href('#'+Module)], Label))), - html_tab_list(Ms). - -module_label(M, Label) :- - rdf_label(M, Lit), - !, - literal_text(Lit, Label). -module_label(M, Label) :- - rdf_global_id(_:Label, M). - -html_tab_panel([]) --> !. -html_tab_panel([URI-Module|Ms]) --> - { amalgame_module_parameters(Module, Params) + html(Label). +module_label(M) --> + { rdf_global_id(_:Label, M) + }, + html(Label). + +module_desc(M) --> + { rdf_has(M, skos:definition, Lit), + !, + literal_text(Lit, Txt) }, - html(form(id(URI), - [ table(tbody(\html_parameter_form(Params))), - div(class('control-buttons'), - input([type(button), class('control-submit'), value('Go')])) - ])), - html_tab_panel(Ms). + html(Txt). +module_desc(_) --> !. %% html_module_parameters(+ParameterList) % diff --git a/applications/equalizer/eq_builder.pl b/applications/equalizer/eq_builder.pl index b07b774..ccb9e34 100644 --- a/applications/equalizer/eq_builder.pl +++ b/applications/equalizer/eq_builder.pl @@ -111,7 +111,7 @@ js_path(updatelabel, Path) :- js_module(gallery, 'gallery-2011.02.23-19-01'). js_module(builder, json([fullpath(Path), - requires([node,event,anim,tabview, + requires([node,event,anim, 'json-parse', 'datasource-io','datasource-cache', 'querystring-stringify-simple', diff --git a/applications/equalizer/stats.pl b/applications/equalizer/stats.pl index 6f43072..8886e4b 100644 --- a/applications/equalizer/stats.pl +++ b/applications/equalizer/stats.pl @@ -72,8 +72,8 @@ html_cell_list([V|Vs]) --> amalgame_stats(URL, ['total mappings'-Total, 'mapped source concepts'-SN, - 'mapped target concepts'-TN, - 'browse' - a(href(HREF), URL) + 'mapped target concepts'-TN + %'browse' - a(href(HREF), URL) ]) :- rdfs_individual_of(URL, amalgame:'Mapping'), !, @@ -84,18 +84,18 @@ amalgame_stats(URL, ['total mappings'-Total, sort(Ts0, Ts), length(Mapping, Total), length(Ss, SN), - length(Ts, TN), - resource_link(URL, HREF). + length(Ts, TN). + %resource_link(URL, HREF). amalgame_stats(Scheme, - ['Total concepts'-Total, - 'browse' - a(href(HREF), Scheme) + ['Total concepts'-Total + %'browse' - a(href(HREF), Scheme) ]) :- rdfs_individual_of(Scheme, skos:'ConceptScheme'), !, findall(C,rdf(C,skos:inScheme,Scheme), Cs), - length(Cs, Total), - resource_link(Scheme,HREF). + length(Cs, Total). + %resource_link(Scheme,HREF). amalgame_stats(URL, ['type' - \(cp_label:rdf_link(Type)), @@ -110,8 +110,8 @@ amalgame_stats(URL, ; Definition = '-' ). -amalgame_stats(URL, ['browse' - a(href(HREF), URL)]) :- - resource_link(URL,HREF). +amalgame_stats(_URL, []).%['browse' - a(href(HREF), URL)]) :- + %resource_link(URL,HREF). %:- % phrase(rdf_link(URL), Tokens), % with_output_to(atom(Link), print_html(Tokens)). diff --git a/applications/equalizer/web/css/builder.css b/applications/equalizer/web/css/builder.css index 2d9fb6d..7f187d4 100644 --- a/applications/equalizer/web/css/builder.css +++ b/applications/equalizer/web/css/builder.css @@ -21,6 +21,10 @@ #controls .yui3-accordion-item-trigger { background-position: 105% -348px; } +#controls .yui3-accordion-item-bd .desc, +#controls .yui3-accordion-item-bd form { + padding: 5px 10px; +} #controls .yui3-accordion-item-bd.disabled { color: #BBB; } @@ -36,7 +40,16 @@ /* infobox */ -#infobox .content { +#infobox { + border-width: 1px 1px 0; + border-style: solid; + border-color: #808080; +} +#infobox .hd { + background: url("http://yui.yahooapis.com/3.0.0/build/assets/skins/sam/sprite.png") repeat-x scroll 0 0 transparent; + padding: 5px 10px; +} +#infobox .bd { padding: 5px 10px; } #infobox .loading { @@ -52,9 +65,9 @@ #infobox th { font-weight: bold; } -#infobox .top { - padding: 5px 0; +#infobox .labelbox { margin: 0 10px; + padding: 5px 0; border-bottom: 1px solid #CCC; } #infobox .type { diff --git a/applications/equalizer/web/js/infobox.js b/applications/equalizer/web/js/infobox.js index 8343c9e..b2fe72b 100644 --- a/applications/equalizer/web/js/infobox.js +++ b/applications/equalizer/web/js/infobox.js @@ -31,33 +31,34 @@ YUI.add('infobox', function(Y) { Y.extend(InfoBox, Y.Base, { initializer : function(config) { - var bd = this.get("srcNode").one('.yui3-accordion-item-bd'); + var bd = this.get("srcNode"); var selected = this.get("selected"), label = selected ? selected.label : "", - type = selected ? selected.type : ""; + type = selected ? selected.type : "input"; - var topNode = bd.appendChild(Node.create( - '<div class="top hidden"></div>' + this.typeNode = bd.appendChild(Node.create( + '<div class="hd">'+type+'</div>' )); - this.typeNode = topNode.appendChild(Node.create( - '<span class="type">'+type+'</span>' + + var labelBox = bd.appendChild(Node.create( + '<div class="labelbox hidden"></div>' )); - this.labelNode = topNode.appendChild(Node.create( + labelBox.appendChild("<label>label: <label>"); + this.labelNode = labelBox.appendChild(Node.create( '<input type="text" name="label" class="label" size="40" value="'+label+'">' )); - var update = topNode.appendChild(Node.create( + var update = labelBox.appendChild(Node.create( '<input type="button" value="change">' )); update.on("click", this._updateLabel, this); this.contentNode = bd.appendChild(Node.create( - '<div class="content">'+this.get("content")+'</div>' + '<div class="bd">'+this.get("content")+'</div>' )); this.loading = bd.appendChild(Node.create( '<div class="loading hidden"></div>' )); - this.topNode = topNode; - this.bd = bd; + this.labelBox = labelBox; this.after('waitingChange', this.toggleLoading, this); this.after('selectedChange', this._update, this); }, @@ -69,15 +70,15 @@ YUI.add('infobox', function(Y) { label = selected ? selected.label : "", type = selected ? selected.type : "", datasource = this.get("datasource"), - bd = this.bd, + bd = this.get("srcNode"), content = this.contentNode; if(selected) { - this.topNode.removeClass("hidden"); + this.labelBox.removeClass("hidden"); this.labelNode.set("value", label); this.typeNode.setContent(type); } else { - this.topNode.addClass("hidden"); + this.labelBox.addClass("hidden"); } if(uri) { diff --git a/config-available/ag_modules.pl b/config-available/ag_modules.pl new file mode 100644 index 0000000..4e52f73 --- /dev/null +++ b/config-available/ag_modules.pl @@ -0,0 +1,7 @@ +:- module(conf_ag_modules, []). + +user:file_search_path(ag_modules, library(ag_modules)). + +:- use_module(ag_modules(exact_label_match)). +:- use_module(ag_modules(snowball_match)). +:- use_module(ag_modules(select1_1)). diff --git a/lib/amalgame/matchers/exact_label_match.pl b/lib/ag_modules/exact_label_match.pl similarity index 96% rename from lib/amalgame/matchers/exact_label_match.pl rename to lib/ag_modules/exact_label_match.pl index 138e5de..201a35a 100644 --- a/lib/amalgame/matchers/exact_label_match.pl +++ b/lib/ag_modules/exact_label_match.pl @@ -4,12 +4,12 @@ :- use_module(library(semweb/rdf_db)). :- use_module(library(amalgame/vocabulary)). -:- public amalgame_module/2. +:- public amalgame_module/1. :- public filter/3. :- public matcher/4. :- public parameter/4. -amalgame_module(amalgame:'Matcher', amalgame:'Exact_Label_Matcher'). +amalgame_module(amalgame:'Exact_Label_Matcher'). parameter(sourcelabel, uri, P, 'Property to get label of the source by') :- diff --git a/lib/amalgame/select/select1_1.pl b/lib/ag_modules/select1_1.pl similarity index 88% rename from lib/amalgame/select/select1_1.pl rename to lib/ag_modules/select1_1.pl index ad3103d..31ce59b 100644 --- a/lib/amalgame/select/select1_1.pl +++ b/lib/ag_modules/select1_1.pl @@ -2,10 +2,10 @@ :- use_module(library(semweb/rdf_db)). -:- public amalgame_module/2. +:- public amalgame_module/1. :- public selecter/5. -amalgame_module(amalgame:'Selecter', amalgame:'Select1_1'). +amalgame_module(amalgame:'Select_1_1'). %% selecter(+Source, -Selected, -Discarded, -Undecided, +Options) diff --git a/lib/amalgame/matchers/snowball_match.pl b/lib/ag_modules/snowball_match.pl similarity index 94% rename from lib/amalgame/matchers/snowball_match.pl rename to lib/ag_modules/snowball_match.pl index 2b54412..d0136bb 100644 --- a/lib/amalgame/matchers/snowball_match.pl +++ b/lib/ag_modules/snowball_match.pl @@ -5,15 +5,15 @@ :- use_module(library(semweb/rdf_litindex)). :- use_module(library(snowball)). :- use_module(library(lit_distance)). -:- use_module(library(amalgame/alignment_graph)). +:- use_module(library(amalgame/vocabulary)). :- use_module(library(amalgame/candidate)). -:- public amalgame_module/2. +:- public amalgame_module/1. :- public parameter/4. :- public filter/3. :- public matcher/4. -amalgame_module(amalgame:'Matcher', amalgame:'Snowball_Matcher'). +amalgame_module(amalgame:'Snowball_Matcher'). parameter(sourcelabel, uri, P, 'Property to get label of the source by') :- @@ -55,9 +55,9 @@ matcher(Source, Target, Mappings, Options) :- align(Source, Target, Match, Options) :- option(prefix(0), Options), !, - graph_member(S, Source), + vocab_member(S, Source), match(align(S,T,[]), Match, Options), - graph_member(T, Target). + vocab_member(T, Target). align(Source, Target, Match, Options) :- prefix_candidate(Source, Target, Match0, Options), diff --git a/lib/amalgame/alignment_graph.pl b/lib/amalgame/alignment_graph.pl index 5313662..fea657a 100644 --- a/lib/amalgame/alignment_graph.pl +++ b/lib/amalgame/alignment_graph.pl @@ -23,12 +23,6 @@ :- use_module(library(amalgame/alignment)). -% components -:- use_module(library(amalgame/matchers/snowball_match)). -:- use_module(library(amalgame/matchers/exact_label_match)). -:- use_module(library(amalgame/select/select1_1)). -:- use_module(library(amalgame/source/voc_exclude)). - :- dynamic map_cache/2. diff --git a/lib/amalgame/amalgame_modules.pl b/lib/amalgame/amalgame_modules.pl index e0c8139..210c22f 100644 --- a/lib/amalgame/amalgame_modules.pl +++ b/lib/amalgame/amalgame_modules.pl @@ -1,49 +1,34 @@ :- module(amalgame_modules, - [ current_amalgame_module/3, % ?class, ?Type, ?Module - amalgame_module_id/3, % +Class, +Type, -Module - amalgame_class_modules/2, % +Class, -Modules:[uri-module] - amalgame_module_parameters/2 % +Module, -Parameters + [ current_amalgame_module/2, % ?URI, ?Module + amalgame_module_id/2, % +Class, +Type, -Module + amalgame_module_parameters/2 % +Module, -Parameters ]). :- use_module(library(semweb/rdf_db)). -%% current_amalgame_module(?Class, ?URI, ?ModuleName) +%% current_amalgame_module(?URI, ?ModuleName) % -% True if Module is an amalgame module identified by URI and -% belonging to Class. +% True if Module is an amalgame module identified by URI. -current_amalgame_module(Class, URI, Module) :- - current_predicate(Module:amalgame_module/2), - Module:amalgame_module(Class0, URI0), - rdf_global_id(Class0, Class), - rdf_global_id(URI0, URI). +current_amalgame_module(URI, Module) :- + current_predicate(Module:amalgame_module/1), + Module:amalgame_module(URI0), + rdf_global_id(URI0, URI). -%% amalgame_module_id(+Class, +URI, -Module) +%% amalgame_module_id(+URI, -Module) % % True if Module is an amalgame module with URI and of type Class. % -% @param Type is an RDF Class % @error existence_error(amalgame_module) % @see current_amalgame_module/1 for a version that fails if there % is no module -amalgame_module_id(Class, URI, Module) :- - ( current_amalgame_module(Class, URI, M) +amalgame_module_id(URI, Module) :- + ( current_amalgame_module(URI, M) -> Module = M - ; throw(error(existence_error(amalgame_module, [Class, URI]), _)) + ; throw(error(existence_error(amalgame_module, [URI]), _)) ). -:- rdf_meta - amalgame_class_modules(r, -). - -%% amalgame_class_modules(+Class, -Modules) -% -% Modules is a list of currently loaded amalgames modules of type -% Class. - -amalgame_class_modules(Class, Modules) :- - findall(URI-M, current_amalgame_module(Class, URI, M), Modules). - %% amalgame_module_parameters(+Module,-Parameters) % % Parameters is a list of parameters for Module. diff --git a/lib/amalgame/candidate.pl b/lib/amalgame/candidate.pl index b133528..0185cea 100644 --- a/lib/amalgame/candidate.pl +++ b/lib/amalgame/candidate.pl @@ -2,7 +2,7 @@ [ prefix_candidate/4 ]). -:- use_module(library(amalgame/alignment_graph)). +:- use_module(library(amalgame/vocabulary)). :- use_module(library(semweb/rdf_label)). :- use_module(library(semweb/rdf_db)). @@ -11,9 +11,9 @@ prefix_candidate(Source, Target, align(S, T, []), Options) :- option(sourcelabel(MatchProp1), Options, DefaultProp), option(targetlabel(MatchProp2), Options, DefaultProp), option(prefixLength(PrefixLength), Options, 4), - graph_member(S, Source), + vocab_member(S, Source), rdf_has(S, MatchProp1, Lit), literal_text(Lit, Label), sub_atom(Label, 0, PrefixLength, _, Prefix), rdf_has(T, MatchProp2, literal(prefix(Prefix), _)), - graph_member(T, Target). + vocab_member(T, Target). diff --git a/lib/amalgame/expand_graph.pl b/lib/amalgame/expand_graph.pl index f1d8f2b..72d294f 100644 --- a/lib/amalgame/expand_graph.pl +++ b/lib/amalgame/expand_graph.pl @@ -28,11 +28,11 @@ expand_mapping(Id, Mapping) :- debug_mapping_expand(cache, Id, Mapping). expand_mapping(Id, Mapping) :- rdf_has(Id, opmv:wasGeneratedBy, Process, OutputType), - rdf(Process, rdf:type, URI), - amalgame_module_id(Class, URI, Module), + rdf(Process, rdf:type, Type), + amalgame_module_id(Type, Module), process_options(Process, Module, Options), - exec_mapping_process(Class, Process, Module, Results, Options), - cache_mapping_result(Class, Results, Id), + exec_mapping_process(Type, Process, Module, Results, Options), + cache_mapping_result(Type, Results, Id), select_result_mapping(Results, OutputType, Mapping), debug_mapping_expand(Process, Id, Mapping). @@ -78,8 +78,8 @@ expand_vocab(Id, Vocab) :- !. expand_vocab(Vocab, Vocab) :- rdf(Vocab, rdf:type, skos:'ConceptScheme'). - -%% exec_mapping_process(+Class, +Process, +Module, -Mapping, + +%% exec_mapping_process(+Type, +Process, +Module, -Mapping, %% +Options) % % Mapping is the mapping corresponding to Id and is generated by @@ -87,8 +87,8 @@ expand_vocab(Vocab, Vocab) :- % % @error existence_error(mapping_process) -exec_mapping_process(Class, Process, Module, Mapping, Options) :- - rdfs_subclass_of(Class, amalgame:'Matcher'), +exec_mapping_process(Type, Process, Module, Mapping, Options) :- + rdfs_subclass_of(Type, amalgame:'Matcher'), !, ( rdf(Process, amalgame:input, InputId) -> expand_mapping(InputId, MappingIn), diff --git a/rdf/tool/amalgame.ttl b/rdf/tool/amalgame.ttl index 1ca8ed7..3b940b9 100644 --- a/rdf/tool/amalgame.ttl +++ b/rdf/tool/amalgame.ttl @@ -1,28 +1,16 @@ +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix skos: <http://www.w3.org/2004/02/skos/core#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix amalgame: <http://purl.org/vocabularies/amalgame#> . -@prefix align: <http://knowledgeweb.semanticweb.org/heterogeneity/alignment#> . -@prefix opmv: <http://purl.org/net/opmv/ns#> . -@prefix owl: <http://www.w3.org/2002/07/owl#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix skos: <http://www.w3.org/2004/02/skos/core#> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . - -amalgame:Process rdfs:subClassOf opmv:Process. -amalgame:Match rdfs:subClassOf amalgame:Process. -amalgame:Merge rdfs:subClassOf amalgame:Process. -amalgame:Select rdfs:subClassOf amalgame:Process. -amalgame:Voc_Exclude rdfs:subClassOf opmv:Process. - -amalgame:Snowball_Matcher rdfs:subClassOf amalgame:Match . -amalgame:Exact_Label_Matcher rdfs:subClassOf amalgame:Match . - -amalgame:Isub_Matcher - rdfs:label "isub string matcher"; - skos:definition "An isub string similarity matcher based on the metric described by 'A string metric for ontology alignment' by Giorgos Stoilos, 2005."@en; - rdfs:subClassOf amalgame:Match . - -amalgame:Select1_1 rdfs:subClassOf amalgame:Select . -amalgame:Arity_select rdfs:subClassOf amalgame:Select . +@prefix align: <http://knowledgeweb.semanticweb.org/heterogeneity/alignment#> . +@prefix opmv: <http://purl.org/net/opmv/ns#> . + +amalgame:Process rdfs:subClassOf opmv:Process . +amalgame:Matcher rdfs:subClassOf amalgame:Process . +amalgame:Merger rdfs:subClassOf amalgame:Process . +amalgame:Selecter rdfs:subClassOf amalgame:Process . amalgame:includes rdfs:domain skos:ConceptScheme ; diff --git a/rdf/tool/modules.ttl b/rdf/tool/modules.ttl new file mode 100644 index 0000000..4072159 --- /dev/null +++ b/rdf/tool/modules.ttl @@ -0,0 +1,28 @@ +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix skos: <http://www.w3.org/2004/02/skos/core#> . +@prefix amalgame: <http://purl.org/vocabularies/amalgame#> . + +amalgame:Exact_Label_Matcher + rdfs:label "exact label matcher"@en ; + skos:definition "A basic label matcher"@en ; + rdfs:subClassOf amalgame:Matcher . + +amalgame:Snowball_Matcher + rdfs:label "snowball matcher"@en ; + skos:definition "A label matcher with similarity based on stemming."@en ; + rdfs:subClassOf amalgame:Matcher . + +amalgame:Isub_Matcher + rdfs:label "isub string matcher"@en ; + skos:definition "An isub string similarity matcher based on the metric described by 'A string metric for ontology alignment' by Giorgos Stoilos, 2005."@en ; + rdfs:subClassOf amalgame:Matcher . + +amalgame:Select_1_1 + rdfs:label "select 1-1"@en ; + skos:definition "Select correspondences that have only 1 source and 1 target concept." ; + rdfs:subClassOf amalgame:Selecter . + +amalgame:Arity_select + rdfs:label "arity select"@en ; + rdfs:subClassOf amalgame:Selecter . \ No newline at end of file