comparison import/Import.cpp @ 2:ff067a1e7e3d classical-rdf

* work on conductors etc
author Chris Cannam
date Fri, 04 Dec 2009 17:24:22 +0000
parents 29ca5974905d
children 62324586b8d0
comparison
equal deleted inserted replaced
1:29ca5974905d 2:ff067a1e7e3d
424 void 424 void
425 assignUri(Store *s, Work *w, Composer *c) 425 assignUri(Store *s, Work *w, Composer *c)
426 { 426 {
427 QString pfx = c->property("uri").toUrl().toString(); 427 QString pfx = c->property("uri").toUrl().toString();
428 DEBUG << "pfx = " << pfx << endl; 428 DEBUG << "pfx = " << pfx << endl;
429 if (!pfx.contains("composer/")) pfx = ""; 429 if (!pfx.contains("composer/")) pfx = ":work/";
430 else {
431 pfx.replace("composer/", "work/");
432 pfx += "/";
433 }
430 434
431 static QSet<QString> convSet; 435 static QSet<QString> convSet;
432 436
433 QString conv = w->catalogue(); 437 QString conv = w->catalogue();
434 if (conv == "") conv = w->opus(); 438 if (conv == "") conv = w->opus();
440 conv.replace(" ", "_"); 444 conv.replace(" ", "_");
441 conv.replace("-", "_"); 445 conv.replace("-", "_");
442 conv.replace(":", "_"); 446 conv.replace(":", "_");
443 conv.replace(QRegExp("[^a-zA-Z0-9_-]"), ""); 447 conv.replace(QRegExp("[^a-zA-Z0-9_-]"), "");
444 448
445 if (pfx != "") conv = pfx + "/work/" + conv; 449 if (pfx != "") conv = pfx + conv;
446 450
447 // I think actually for works we want to merge duplicates rather than 451 // I think actually for works we want to merge duplicates rather than
448 // assign them separate URIs, _unless_ they lack a viable opus number 452 // assign them separate URIs, _unless_ they lack a viable opus number
449 if (!hasOpus) { 453 if (!hasOpus) {
450 QString initial = conv; 454 QString initial = conv;
768 std::cerr << "Caught RDF exception: " << e.what() << std::endl; 772 std::cerr << "Caught RDF exception: " << e.what() << std::endl;
769 } 773 }
770 774
771 DEBUG << "Stored, now saving" << endl; 775 DEBUG << "Stored, now saving" << endl;
772 776
773 outstore->save("test-out.ttl"); 777 outstore->save("imported.ttl");
774 778
775 DEBUG << "Saved" << endl; 779 DEBUG << "Saved" << endl;
776 780
777 781
778 QMultiMap<QString, Composer *> cmap; 782 QMultiMap<QString, Composer *> cmap;