Mercurial > hg > dml-open-cliopatria
comparison cpack/dml/applications/dml_overview.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_overview, []). | |
20 | |
21 /** <module> DML Overview pages | |
22 */ | |
23 | |
24 :- use_module(library(http/html_write)). | |
25 :- use_module(library(http/html_head)). | |
26 :- use_module(library(http/http_dispatch)). | |
27 :- use_module(library(semweb/rdf_db)). | |
28 :- use_module(library(dcg_core)). | |
29 :- use_module(library(rdfutils)). | |
30 :- use_module(library(httpfiles),[reply_html_page/4]). | |
31 % :- use_module(components(score)). | |
32 % :- use_module(api(score)). | |
33 | |
34 :- set_prolog_flag(double_quotes,string). | |
35 | |
36 :- http_handler(root(dml/overview/top), dml_overview, []). | |
37 | |
38 dml_overview(_Request) :- | |
39 rdf(Rec,beets:title,literal(substring('I want to talk about you'),_)), | |
40 reply_html_page(cliopatria(demo), [title("DML Overview")], | |
41 [ html_post(head,style( ["h2 { margin-top:1em }"])) | |
42 , h1("Digital Music Lab Overview") | |
43 , h2("Knowledge representation: relational models and RDF") | |
44 , h2("Exploring the collections") | |
45 , p([ "The music libraries are organised in to 'graphs' (RDF sub-databases) on the basis of their origin. " | |
46 , "One way to explore them is to start from the page for each graph, and examine the predicates and classes " | |
47 , "the use to describe their content. For example, one can browse a list of values of the 'charm:composer' " | |
48 , "predicate and from their find recordings that have particular values of that property."]) | |
49 , p(\ll(list_predicates,[graph(bl_p2r)],"Predicates in the British Library recordings graph")) | |
50 , \ll(list_predicates,[graph(charm_p2r)],"Predicates CHARM collection graph") | |
51 % , p("The CHARM collection contains works by many composers. This pie chart shows the top 25 composer by number of recordings.") | |
52 % , \charm_composers_plot | |
53 , h2("The semantic web") | |
54 , p([ "DML can follow Musicbrainz URIs to retrieve information from the Linkedbrainz SPARQL endpoint and " | |
55 , "the Musicbrainz XML web service. Information from Linkedbrainz is already in Music Ontology format, " | |
56 , "but information from Musicbrainz is reorganised on import to conform to the Music Ontology's schema " | |
57 , "of events to describe composition, recordinging, and other music related data." ]) | |
58 , p(\ll(list_resource,[r(Rec)],"A recording with Musicbrainz links.")) | |
59 , h2("Symbolic scores") | |
60 , p("The database includes symbolic scores in Humdrum/Kern format obtained from the KernScores website.") | |
61 , p(\ll(list_predicate_resources,[side=object,graph=humdrum_p2r,predicate='http://dml.org/humdrum/schema/refcode/COM'],"Humdrum scores by Bach")) | |
62 , h2("Computation and memoisation") | |
63 , \ll(list_instances,[graph=memo_p2r,class='http://dml.org/memo/Function'],"Memoised functions") | |
64 , h2("SWISH: collaborative web-based Prolog") | |
65 , p([ "DML embeds a SWISH server to provide a web-based Prolog programming environment with access to the " | |
66 , "DML database and analsis functions, as well as facilities for visualising results and collaborative development." ]) | |
67 , p(html(a(href('/cp/swish/p/c3examples.swinb#'),"Music library statistics visualised using C3 graphics"))) | |
68 ], | |
69 [stable]). | |
70 | |
71 ll(ID,Params,HTML) --> line(\link(ID,Params,HTML)). | |
72 link(ID,Params,HTML) --> | |
73 {http_link_to_id(ID,Params,Link)}, | |
74 html(a(href(Link),HTML)). | |
75 | |
76 line(HTML) --> html(HTML), html(br([])). | |
77 | |
78 :- rdf_meta collection_property_hist(+,r,+,-). | |
79 collection_property_hist(Coll,P,Min,c3{data:_{columns:Pairs, type:pie}}) :- | |
80 setof([C,N], (collection_property_value_count(Coll,P,literal(C),N),N>Min), Pairs). | |
81 | |
82 collection_property_value_count(Collection,Property,Value,Count) :- | |
83 aggregate(count, R^(collection(Collection,R), rdf_has(R,Property,Value)), Count). | |
84 | |
85 collection(charm,X) :- rdf(X,charm:file_name,_). | |
86 collection(bl,X) :- rdf(X,rdf:type,mo:'Signal',bl_p2r). | |
87 | |
88 charm_composers_plot --> | |
89 {swish_render:renderer(c3,C3Mod,_)}, | |
90 {collection_property_hist(charm,dml:composer,25,Pairs)}, | |
91 % !!! This is not working. | |
92 C3Mod:term_rendering(Pairs,_,[]). | |
93 |