comparison cpack/dml/lib/dml_data.pl @ 0:718306e29690 tip

commiting public release
author Daniel Wolff
date Tue, 09 Feb 2016 21:05:06 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:718306e29690
1 /* Part of DML (Digital Music Laboratory)
2 Copyright 2014-2015 Samer Abdallah, University of London
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 :- module(dml_data,
20 [ p2r_import/1
21 , humdrum_import/1
22 , load_everything/0
23 , hum_uri_path/2
24 , not_functional/3
25 , rdf_pair/4
26 ]).
27
28 :- use_module(library(semweb/rdf_db)).
29 :- use_module(library(semweb/rdf_zlib_plugin)).
30 :- use_module(library(mo_schema)).
31 :- use_module(library(dbpedia)).
32 :- use_module(library(humdrum_p2r)).
33 :- use_module(library(beets_p2r)).
34 :- use_module(library(memo_p2r)).
35 :- use_module(library(bl_p2r)).
36 :- use_module(library(ilm_p2r)).
37 :- use_module(library(charm_p2r)).
38 :- use_module(library(mazurka_p2r)).
39 :- use_module(library(vamp)).
40 :- use_module(library(termutils)).
41 :- use_module(library(p2r)).
42 :- use_module(entailment(p2r)).
43
44
45 load_everything :-
46 maplist(p2r_import,[humdrum_p2r,memo_p2r,beets_p2r,bl_p2r,charm_p2r,vamp]).
47
48 :- meta_predicate not_functional(2,-,-).
49
50 not_functional(G,X,Ys) :-
51 writeln('Compiling...'),
52 setof(X-Y,call(G,X,Y),Pairs),
53 writeln('Grouping...'),
54 group_pairs_by_key(Pairs,Grouped),
55 writeln('Checking...'),
56 Ys=[_,_|_], member(X-Ys,Grouped).
57
58 :- rdf_meta rdf_pair(r,r,o,o).
59 rdf_pair(P1,P2,X1,X2) :-
60 rdf(Y,P1,X1),
61 rdf(Y,P2,X2).
62
63 :- rdf_meta assert_subproperty(r,r).
64
65 %% assert_subproperty(P1,P2) is det.
66 % Asserts that P1 is a sub-property of P2.
67 assert_subproperty(P1,P2) :- rdf_assert(P1,rdfs:subPropertyOf,P2).
68
69 rdf_assertions :-
70 rdf_assert(event:sub_event,rdf:type,owl:'TransitiveProperty'),
71 assert_subproperty(charm:composer,dml:composer),
72 assert_subproperty(hum:'refcode/COM',dml:composer),
73 assert_subproperty(charm:title,dml:title),
74 assert_subproperty(charm:performer,dml:performer),
75 assert_subproperty(marcrel:cmp,dml:composer),
76 assert_subproperty(marcrel:prf,dml:performer),
77 assert_subproperty(beets:title,dml:title),
78 assert_subproperty(beets:composer,dml:composer),
79 assert_subproperty(dc:title,dml:title).
80
81 rdf_loads :-
82 rdf_load(rdf('silvet.n3')),
83 % rdf_load('http://id.loc.gov/vocabulary/relators'),
84 % rdf_load(['http://id.loc.gov/vocabulary/countries.rdf','http://id.loc.gov/vocabulary/languages.rdf'], [register_namespaces(true)]).
85 rdf_load('http://purl.org/ontology/vamp/',[register_namespaces(true)]),
86 rdf_load('http://vamp-plugins.org/rdf/plugins/qm-vamp-plugins'),
87 rdf_load('http://vamp-plugins.org/rdf/plugins/nnls-chroma'),
88 rdf_load('http://vamp-plugins.org/rdf/plugins/beatroot-vamp').
89
90 :- initialization rdf_assertions.
91 %:- initialization rdf_loads.
92