changeset 450:d8a2c28ba9f6

* Query range before time (in case time component of range turns out to be synonymous with time component of time)
author Chris Cannam
date Tue, 07 Oct 2008 12:59:55 +0000
parents a75edaa08d28
children 3c5252e7cefd
files rdf/RDFImporter.cpp
diffstat 1 files changed, 14 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/rdf/RDFImporter.cpp	Tue Oct 07 12:42:17 2008 +0000
+++ b/rdf/RDFImporter.cpp	Tue Oct 07 12:59:55 2008 +0000
@@ -519,27 +519,23 @@
         QString label = SimpleSPARQLQuery::singleResultQuery
             (labelQueryString.arg(thinguri), "label").value;
 
-        QString timestring = SimpleSPARQLQuery::singleResultQuery
-            (timeQueryString.arg(thinguri), "time").value;
-
-        if (timestring != "") {
-
-            time = RealTime::fromXsdDuration(timestring.toStdString());
+        SimpleSPARQLQuery rangeQuery(rangeQueryString.arg(thinguri));
+        SimpleSPARQLQuery::ResultList rangeResults = rangeQuery.execute();
+        if (!rangeResults.empty()) {
+//                std::cerr << rangeResults.size() << " range results" << std::endl;
+            time = RealTime::fromXsdDuration
+                (rangeResults[0]["time"].value.toStdString());
+            duration = RealTime::fromXsdDuration
+                (rangeResults[0]["duration"].value.toStdString());
+//                std::cerr << "duration string " << rangeResults[0]["duration"].value.toStdString() << std::endl;
             haveTime = true;
-
+            haveDuration = true;
         } else {
-
-            SimpleSPARQLQuery rangeQuery(rangeQueryString.arg(thinguri));
-            SimpleSPARQLQuery::ResultList rangeResults = rangeQuery.execute();
-            if (!rangeResults.empty()) {
-//                std::cerr << rangeResults.size() << " range results" << std::endl;
-                time = RealTime::fromXsdDuration
-                    (rangeResults[0]["time"].value.toStdString());
-                duration = RealTime::fromXsdDuration
-                    (rangeResults[0]["duration"].value.toStdString());
-//                std::cerr << "duration string " << rangeResults[0]["duration"].value.toStdString() << std::endl;
+            QString timestring = SimpleSPARQLQuery::singleResultQuery
+                (timeQueryString.arg(thinguri), "time").value;
+            if (timestring != "") {
+                time = RealTime::fromXsdDuration(timestring.toStdString());
                 haveTime = true;
-                haveDuration = true;
             }
         }