OldWiki » History » Version 3

Chris Cannam, 2012-08-08 09:42 AM

1 1 Chris Cannam
h1. Classical Composers and RDF
2 1 Chris Cannam
3 1 Chris Cannam
*This is an old wiki page from 2009, archived here*
4 1 Chris Cannam
5 1 Chris Cannam
This is where we make feature requests and comments regarding Cannam's Canon - Chris Cannam's RDF-based software Opus.
6 1 Chris Cannam
7 1 Chris Cannam
h3. SPARQL DBpedia
8 1 Chris Cannam
9 3 Chris Cannam
You can find a query using skos to get all the "classical composers" from DBpedia "here":http://dbpedia.org/snorql/?query=SELECT+%3Fcomp%0D%0AWHERE+{%0D%0A+%3Ftype+skos%3Abroader+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FCategory%3AClassical_composers%3E+.%0D%0A+%3Fcomp+skos%3Asubject+%3Ftype+.%0D%0A}%0D%0A .
10 1 Chris Cannam
11 1 Chris Cannam
<pre>
12 1 Chris Cannam
  PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
13 1 Chris Cannam
  SELECT ?comp
14 1 Chris Cannam
  WHERE {
15 1 Chris Cannam
   ?type skos:broader <http://dbpedia.org/resource/Category:Classical_composers>
16 1 Chris Cannam
 .
17 1 Chris Cannam
   ?comp skos:subject ?type .
18 1 Chris Cannam
  }
19 1 Chris Cannam
</pre>
20 1 Chris Cannam
21 1 Chris Cannam
Note this returns 6703 composers.
22 1 Chris Cannam
23 1 Chris Cannam
h2. What stuff can be drawn straight from DBpedia?
24 1 Chris Cannam
25 1 Chris Cannam
**Composers** -- Sort of.  I'm drawing these from a few different sources at the
26 1 Chris Cannam
 moment, partly because I liked the "surname, first names" ordering used in one 
27 1 Chris Cannam
source, I wanted to pull in a number of spelling variants at once for text search purposes, etc.  (For popular composers wikipedia/dbpedia does a good job of that last one though -- I particularly like http://dbpedia.org/resource/Woflgang_amadeus_mozart)
28 1 Chris Cannam
29 1 Chris Cannam
But, it does seem to be the case that almost all that composers we're "interested in" have Wikipedia pages and so at least potential DBpedia URIs.  Should we use those instead of generated URIs plus owl:sameAs?  Possibly.  One annoyance is that a DBpedia URI doesn't give us the nice "human namespace" hint that this is 
30 1 Chris Cannam
a classical composer, so I would prefer to have some more direct association made between the URI and "a composer" than the DBpedia categorisation currently gives us.  That annoyance may be a symptom of a deeper problem of expression for us.
31 1 Chris Cannam
32 1 Chris Cannam
**Works** -- No.  If a composer has a reasonably complete opus listing or catalogue, we want to import all of it, not just those works that happen to have Wikipedia pages.  This generally means reading the Wikipedia list pages for a compose
33 1 Chris Cannam
r's works, which are often fairly complete, rather than querying works that have
34 1 Chris Cannam
 pages of their own.  (A lot of works that appear in Wikipedia don't seem to have corresponding DBpedia resources yet either, which means we wouldn't easily be 
35 1 Chris Cannam
able to query them that way.)  We can't generate DBpedia URIs for works that are
36 1 Chris Cannam
 not yet in Wikipedia, because that would mean anticipating (in code) the editor
37 1 Chris Cannam
ial decisions of Wikipedia editors.
38 1 Chris Cannam
39 1 Chris Cannam
**Orchestras and Performers** -- Generally yes, e.g. analogous to composer query
40 1 Chris Cannam
 above,
41 1 Chris Cannam
42 1 Chris Cannam
<pre>
43 1 Chris Cannam
  SELECT ?c
44 1 Chris Cannam
  WHERE {
45 1 Chris Cannam
   ?type skos:broader <http://dbpedia.org/resource/Category:Conductors_by_nationality> .
46 1 Chris Cannam
   ?c skos:subject ?type .
47 1 Chris Cannam
  }
48 1 Chris Cannam
</pre>
49 1 Chris Cannam
50 1 Chris Cannam
(1867 results).  The same thing for Orchestras_by_nationality gives 390 results 
51 1 Chris Cannam
(though this certainly doesn't include all the orchestras found in Wikipedia), and Classical_pianists_by_nationality gives 1397 (note the apparently more general "Pianists_by_nationality" omits many famous classical pianists and gives fewer
52 1 Chris Cannam
 results).
53 1 Chris Cannam
54 1 Chris Cannam
h2. What can we query from e.g. MusicBrainz?
55 1 Chris Cannam
56 1 Chris Cannam
Should we start by looking up e.g. "all 'tracks' by Ludwig van Beethoven" and seeing just how bad it is?
57 2 Chris Cannam
"Count tracks by LvB in SNORQL interface":http://dbtune.org/musicbrainz/snorql/?query=select+count%28%3Fc%29+where+{%0D%0A%3Fa+foaf%3Aname+%22Ludwig+van+Beethoven%22.%0D%0A%3Fb+foaf%3Amaker+%3Fa%3B%0D%0A+a+mo%3ATrack%3B%0D%0A+dc%3Atitle+%3Fc%3B%0D%0A}&prefixes=PREFIX+map%3A+%3Cfile%3A%2Fhome%2Fmoustaki%2Fwork%2Fmotools%2Fmusicbrainz%2Fd2r-server-0.4%2Fmbz_mapping_raw.n3%23%3E%0D%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+owl%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%0D%0APREFIX+event%3A+%3Chttp%3A%2F%2Fpurl.org%2FNET%2Fc4dm%2Fevent.owl%23%3E%0D%0APREFIX+rel%3A+%3Chttp%3A%2F%2Fpurl.org%2Fvocab%2Frelationship%2F%3E%0D%0APREFIX+lingvoj%3A+%3Chttp%3A%2F%2Fwww.lingvoj.org%2Fontology%23%3E%0D%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+tags%3A+%3Chttp%3A%2F%2Fwww.holygoat.co.uk%2Fowl%2Fredwood%2F0.1%2Ftags%2F%3E%0D%0APREFIX+db%3A+%3Chttp%3A%2F%2Fdbtune.org%2Fmusicbrainz%2Fresource%2F%3E%0D%0APREFIX+geo%3A+%3Chttp%3A%2F%2Fwww.geonames.org%2Fontology%23%3E%0D%0APREFIX+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%0D%0APREFIX+bio%3A+%3Chttp%3A%2F%2Fpurl.org%2Fvocab%2Fbio%2F0.1%2F%3E%0D%0APREFIX+mo%3A+%3Chttp%3A%2F%2Fpurl.org%2Fontology%2Fmo%2F%3E%0D%0APREFIX+vocab%3A+%3Chttp%3A%2F%2Fdbtune.org%2Fmusicbrainz%2Fresource%2Fvocab%2F%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0APREFIX+mbz%3A+%3Chttp%3A%2F%2Fpurl.org%2Fontology%2Fmbz%23%3E%0D%0A -- says "1000" (soft limit reached?) -- how many of these can be mechanically mapped onto our own "works" data?
58 1 Chris Cannam
59 2 Chris Cannam
There looks to be some scope for querying things like orchestras using the DBtune MusicBrainz interface, but it's giving me some rather strange results.  For example SELECT COUNT(?a) WHERE { ?a a mo:ChamberOrchestra } returns 818 results -- apparently including all orchestras, not just chamber orchestras -- while searches for mo:Orchestra or mo:SymphonyOrchestra (both apparently supported classes) return nothing.  Where did these data come from?