amalgame/commit

ADDED: flexible support for both intentional and extentional vocabulary expansion

authorJacco van Ossenbruggen
Mon Sep 15 09:20:55 2014 +0200
committerJacco van Ossenbruggen
Mon Sep 15 09:20:55 2014 +0200
commitbe349cd20591765282f9add5ce1bc8a55e12e04d
treeb1c1b9ff1ed5c48cd9507248aeef5fa6335359e6
parent4c3a8edfe098d276388c71f705f4c0cbc2d679ec
Diff style: patch stat
diff --git a/lib/ag_modules/propvalue_select.pl b/lib/ag_modules/propvalue_select.pl
index 180e3d5..261d3b2 100644
--- a/lib/ag_modules/propvalue_select.pl
+++ b/lib/ag_modules/propvalue_select.pl
@@ -2,8 +2,12 @@
 
 :- public amalgame_module/1.
 :- public parameter/4.
+:- public specifier/5.
 :- public selecter/5.
 
+:- use_module(library(option)).
+:- use_module(library(amalgame/vocabulary)).
+
 amalgame_module(amalgame:'PropertyValueSelect').
 
 parameter(property, uri, any,
@@ -13,7 +17,7 @@ parameter(value, uri, any,
 parameter(mode, oneof([select, remove]), select,
 	  'select or remove concepts with this property/value pair').
 
-selecter(VocSpec, Sel, Dis, [], Options) :-
+specifier(VocSpec, Sel, Dis, none, Options) :-
 	option(property(Property), Options),
 	option(value(Value),       Options),
 	S =  and((VocSpec),	propvalue(Property, Value)),
@@ -22,3 +26,7 @@ selecter(VocSpec, Sel, Dis, [], Options) :-
 	->  Sel = S, Dis = D
 	;   Sel = D, Dis = S
 	).
+selecter(VocSpec, SelConcepts, DisConcepts, [], Options) :-
+	specifier(VocSpec, SelSpec, DisSpec, _, Options),
+	all_vocab_members(SelSpec, SelConcepts),
+	all_vocab_members(DisSpec, DisConcepts).
diff --git a/lib/ag_modules/subtree_select.pl b/lib/ag_modules/subtree_select.pl
index 49f2497..0218dfe 100644
--- a/lib/ag_modules/subtree_select.pl
+++ b/lib/ag_modules/subtree_select.pl
@@ -1,11 +1,14 @@
 :- module(subtree_select, []).
 
 :- use_module(library(option)).
-:- use_module(library(http/html_write)).
+:- use_module(library(amalgame/vocabulary)).
+
 :- use_module(components(amalgame/util)). % for the amalgame:input_item//3 multifile hook
+:- use_module(library(http/html_write)).
 
 :- public amalgame_module/1.
 :- public parameter/4.
+:- public specifier/5.
 :- public selecter/5.
 
 amalgame_module(amalgame:'SubtreeSelect').
@@ -15,7 +18,7 @@ parameter(parent, uri, '',
 parameter(mode, oneof([select, remove]), select,
 	  'select or remove concepts from this subtree').
 
-selecter(VocSpec, Sel, Dis, [], Options) :-
+specifier(VocSpec, Sel, Dis, none, Options) :-
 	option(parent(Parent), Options),
 	S =  and((VocSpec),	subtree(Parent)),
 	D =  and((VocSpec), not(subtree(Parent))),
@@ -23,6 +26,10 @@ selecter(VocSpec, Sel, Dis, [], Options) :-
 	->  Sel = S, Dis = D
 	;   Sel = D, Dis = S
 	).
+selecter(VocSpec, SelConcepts, DisConcepts, [], Options) :-
+	specifier(VocSpec, Sel, Dis, _, Options),
+	all_vocab_members(Sel, SelConcepts),
+	all_vocab_members(Dis, DisConcepts).
 
 % Add class 'concept' to the input form in components(amalgame/util) so
 % we can use the values from the concept browser to assist the user in
diff --git a/lib/ag_modules/type_select.pl b/lib/ag_modules/type_select.pl
index 5e16693..35cfa66 100644
--- a/lib/ag_modules/type_select.pl
+++ b/lib/ag_modules/type_select.pl
@@ -2,8 +2,12 @@
 
 :- public amalgame_module/1.
 :- public parameter/4.
+:- public specifier/5.
 :- public selecter/5.
 
+:- use_module(library(option)).
+:- use_module(library(amalgame/vocabulary)).
+
 amalgame_module(amalgame:'TypeSelect').
 
 parameter(class, uri, '',
@@ -11,9 +15,13 @@ parameter(class, uri, '',
 parameter(mode, oneof([select, remove]), select,
 	  'select or remove concepts of this type').
 
-selecter(VocSpec, Sel, Dis, [], Options) :-
+specifier(VocSpec, Sel, Dis, none, Options) :-
 	option(mode(select), Options),
 	option(class(Class), Options),
 	Sel = and((VocSpec), type(Class)),
 	Dis = and((VocSpec), not(type(Class))).
 
+selecter(VocSpec, SelConcepts, DisConcepts, [], Options) :-
+	specifier(VocSpec, SelSpec, DisSpec, none, Options),
+	all_vocab_members(SelSpec, SelConcepts),
+	all_vocab_members(DisSpec, DisConcepts).
diff --git a/lib/ag_modules/voc_exclude.pl b/lib/ag_modules/voc_exclude.pl
index 5468474..845dceb 100644
--- a/lib/ag_modules/voc_exclude.pl
+++ b/lib/ag_modules/voc_exclude.pl
@@ -2,8 +2,11 @@
 
 :- public amalgame_module/1.
 :- public parameter/4.
+:- public specifier/5.
 :- public selecter/5.
 
+:- use_module(library(option)).
+:- use_module(library(amalgame/vocabulary)).
 
 amalgame_module(amalgame:'VocExclude').
 
@@ -12,11 +15,16 @@ parameter(type, oneof([source,target]), source,
 parameter(mode, oneof([select, remove]), select,
 	  'select or remove concepts of this type').
 
-selecter(VocSpec, Sel, Dis, [], Options) :-
+specifier(VocSpec, SelSpec, DisSpec, none, Options) :-
 	S =  and((VocSpec), not(is_mapped(Options))),
 	D =  and((VocSpec), is_mapped(Options)),
 	(   option(mode(select), Options, select)
-	->  Sel = S, Dis = D
-	;   Sel = D, Dis = S
+	->  SelSpec = S, DisSpec = D
+	;   SelSpec = D, DisSpec = S
 	).
 
+selecter(VocSpec, SelConcepts, DisConcepts, [], Options) :-
+	specifier(VocSpec, SelSpec, DisSpec, none, Options),
+	all_vocab_members(SelSpec, SelConcepts),
+	all_vocab_members(DisSpec, DisConcepts).
+