Daniel@0: /* Part of DML (Digital Music Laboratory) Daniel@0: Copyright 2014-2015 Samer Abdallah, University of London Daniel@0: Daniel@0: This program is free software; you can redistribute it and/or Daniel@0: modify it under the terms of the GNU General Public License Daniel@0: as published by the Free Software Foundation; either version 2 Daniel@0: of the License, or (at your option) any later version. Daniel@0: Daniel@0: This program is distributed in the hope that it will be useful, Daniel@0: but WITHOUT ANY WARRANTY; without even the implied warranty of Daniel@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Daniel@0: GNU General Public License for more details. Daniel@0: Daniel@0: You should have received a copy of the GNU General Public Daniel@0: License along with this library; if not, write to the Free Software Daniel@0: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Daniel@0: */ Daniel@0: Daniel@0: :- module(dml_data, Daniel@0: [ p2r_import/1 Daniel@0: , humdrum_import/1 Daniel@0: , load_everything/0 Daniel@0: , hum_uri_path/2 Daniel@0: , not_functional/3 Daniel@0: , rdf_pair/4 Daniel@0: ]). Daniel@0: Daniel@0: :- use_module(library(semweb/rdf_db)). Daniel@0: :- use_module(library(semweb/rdf_zlib_plugin)). Daniel@0: :- use_module(library(mo_schema)). Daniel@0: :- use_module(library(dbpedia)). Daniel@0: :- use_module(library(humdrum_p2r)). Daniel@0: :- use_module(library(beets_p2r)). Daniel@0: :- use_module(library(memo_p2r)). Daniel@0: :- use_module(library(bl_p2r)). Daniel@0: :- use_module(library(ilm_p2r)). Daniel@0: :- use_module(library(charm_p2r)). Daniel@0: :- use_module(library(mazurka_p2r)). Daniel@0: :- use_module(library(vamp)). Daniel@0: :- use_module(library(termutils)). Daniel@0: :- use_module(library(p2r)). Daniel@0: :- use_module(entailment(p2r)). Daniel@0: Daniel@0: Daniel@0: load_everything :- Daniel@0: maplist(p2r_import,[humdrum_p2r,memo_p2r,beets_p2r,bl_p2r,charm_p2r,vamp]). Daniel@0: Daniel@0: :- meta_predicate not_functional(2,-,-). Daniel@0: Daniel@0: not_functional(G,X,Ys) :- Daniel@0: writeln('Compiling...'), Daniel@0: setof(X-Y,call(G,X,Y),Pairs), Daniel@0: writeln('Grouping...'), Daniel@0: group_pairs_by_key(Pairs,Grouped), Daniel@0: writeln('Checking...'), Daniel@0: Ys=[_,_|_], member(X-Ys,Grouped). Daniel@0: Daniel@0: :- rdf_meta rdf_pair(r,r,o,o). Daniel@0: rdf_pair(P1,P2,X1,X2) :- Daniel@0: rdf(Y,P1,X1), Daniel@0: rdf(Y,P2,X2). Daniel@0: Daniel@0: :- rdf_meta assert_subproperty(r,r). Daniel@0: Daniel@0: %% assert_subproperty(P1,P2) is det. Daniel@0: % Asserts that P1 is a sub-property of P2. Daniel@0: assert_subproperty(P1,P2) :- rdf_assert(P1,rdfs:subPropertyOf,P2). Daniel@0: Daniel@0: rdf_assertions :- Daniel@0: rdf_assert(event:sub_event,rdf:type,owl:'TransitiveProperty'), Daniel@0: assert_subproperty(charm:composer,dml:composer), Daniel@0: assert_subproperty(hum:'refcode/COM',dml:composer), Daniel@0: assert_subproperty(charm:title,dml:title), Daniel@0: assert_subproperty(charm:performer,dml:performer), Daniel@0: assert_subproperty(marcrel:cmp,dml:composer), Daniel@0: assert_subproperty(marcrel:prf,dml:performer), Daniel@0: assert_subproperty(beets:title,dml:title), Daniel@0: assert_subproperty(beets:composer,dml:composer), Daniel@0: assert_subproperty(dc:title,dml:title). Daniel@0: Daniel@0: rdf_loads :- Daniel@0: rdf_load(rdf('silvet.n3')), Daniel@0: % rdf_load('http://id.loc.gov/vocabulary/relators'), Daniel@0: % rdf_load(['http://id.loc.gov/vocabulary/countries.rdf','http://id.loc.gov/vocabulary/languages.rdf'], [register_namespaces(true)]). Daniel@0: rdf_load('http://purl.org/ontology/vamp/',[register_namespaces(true)]), Daniel@0: rdf_load('http://vamp-plugins.org/rdf/plugins/qm-vamp-plugins'), Daniel@0: rdf_load('http://vamp-plugins.org/rdf/plugins/nnls-chroma'), Daniel@0: rdf_load('http://vamp-plugins.org/rdf/plugins/beatroot-vamp'). Daniel@0: Daniel@0: :- initialization rdf_assertions. Daniel@0: %:- initialization rdf_loads. Daniel@0: