amalgame/commit

ADDED: subtree facet selecter

authorJacco van Ossenbruggen
Sat Jun 22 21:40:03 2013 +0200
committerJacco van Ossenbruggen
Sat Jun 22 21:40:03 2013 +0200
commit04239e1d6870955f5951d211f689c73302c37b70
tree08d48db5d665b502dc38da16429d05b2b908dda0
parent0f2ac856d3d365fa264b2a3c7e00beed7fdc146f
Diff style: patch stat
diff --git a/config-available/ag_modules.pl b/config-available/ag_modules.pl
index 052957b..a8c2244 100644
--- a/config-available/ag_modules.pl
+++ b/config-available/ag_modules.pl
@@ -23,6 +23,7 @@
 
 % Vocabulary filters/selecters
 :- use_module(library(ag_modules/voc_exclude)).
+:- use_module(library(ag_modules/subtree_select)).
 :- use_module(library(ag_modules/type_select)).
 :- use_module(library(ag_modules/propvalue_select)).
 
diff --git a/lib/ag_modules/subtree_select.pl b/lib/ag_modules/subtree_select.pl
new file mode 100644
index 0000000..fe78753
--- /dev/null
+++ b/lib/ag_modules/subtree_select.pl
@@ -0,0 +1,22 @@
+:- module(subtree_select, []).
+
+:- public amalgame_module/1.
+:- public parameter/4.
+:- public selecter/3.
+
+amalgame_module(amalgame:'SubtreeSelect').
+
+parameter(parent, uri, '',
+'Concept that is the top concept of the subtree').
+parameter(mode, oneof([select, remove]), select, 'select or remove concepts from this subtree').
+
+% a bit naive at the moment: we simply change the query that should be
+% done.
+
+selecter(Scheme, and((Scheme), subtree(Parent)), Options) :-
+	option(mode(select), Options),
+	option(parent(Parent), Options).
+
+selecter(Scheme, and((Scheme), not(subtree(Parent))), Options) :-
+	option(mode(remove), Options),
+	option(parent(Parent), Options).
diff --git a/lib/amalgame/vocabulary.pl b/lib/amalgame/vocabulary.pl
index f16c092..13a4f80 100644
--- a/lib/amalgame/vocabulary.pl
+++ b/lib/amalgame/vocabulary.pl
@@ -32,6 +32,9 @@ vocab_member(E, graph(G)) :-
 vocab_member(E, propvalue(Property, Value)) :-
 	!,
 	rdf(E, Property, Value).
+vocab_member(E, subtree(Root)) :-
+	!,
+	rdf_reachable(E, skos:broader, Root).
 vocab_member(F, 'http://sws.geonames.org/') :-
 	!,
 	rdfs_individual_of(F, 'http://www.geonames.org/ontology#Feature').
@@ -58,3 +61,8 @@ vocab_member(E, Class) :-
 	rdfs_individual_of(Class, rdfs:'Class'),
 	!,
 	rdfs_individual_of(E, Class).
+
+
+
+
+
diff --git a/rdf/tool/ag_modules.ttl b/rdf/tool/ag_modules.ttl
index 779e26c..a2a8b2d 100644
--- a/rdf/tool/ag_modules.ttl
+++ b/rdf/tool/ag_modules.ttl
@@ -101,7 +101,12 @@ amalgame:TypeSelect
 
 amalgame:PropertyValueSelect
     rdfs:label "select facet on property/value"@en ;
-    skos:definition "Select from a vocabulary the concepts property/value."@en ;
+    skos:definition "Select from a vocabulary the concepts with a specific property/value."@en ;
+    rdfs:subClassOf amalgame:VocabSelecter .
+
+amalgame:SubtreeSelect
+    rdfs:label "select facet by subtree"@en ;
+    skos:definition "Select from a vocabulary the concepts in the sub-tree below (using BT/NT) a common parent concept."@en ;
     rdfs:subClassOf amalgame:VocabSelecter .
 
 amalgame:OverlapComponent