accurator/commit

Added code for adding resources to a concept scheme based on their type.

authorChris Dijkshoorn
Mon Mar 30 14:35:28 2015 +0100
committerChris Dijkshoorn
Mon Mar 30 14:35:28 2015 +0100
commit0c7f4042e82197d1a1662010bf0607daa99d5c9d
tree5f16447217b951ea8ab78792e5914872a5b52de7
parentb611d8c77cb715f302825804b8b536b719c236e2
Diff style: patch stat
diff --git a/lib/accurator/concept_scheme_selection.pl b/lib/accurator/concept_scheme_selection.pl
index 8f1e43a..f169de1 100644
--- a/lib/accurator/concept_scheme_selection.pl
+++ b/lib/accurator/concept_scheme_selection.pl
@@ -1,10 +1,14 @@
-:- module(concept_scheme_selection, [iconclass_code_concept_scheme/3]).
+:- module(concept_scheme_selection, [iconclass_code_concept_scheme/3,
+									 type_concept_scheme/3]).
 
 /** <module> Concept scheme selection for auto completion
 */
 :- use_module(library(semweb/rdf_db)).
 :- use_module(library(semweb/rdf_turtle_write)).
 
+:- rdf_register_prefix(bibleontology, 'http://bibleontology.com/resource/').
+
+
 %%	iconclass_code_concept_scheme(+Code, +ConceptScheme, +FileName)
 %
 %	Adds a subset of the iconclass codes to a concept scheme, so it can
@@ -26,6 +30,26 @@ find_codes(ICCode, Codes) :-
 	debug(concept_scheme, 'Number of codes of ~p or lower: ~p',
 		  [ICCode, NumberCodes]).
 
+%%	type_concept_scheme(+Type, +ConceptScheme, +FileName)
+%
+%	Adds the specified type to a concept scheme.
+%type_concept_scheme('http://bibleontology.com/class/Biblical_Figures', 'http://accurator.nl/bible#BiblicalFigureConceptScheme', 'concept_scheme_bible_figure.ttl').
+type_concept_scheme(Type, ConceptScheme, FileName) :-
+	%find all works with class or sublcass of specified code
+	find_type(Type, Uris),
+	save_concept_scheme(Uris, ConceptScheme, FileName).
+
+%%	find_type(+Type, -Uris)
+%
+%	Retrieve all uris of type Type
+find_type(Type, Uris) :-
+	findall(Uri,
+			rdf(Uri, rdf:type, Type),
+			Uris),
+	length(Uris, NumberUris),
+	debug(concept_scheme, 'Number of uris of type ~p: ~p',
+		  [Type, NumberUris]).
+
 %%	save_concept_scheme(Uris, ConceptScheme, FileName)
 %
 %	Assert triples linking uris to conceptschemes and save these triples