comparison import/Import.cpp @ 18:c8ef23d3888c classical-rdf

* Update for new Dataquay::Uri in preference to QUrl
author Chris Cannam
date Mon, 22 Feb 2010 14:18:30 +0000
parents d35e5d769c87
children c4cb65c436ef
comparison
equal deleted inserted replaced
17:06fcbfe2a6ed 18:c8ef23d3888c
307 307
308 foreach (QString s, c->nationality()) { 308 foreach (QString s, c->nationality()) {
309 other->addNationality(s); 309 other->addNationality(s);
310 } 310 }
311 311
312 foreach (QUrl s, c->geonameURIs()) { 312 foreach (Uri s, c->geonameURIs()) {
313 other->addGeonameURI(s); 313 other->addGeonameURI(s);
314 } 314 }
315 315
316 if (c->remarks() != "") other->setRemarks(c->remarks()); 316 if (c->remarks() != "") other->setRemarks(c->remarks());
317 if (c->period() != "") other->setPeriod(c->period()); 317 if (c->period() != "") other->setPeriod(c->period());
388 while (convSet.contains(conv)) { 388 while (convSet.contains(conv)) {
389 conv = QString("%1__%2").arg(initial).arg(i); 389 conv = QString("%1__%2").arg(initial).arg(i);
390 i++; 390 i++;
391 } 391 }
392 convSet.insert(conv); 392 convSet.insert(conv);
393 c->setProperty("uri", s->expand(":composer/" + conv)); 393 c->setProperty("uri", QVariant::fromValue(s->expand(":composer/" + conv)));
394 } 394 }
395 395
396 void 396 void
397 assignUri(Store *s, Work *w, Composer *c) 397 assignUri(Store *s, Work *w, Composer *c)
398 { 398 {
399 QString pfx = c->property("uri").toUrl().toString(); 399 QString pfx = c->property("uri").value<Uri>().toString();
400 DEBUG << "pfx = " << pfx << endl; 400 DEBUG << "pfx = " << pfx << endl;
401 if (!pfx.contains("composer/")) pfx = ":work/"; 401 if (!pfx.contains("composer/")) pfx = ":work/";
402 else { 402 else {
403 pfx.replace("composer/", "work/"); 403 pfx.replace("composer/", "work/");
404 pfx += "/"; 404 pfx += "/";
436 } 436 }
437 437
438 void 438 void
439 addDbpediaResource(Store *store, QObject *o, QString s) 439 addDbpediaResource(Store *store, QObject *o, QString s)
440 { 440 {
441 QUrl u = o->property("uri").toUrl(); 441 Uri u = o->property("uri").value<Uri>();
442 if (u == QUrl()) return; 442 if (u == Uri()) return;
443 if (s.startsWith("http://en.wikipedia.org/wiki/")) { 443 if (s.startsWith("http://en.wikipedia.org/wiki/")) {
444 store->add(Triple(u, 444 store->add(Triple(u,
445 "mo:wikipedia", 445 "mo:wikipedia",
446 QUrl(s))); 446 Uri(s)));
447 s.replace("http://en.wikipedia.org/wiki/", 447 s.replace("http://en.wikipedia.org/wiki/",
448 "http://dbpedia.org/resource/"); 448 "http://dbpedia.org/resource/");
449 store->add(Triple(u, 449 store->add(Triple(u,
450 "owl:sameAs", 450 "owl:sameAs",
451 QUrl(s))); 451 Uri(s)));
452 } 452 }
453 } 453 }
454 454
455 int main(int argc, char **argv) 455 int main(int argc, char **argv)
456 { 456 {
603 toStore.push_back(d); 603 toStore.push_back(d);
604 storedUris.insert(s); 604 storedUris.insert(s);
605 } 605 }
606 } 606 }
607 607
608 QString u = w->property("uri").toUrl().toString(); 608 QString u = w->property("uri").value<Uri>().toString();
609 if (u == "" || !storedUris.contains(u)) { 609 if (u == "" || !storedUris.contains(u)) {
610 toStore.push_back(w); 610 toStore.push_back(w);
611 if (u != "") storedUris.insert(u); 611 if (u != "") storedUris.insert(u);
612 } 612 }
613 } 613 }