amalgame/commit

IMPROVED: fix more old reference to Matcher class

authorJacco van Ossenbruggen
Mon Sep 8 23:02:16 2014 +0200
committerJacco van Ossenbruggen
Mon Sep 8 23:02:16 2014 +0200
commit2478d33171759060b723f18a4450e1541670367c
treecc2ab517eb845fed143f4a8b3f766c48634876d6
parent77d7f7244930a85237c650e7cff7858c7eaccd88
Diff style: patch stat
diff --git a/api/hints.pl b/api/hints.pl
index fa36bd7..42001c7 100644
--- a/api/hints.pl
+++ b/api/hints.pl
@@ -111,7 +111,7 @@ find_hint(Strategy, Context, Hint) :-
 	Hint =	json([
 		    event(submit),
 		    data(json([
-			     lastAction(match),
+			     lastAction(generate),
 			     focus(Focus),
 			     process(Match),
 			     source(Focus),
diff --git a/api/strategy_viz.pl b/api/strategy_viz.pl
index fb46973..8e7d7d8 100644
--- a/api/strategy_viz.pl
+++ b/api/strategy_viz.pl
@@ -182,7 +182,7 @@ process_color(R, '#99CCFF') :-
 	rdfs_individual_of(R, amalgame:'MappingPartitioner'),
 	!.
 process_color(R, '#CC99FF') :-
-	rdfs_individual_of(R, amalgame:'Matcher'),
+	rdfs_individual_of(R, amalgame:'CandidateGenerator'),
 	!.
 process_color(R, '#FF99CC') :-
 	rdfs_individual_of(R, amalgame:'EvaluationProcess'),
diff --git a/components/amalgame/controls.pl b/components/amalgame/controls.pl
index f60d918..16b5ea7 100644
--- a/components/amalgame/controls.pl
+++ b/components/amalgame/controls.pl
@@ -10,9 +10,9 @@
 :- use_module(components(amalgame/util)).
 
 html_controls  -->
-	{ amalgame_modules_of_type(amalgame:'Partitioner', Partitioners),
-	  amalgame_modules_of_type(amalgame:'Matcher', Matchers),
-	  amalgame_modules_of_type(amalgame:'SetOperator', Analyzers)
+	{ amalgame_modules_of_type(amalgame:'Partitioner',        Partitioners),
+	  amalgame_modules_of_type(amalgame:'CandidateGenerator', Generators),
+	  amalgame_modules_of_type(amalgame:'SetOperator',        Analyzers)
 	},
 	html([
 	    \html_control_set(hint_control_set, true,
@@ -24,7 +24,7 @@ html_controls  -->
 			      \html_info_control),
 	    \html_control_set(generate_control_set, false,
 			      'Generate',
-			      \html_generate_control(Matchers)),
+			      \html_generate_control(Generators)),
 	    \html_control_set(select_control_set, false,
 			      'Partition',
 			      \html_select_control(Partitioners)),
@@ -250,12 +250,6 @@ module_special_type(M, secinput) :-
 module_special_type(M, preloaded) :-
 	rdfs_subclass_of(M, amalgame:'SelectPreLoaded'),
 	!.
-module_special_type(M, generate) :-
-	rdfs_subclass_of(M, amalgame:'CandidateGenerator'),
-	!.
-module_special_type(M, match) :-
-	rdfs_subclass_of(M, amalgame:'Matcher'),
-	!.
 module_special_type(M, select) :-
 	rdfs_subclass_of(M, amalgame:'MappingPartitioner'),
 	!.
diff --git a/config-available/ag_modules.pl b/config-available/ag_modules.pl
index 309e5e4..60afd17 100644
--- a/config-available/ag_modules.pl
+++ b/config-available/ag_modules.pl
@@ -20,13 +20,13 @@
 :- use_module(library(ag_modules/related_selecter)).
 :- use_module(library(ag_modules/snowball_label_selecter)).
 
-% Other mapping producing partitioners
+% Other mapping producing partitioners:
 :- use_module(library(ag_modules/arity_select)).
 :- use_module(library(ag_modules/ag_sample)).
 :- use_module(library(ag_modules/best_numeric)).
-:- use_module(library(ag_modules/most_methods)).
-:- use_module(library(ag_modules/most_labels)).
 :- use_module(library(ag_modules/most_generic)).
+:- use_module(library(ag_modules/most_labels)).
+:- use_module(library(ag_modules/most_methods)).
 :- use_module(library(ag_modules/sibling_selecter)).
 :- use_module(library(ag_modules/token_arity_select)).
 
diff --git a/lib/ag_drivers/exec_amalgame_process.pl b/lib/ag_drivers/exec_amalgame_process.pl
index 643d6e7..fe63d9e 100644
--- a/lib/ag_drivers/exec_amalgame_process.pl
+++ b/lib/ag_drivers/exec_amalgame_process.pl
@@ -91,28 +91,6 @@ collect_snd_input(Process, Strategy, SecInput):-
 %
 %       @error existence_error(mapping_process)
 
-exec_amalgame_process(Type, Process, Strategy, Module, MapSpec, Time, Options) :-
-	rdfs_subclass_of(Type, amalgame:'Matcher'),
-	!,
-	collect_snd_input(Process, Strategy, SecInput),
-	(   rdf(Process, amalgame:source, SourceId, Strategy),
-	    rdf(Process, amalgame:target, TargetId, Strategy)
-	->  expand_node(Strategy, SourceId, Source),
-	    expand_node(Strategy, TargetId, Target),
-	    voc_property(SourceId, format(SourceFormat)),
-	    voc_property(TargetId, format(TargetFormat)),
-	    timed_call(Module:matcher(Source, Target, Mapping0,
-				      [snd_input(SecInput),
-				       source_format(SourceFormat),
-				       target_format(TargetFormat)
-				      |Options]), Time)
-	;   rdf(Process, amalgame:input, InputId)
-	->  expand_node(Strategy, InputId, MappingIn),
-	    timed_call(Module:filter(MappingIn, Mapping0,
-				     [snd_input(SecInput)|Options]), Time)
-	),
-	merge_provenance(Mapping0, Mapping),
-	MapSpec = mapspec(mapping(Mapping)).
 exec_amalgame_process(Class, Process, Strategy, Module, MapSpec, Time, Options) :-
 	rdfs_subclass_of(Class, amalgame:'MappingPartitioner'),
 	!,
@@ -122,6 +100,32 @@ exec_amalgame_process(Class, Process, Strategy, Module, MapSpec, Time, Options)
 	expand_node(Strategy, InputId, MappingIn),
 	timed_call(Module:selecter(MappingIn, Selected, Discarded, Undecided,
 				   [snd_input(SecInput)|Options]), Time).
+exec_amalgame_process(Type, Process, Strategy, Module, MapSpec, Time, Options) :-
+	rdfs_subclass_of(Type, amalgame:'CandidateGenerator'),
+	!,
+	collect_snd_input(Process, Strategy, SecInput),
+	rdf(Process, amalgame:source, SourceId, Strategy),
+	rdf(Process, amalgame:target, TargetId, Strategy),
+	expand_node(Strategy, SourceId, Source),
+	expand_node(Strategy, TargetId, Target),
+	voc_property(SourceId, format(SourceFormat)),
+	voc_property(TargetId, format(TargetFormat)),
+	timed_call(Module:matcher(Source, Target, Mapping0,
+				  [snd_input(SecInput),
+				   source_format(SourceFormat),
+				   target_format(TargetFormat)
+				  |Options]), Time),
+	merge_provenance(Mapping0, Mapping),
+	MapSpec = mapspec(mapping(Mapping)).
+exec_amalgame_process(Class, Process, Strategy, Module, VocSpec, Time, Options) :-
+	rdfs_subclass_of(Class, amalgame:'VocabPartitioner'),
+	!,
+	once(rdf(Process, amalgame:input, Input, Strategy)),
+	findall(S, rdf_has(Process, amalgame:secondary_input, S), Ss),
+	VocSpec = vocspec(select(Selected, Discarded, Undecided)),
+	expand_node(Strategy, Input, InputVocspec),
+	timed_call(Module:selecter(InputVocspec, Selected, Discarded, Undecided,
+				   [snd_input(Ss), strategy(Strategy)|Options]), Time).
 exec_amalgame_process(Class, Process, Strategy, Module, MapSpec, Time, Options) :-
 	rdfs_subclass_of(Class, amalgame:'MapMerger'),
 	!,
@@ -136,15 +140,6 @@ exec_amalgame_process(Class, Process, Strategy, Module, MapSpec, Time, Options)
 	% We need the ids, not the values in most analyzers
 	timed_call(Module:analyzer(Inputs, Process, Strategy, Result, Options), Time),
 	MapSpec = mapspec(Result). % Result = overlap([..]).
-exec_amalgame_process(Class, Process, Strategy, Module, VocSpec, Time, Options) :-
-	rdfs_subclass_of(Class, amalgame:'VocabPartitioner'),
-	!,
-	once(rdf(Process, amalgame:input, Input, Strategy)),
-	findall(S, rdf_has(Process, amalgame:secondary_input, S), Ss),
-	VocSpec = vocspec(select(Selected, Discarded, Undecided)),
-	expand_node(Strategy, Input, InputVocspec),
-	timed_call(Module:selecter(InputVocspec, Selected, Discarded, Undecided,
-				   [snd_input(Ss), strategy(Strategy)|Options]), Time).
 exec_amalgame_process(Class, Process,_,_, _, _, _) :-
 	throw(error(existence_error(mapping_process, [Class, Process]), _)).
 
@@ -154,4 +149,3 @@ timed_call(Goal, Time) :-
 	call(Goal),
 	thread_statistics(Me, cputime, T1),
         Time is T1 - T0.
-
diff --git a/rdf/tool/ag_modules.ttl b/rdf/tool/ag_modules.ttl
index 04f193c..0a5cac0 100644
--- a/rdf/tool/ag_modules.ttl
+++ b/rdf/tool/ag_modules.ttl
@@ -3,7 +3,7 @@
 @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
 @prefix amalgame: <http://purl.org/vocabularies/amalgame#> .
 
-######## Candidate generator classes:
+######## Candidate correspondence generator components:
 
 amalgame:AncestorMatcher
     amalgame:need_secondary_inputs true ;
@@ -32,6 +32,11 @@ amalgame:IsubMatcher
     skos:definition "Generate new candidates based on similar labels. The matcher is based on the 'isub' metric introduced in 'A string metric for ontology alignment' by Giorgos Stoilos, 2005."@en ;
     rdfs:subClassOf amalgame:CandidateGenerator .
 
+amalgame:SelectPreLoaded
+    rdfs:label "import/preloaded"@en ;
+    skos:definition "Match mappings from preloaded named graph against concepts in source and target vocabularies"@en ;
+    rdfs:subClassOf amalgame:CandidateGenerator .
+
 amalgame:RelatedMatcher
     amalgame:need_secondary_inputs true ;
     rdfs:label "structure/related"@en ;
@@ -43,46 +48,95 @@ amalgame:SnowballMatcher
     skos:definition "Generate new candidates based on label matching after (snowball) stemming."@en ;
     rdfs:subClassOf amalgame:CandidateGenerator .
 
-######## Mapping partitioner classes:
+########  Mapping producing partitioners, based on the generators above:
 
 amalgame:AncestorSelecter
     amalgame:need_secondary_inputs true ;
-    rdfs:label "partition/structure/ancestor"@en ;
+    rdfs:label "structure/ancestor"@en ;
     skos:definition "Select mappings with the most mapped ancestors, discard others for the same source/target. If type=all, all correspondences with one or more ancestors are selected."@en ;
     rdfs:subClassOf amalgame:MappingPartitioner .
 
 amalgame:CompoundLabelSelecter
-    rdfs:label "partition/label/compound source"@en ;
+    rdfs:label "label/compound source"@en ;
     skos:definition "Select mappings with the most matching labels, discard others for the same source/target. If type=all, all candidates with matching labels are selected.  All matching is done after compound splitting the label(s) of the source concepts. Source labels are splitted using rdf_tokenize_literal/2. Warning: source label tokens are matched against complete target labels!"@en ;
     rdfs:subClassOf amalgame:MappingPartitioner .
 
 amalgame:DescendentSelecter
     amalgame:need_secondary_inputs true ;
-    rdfs:label "partition/structure/descendent"@en ;
+    rdfs:label "structure/descendent"@en ;
     skos:definition "Select mappings with the most mapped descendents, discard others for the same source/target. If type=all, all correspondences with one or more descendents are selected."@en ;
     rdfs:subClassOf amalgame:MappingPartitioner .
 
 amalgame:ExactLabelSelecter
-    rdfs:label "partition/label/exact"@en ;
+    rdfs:label "label/exact"@en ;
     skos:definition "Select mappings with the most matching labels, discard others for the same source/target. If type=all, all candidates with matching labels are selected."@en ;
     rdfs:subClassOf amalgame:MappingPartitioner .
 
 amalgame:IsubSelecter
-    rdfs:label "partition/label/similarity"@en ;
+    rdfs:label "label/similarity"@en ;
     skos:definition "Select mappings with the most similar labels, discard others for the same source/target.  If type=all, all candidates with sufficiently similar labels are selected. The matcher is based on the 'isub' metric introduced in 'A string metric for ontology alignment' by Giorgos Stoilos, 2005."@en ;
     rdfs:subClassOf amalgame:MappingPartitioner .
 
+amalgame:SelectPreLoadedSelecter
+    rdfs:label "import/preloaded"@en ;
+    skos:definition "Select mappings with corresponding mappings in the preloaded mapping, discard others with the same source/target."@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
 amalgame:RelatedSelecter
     amalgame:need_secondary_inputs true ;
-    rdfs:label "partition/structure/related"@en ;
+    rdfs:label "structure/related"@en ;
     skos:definition "Select mappings with the most mapped related concepts, discard others for the same source/target. If type=all, all correspondences with one or more related concepts are selected."@en ;
     rdfs:subClassOf amalgame:MappingPartitioner .
 
 amalgame:SnowballLabelSelecter
-    rdfs:label "partition/label/stemmed"@en ;
+    rdfs:label "label/stemmed"@en ;
     skos:definition "Select mappings with the most matching labels after (snowball) stemming, discard others for the same source/target. If type=all, all candidates with matching labels are selected."@en ;
     rdfs:subClassOf amalgame:MappingPartitioner .
 
+########  Other mapping producing partitioners:
+
+amalgame:AritySelect
+    rdfs:label "ambiguity/remove"@en ;
+    skos:definition "Select correspondences with a unique source, target or both, discard others"@en;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
+amalgame:Sampler
+    rdfs:label "sampler"@en ;
+    amalgame:materialize amalgame:always ;
+    skos:definition "Component that randomly samples correspondences to create a new mapping."@en ;
+    rdfs:comment "Samples are always materialized to guarantee replicability of the workflow."@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
+amalgame:BestNumeric
+    rdfs:label "best numeric"@en ;
+    skos:definition "Select correspondences that have the best score considering some numerical ranking, discard others."@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
+amalgame:MostGeneric
+    rdfs:label "most generic"@en ;
+    skos:definition "Select the most generic concepts among alternatives for the same source/target, discard others."@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
+amalgame:MostLabels
+    rdfs:label "most labels"@en ;
+    skos:definition "Select correspondences that already have the most matching labels (according to their evidence data.)"@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
+amalgame:MostMethods
+    rdfs:label "most methods"@en ;
+    skos:definition "Select correspondences that have been selected by the most other methods (according to their evidence data.)"@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
+amalgame:SiblingSelecter
+    rdfs:label "sibling selecter"@en ;
+    skos:definition "Select the siblings (if any) among alternatives for the same source/target. This is used, for example, when a single source with two labels matches on two distinct but very similar targets and both mappings need to be preserved. "@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
+amalgame:TokenAritySelect
+    rdfs:label "ambiguity/remove (token) "@en ;
+    skos:definition "Similar to ambiguity/remove but now on the level of splitted compound labels"@en ;
+    rdfs:subClassOf amalgame:MappingPartitioner .
+
 ######## Vocabulary partitioner classes:
 
 amalgame:VocExclude
@@ -113,51 +167,6 @@ amalgame:EvaluationProcess
     skos:definition "A process class representing manual evaluation processes "@en ;
     rdfs:subClassOf amalgame:Process .
 
-amalgame:SelectPreLoaded
-    rdfs:label "import/preloaded"@en ;
-    skos:definition "Match mappings from preloaded named graph against concepts in source and target vocabularies"@en ;
-    rdfs:subClassOf amalgame:Matcher .
-
-amalgame:SelectPreLoadedSelecter
-    rdfs:label "import/preloaded"@en ;
-    skos:definition "Select mappings with corresponding mappings in the preloaded mapping, discard others with the same source/target."@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
-amalgame:AritySelect
-    rdfs:label "ambiguity/remove"@en ;
-    skos:definition "Select correspondences with a unique source, target or both, discard others"@en;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
-amalgame:TokenAritySelect
-    rdfs:label "ambiguity/remove (token) "@en ;
-    skos:definition "Similar to ambiguity/remove but now on the level of splitted compound labels"@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
-amalgame:BestNumeric
-    rdfs:label "best numeric"@en ;
-    skos:definition "Select correspondences that have the best score considering some numerical ranking, discard others."@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
-amalgame:MostMethods
-    rdfs:label "most methods"@en ;
-    skos:definition "Select correspondences that have been selected by the most other methods (according to their evidence data.)"@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
-amalgame:MostLabels
-    rdfs:label "most labels"@en ;
-    skos:definition "Select correspondences that already have the most matching labels (according to their evidence data.)"@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
-amalgame:MostGeneric
-    rdfs:label "most generic"@en ;
-    skos:definition "Select the most generic concepts among alternatives for the same source/target, discard others."@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
-amalgame:SiblingSelecter
-    rdfs:label "sibling selecter"@en ;
-    skos:definition "Select the siblings (if any) among alternatives for the same source/target. This is used, for example, when a single source with two labels matches on two distinct but very similar targets and both mappings need to be preserved. "@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
-
 amalgame:MapMerger
     amalgame:need_secondary_inputs true ;
     rdfs:label "mapping merger"@en ;
@@ -175,9 +184,3 @@ amalgame:Evaluater
     skos:definition "Component that analyzes correspondences in a mappings by manual evaluation"@en ;
     rdfs:subClassOf amalgame:Analyzer .
 
-amalgame:Sampler
-    rdfs:label "sampler"@en ;
-    amalgame:materialize amalgame:always ;
-    skos:definition "Component that randomly samples correspondences to create a new mapping."@en ;
-    rdfs:comment "Samples are always materialized to guarantee replicability of the workflow."@en ;
-    rdfs:subClassOf amalgame:MappingPartitioner .
diff --git a/rdf/tool/amalgame.ttl b/rdf/tool/amalgame.ttl
index 5e4bcdf..80280ed 100644
--- a/rdf/tool/amalgame.ttl
+++ b/rdf/tool/amalgame.ttl
@@ -31,7 +31,7 @@ amalgame:Partitioner
 amalgame:CandidateGenerator
     rdfs:label "Candidate generator"@en ;
     rdfs:comment "A process that generates a mapping with candidate correspondences."@en ;
-    rdfs:subClassOf amalgame:Matcher . # fix me, should become amalgame:Process .
+    rdfs:subClassOf amalgame:Process . 
 
 amalgame:MappingPartitioner
     rdfs:label "Mapping partitioner"@en ;
@@ -51,11 +51,6 @@ amalgame:VirtualVocabPartitioner
 
 ###############################
 
-amalgame:Matcher
-    rdfs:label "Matcher (deprecated)"@en ;
-    skos:definition "Component that creates a mapping given a source and target vocabulary"@en ;
-    rdfs:subClassOf amalgame:Process .
-
 amalgame:parameters
     a rdf:Property ;
     rdfs:domain amalgame:Process ;
diff --git a/web/js/controls.js b/web/js/controls.js
index bc71d43..a78ea85 100644
--- a/web/js/controls.js
+++ b/web/js/controls.js
@@ -52,12 +52,13 @@ YUI.add('controls', function(Y) {
 			   }
 			}, this);
 
-			// the match control has two additional buttons
+			// the generate control has two additional buttons
 			// to set the source and target
-			Y.on("click", this._valueSetAndSyncUI, NODE_INPUT_BTN, this, "input");
 			Y.on("click", this._valueSetAndSyncUI, NODE_SOURCE_BTN, this, "source");
 			Y.on("click", this._valueSetAndSyncUI, NODE_TARGET_BTN, this, "target");
 
+			Y.on("click", this._valueSetAndSyncUI, NODE_INPUT_BTN, this, "input");
+
 			// try to use the currently selected concept in the vocab browser:
 			NODE_CONCEPT_INPUTS.on('focus', this.currentConceptChange, this);
 			this.after('currentConceptChange', this.currentConceptChange, this);
@@ -202,14 +203,11 @@ YUI.add('controls', function(Y) {
 			  //Y.log("Disabling components requiring preloaded input mappings");
 			  Y.all(".preloaded").addClass("disabled");
 			}
-			// enable matcher submit when both source and target have a value
-			if(NODE_INPUT.get("value")||
-				(NODE_SOURCE.get("value")&&NODE_TARGET.get("value"))) {
-				Y.all("#match .control-submit").removeAttribute("disabled");
-				Y.all("#generate .control-submit").removeAttribute("disabled");
+			// enable generator submit when both source and target have a value
+			if (NODE_SOURCE.get("value") && NODE_TARGET.get("value")) {
+				Y.all("#vocab .control-submit").removeAttribute("disabled");
 			} else {
-				Y.all("#match .control-submit").setAttribute("disabled", true);
-				Y.all("#generate .control-submit").setAttribute("disabled", true);
+				Y.all("#vocab .control-submit").setAttribute("disabled", true);
 			}
 		},
 
diff --git a/web/js/infobox.js b/web/js/infobox.js
index 7011b58..18f472d 100644
--- a/web/js/infobox.js
+++ b/web/js/infobox.js
@@ -279,6 +279,8 @@ YUI.add('infobox', function(Y) {
 				     on: {success: function(e,o)
 						   {
 						     var r = Y.JSON.parse(o.responseText);
+						     Y.log('Create hint:');
+						     Y.log(r);
 						     if (r.text) {
 						       NODE_HINT.setContent(r.text);
 						     } else {
@@ -289,12 +291,14 @@ YUI.add('infobox', function(Y) {
 						       NODE_HINT.appendChild('(<a id="exec_hint">just do it</a>)');
 						       // FixMe! can we put the handler once on initialization?
 						       Y.one('#exec_hint').on("click", oSelf._onExecHint, oSelf, r.data, r.event);
-						       if (r.data.lastAction && (r.data.lastAction == "match")) {
-							 Y.one('#match_control_set').addClass('active');
+						       if (r.data.lastAction && (r.data.lastAction == "generate")) {
+							 Y.one('#generate_control_set').addClass('active');
 							 Y.one('#select_control_set').removeClass('active');
-						       } else if (r.data.lastAction && (r.data.lastAction == "input")) {
+							 Y.log('select -> generate');
+						       } else if (r.data.lastAction && (r.data.lastAction == "select")) {
 							 Y.one('#select_control_set').addClass('active');
-							 Y.one('#match_control_set').removeClass('active');
+							 Y.one('#generate_control_set').removeClass('active');
+							 Y.log('generate -> select');
 						       }
 						     }
 						   }