Skip to content

Commit c89b5b4

Browse files
author
Wouter Beek
committed
ADDED: Predicates for pulling in dereference data for drugbank IRIs.
1 parent 2c66432 commit c89b5b4

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

metis/metis.pl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
:- module(
22
metis,
33
[
4+
close_under_identity/0,
5+
close_under_identity/1, % +Iri:atom
46
show_graphs/0
57
]
68
).
@@ -12,12 +14,14 @@
1214
@version 2015/03
1315
*/
1416

17+
:- use_module(library(aggregate)).
1518
:- use_module(library(apply)).
1619
:- use_module(library(filesex)).
1720
:- use_module(library(http/http_dispatch)).
1821
:- use_module(library(http/http_json)).
1922
:- use_module(library(http/thread_httpd)).
2023
:- use_module(library(semweb/rdf_db)).
24+
:- use_module(library(semweb/rdf_http_plugin)).
2125
:- use_module(library(semweb/rdf_turtle)).
2226

2327
:- rdf_register_prefix(data, 'http://guidelines.data2semantics.org/data/').
@@ -36,6 +40,31 @@
3640

3741

3842

43+
%! close_under_identity is det.
44+
45+
close_under_identity:-
46+
aggregate_all(
47+
set(Link),
48+
(
49+
rdf_has(X, owl:sameAs, Link),
50+
rdf_global_id(data:_, X),
51+
rdf_global_id(drug:_, Link)
52+
),
53+
Links
54+
),
55+
maplist(close_under_identity, Links).
56+
57+
%! close_under_identity(+Iri:atom) is det.
58+
% Closes the given resource-denoting IRI under identity,
59+
% using the local `owl:sameAs` statements as seeds.
60+
61+
close_under_identity(Iri):-
62+
rdf_graph(Iri), !.
63+
close_under_identity(Iri):-
64+
rdf_load(Iri, [graph(Iri)]).
65+
66+
67+
3968
/* *********************************** */
4069
% Initialization/Loading functions
4170
init:-
@@ -55,7 +84,7 @@
5584
rdf_load0(File):-
5685
directory_file_path(_, LocalName, File),
5786
file_name_extension(Graph, _, LocalName),
58-
rdf_load(File, [format(turtle),graph(Graph)]).
87+
rdf_load(File, [format(turtle),graph(Graph),register_namespaces(true)]).
5988

6089
show_graphs:-
6190
forall(

0 commit comments

Comments
 (0)