amalgame/commit

IMPROVED: remove special case of VoxExclude, it is now a virtualized vocab selecter like all the others

authorJacco van Ossenbruggen
Mon Sep 1 17:11:19 2014 +0200
committerJacco van Ossenbruggen
Mon Sep 1 17:11:19 2014 +0200
commitdbe6246c990eec8d19c44111528c4a7684282b12
tree0450710ce86f7d3acc77c997bc86242569b13916
parent475c34ca3034861a31962bd49e264f83c64c0f3c
Diff style: patch stat
diff --git a/lib/ag_drivers/exec_amalgame_process.pl b/lib/ag_drivers/exec_amalgame_process.pl
index df70f89..aa12deb 100644
--- a/lib/ag_drivers/exec_amalgame_process.pl
+++ b/lib/ag_drivers/exec_amalgame_process.pl
@@ -115,24 +115,15 @@ 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:'VocExclude'),
-	rdf(NewVocab, amalgame:wasGeneratedBy, Process, Strategy),
-	NewVocOption = new_scheme(NewVocab),
-	!,
-	once(rdf(Process, amalgame:input, Input, Strategy)),
-	expand_node(Strategy, Input, Vocab),
-	findall(S, rdf_has(Process, amalgame:secondary_input, S), Ss),
-	maplist(expand_node(Strategy), Ss, Expanded),
-	append(Expanded, Mapping),
-	timed_call(Module:exclude(Vocab, Mapping, Result, [NewVocOption|Options]), Time),
-	VocSpec=vocspec(Result). % vocspec(scheme(URI))
 exec_amalgame_process(Class, Process, Strategy, Module, VocSpec, Time, Options) :-
 	rdfs_subclass_of(Class, amalgame:'VocabSelecter'),
 	!,
 	once(rdf(Process, amalgame:input, Input, Strategy)),
+	findall(S, rdf_has(Process, amalgame:secondary_input, S), Ss),
+
 	expand_node(Strategy, Input, vocspec(Vocab)),
-	timed_call(Module:selecter(Vocab, Result, Options), Time),
+	timed_call(Module:selecter(Vocab, Result,
+				   [snd_input(Ss), strategy(Strategy)|Options]), Time),
 	VocSpec=vocspec(Result). % vocspec(and(_,_))
 exec_amalgame_process(Class, Process,_,_, _, _, _) :-
 	throw(error(existence_error(mapping_process, [Class, Process]), _)).
diff --git a/lib/ag_modules/voc_exclude.pl b/lib/ag_modules/voc_exclude.pl
index e959165..04d7ead 100644
--- a/lib/ag_modules/voc_exclude.pl
+++ b/lib/ag_modules/voc_exclude.pl
@@ -1,34 +1,13 @@
 :- module(voc_exclude, []).
 
-:- use_module(library(option)).
-:- use_module(library(apply)).
-:- use_module(library(ordsets)).
-:- use_module(library(semweb/rdf_db)).
-:- use_module(library(skos/util)).
-:- use_module(library(amalgame/vocabulary)).
-
 :- public amalgame_module/1.
 :- public parameter/4.
-:- public exclude/4.
+:- public selecter/3.
+
 
 amalgame_module(amalgame:'VocExclude').
 
 parameter(type, oneof([source,target]), source,
 	  'Exclude matching sources or targets').
 
-exclude(Vocab, Mapping, scheme(NewScheme), Options) :-
-	option(type(Type), Options),
-	option(new_scheme(NewScheme), Options),
-	findall(C, vocab_member(C, Vocab), Concepts0),
-	mapping_concepts(Type, Mapping, Exclude0),
-	sort(Concepts0, Concepts),
-	sort(Exclude0, Exclude),
-	ord_subtract(Concepts, Exclude, Rest),
-	rdf_transaction(forall(member(R,Rest),
-			       skos_add_to_scheme(R, NewScheme, NewScheme))),
-	skos_assert_scheme(NewScheme, NewScheme).
-
-mapping_concepts(source, Mapping, Concepts) :-
-	maplist(arg(1), Mapping, Concepts).
-mapping_concepts(target, Mapping, Concepts) :-
-	maplist(arg(2), Mapping, Concepts).
+selecter(Scheme, and((Scheme), not(is_mapped(Options))), Options).
diff --git a/rdf/tool/ag_modules.ttl b/rdf/tool/ag_modules.ttl
index dd1aae8..0d9cdb8 100644
--- a/rdf/tool/ag_modules.ttl
+++ b/rdf/tool/ag_modules.ttl
@@ -119,7 +119,7 @@ amalgame:VocExclude
     amalgame:need_secondary_inputs true ;
     rdfs:label "subtract mapped concepts"@en ;
     skos:definition "Subtract from a vocabulary the sources or targets from a given mapping to create a vocabulary with the unmapped concepts."@en ;
-    rdfs:subClassOf amalgame:MaterializedVocabSelecter .
+    rdfs:subClassOf amalgame:VirtualVocabSelecter .
 
 amalgame:TypeSelect
     rdfs:label "select facet on type"@en ;