Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

catalogs

  • Loading branch information...
commit cf04981399a79552b90611b3010a27cd8681b8a3 1 parent b92aa76
@cmungall cmungall authored
Showing with 32 additions and 2 deletions.
  1. +2 −0  bin/thea-owl-i
  2. +30 −2 owl2_catalog.pl
View
2  bin/thea-owl-i
@@ -5,6 +5,7 @@
:- use_module(library('thea2/swrl_rdf_hooks')).
:- use_module(library('thea2/swrl')).
:- use_module(library('thea2/owl2_io')).
+:- use_module(library('thea2/owl2_catalog')).
main :-
current_prolog_flag(argv, Arguments),
@@ -77,4 +78,5 @@ parse_arg(['--use-labels'|L],L,goal(use_labels_for_IRIs)).
parse_arg(['--use-safe-labels'|L],L,goal(use_safe_labels_for_IRIs)).
parse_arg(['--goal',GA|L],L,goal(G)) :- atom_to_term(GA,G,_).
parse_arg(['--query',GA|L],L,query(T,G)) :- atom_to_term(GA,G-T,_).
+parse_arg(['--load-catalog'|L],L,null) :- load_catalog.
View
32 owl2_catalog.pl
@@ -1,10 +1,24 @@
% * -*- Mode: Prolog -*- */
:- module(owl2_catalog,
- []).
+ [
+ register_ontology_localpath/2,
+ save_catalog/0,
+ save_catalog/1,
+ load_catalog/0,
+ load_catalog/1
+ ]).
:- use_module(library(sgml)).
+:- dynamic ontology_localpath/2.
+
+register_ontology_localpath(URL,Local) :-
+ retractall(ontology_localpath(URL,Local)),
+ assert(ontology_localpath(URL,Local)).
+
+owl2_from_rdf:owl_repository_hook(URL,Local) :-
+ ontology_localpath(URL,Local).
owl2_from_rdf:owl_repository_hook(URL,Local) :-
exists_file('catalog.xml'),
url_local(URL,Local).
@@ -15,4 +29,18 @@
member(element(_,[name=URL,local=Local],_),Elts),
atom_concat(Base,Local,LocalExpanded).
-
+save_catalog :-
+ save_catalog('catalog.pl').
+
+save_catalog(F) :-
+ tell(F),
+ forall(ontology_localpath(A,B),
+ format('~q.~n',[ontology_localpath(A,B)])),
+ told.
+
+load_catalog :-
+ load_catalog('catalog.pl').
+
+load_catalog(F) :-
+ consult(F).
+
Please sign in to comment.
Something went wrong with that request. Please try again.