diff rdf/RDFTransformFactory.cpp @ 493:3931711b5671

* RDF importer: add model titles where possible * RDF transform factory: report whether something appears to be RDF or not (so we can avoid trying to load it as something else if the RDF query fails)
author Chris Cannam
date Tue, 25 Nov 2008 13:43:56 +0000
parents 23945cdd7161
children 81963c51b488
line wrap: on
line diff
--- a/rdf/RDFTransformFactory.cpp	Mon Nov 24 16:26:11 2008 +0000
+++ b/rdf/RDFTransformFactory.cpp	Tue Nov 25 13:43:56 2008 +0000
@@ -39,6 +39,7 @@
     RDFTransformFactoryImpl(QString url);
     virtual ~RDFTransformFactoryImpl();
     
+    bool isRDF();
     bool isOK();
     QString getErrorString() const;
 
@@ -47,6 +48,7 @@
 protected:
     QString m_urlString;
     QString m_errorString;
+    bool m_isRDF;
     bool setOutput(Transform &, QString);
     bool setParameters(Transform &, QString);
 };
@@ -69,6 +71,12 @@
 }
 
 bool
+RDFTransformFactory::isRDF()
+{
+    return m_d->isRDF();
+}
+
+bool
 RDFTransformFactory::isOK()
 {
     return m_d->isOK();
@@ -87,7 +95,8 @@
 }
 
 RDFTransformFactoryImpl::RDFTransformFactoryImpl(QString url) :
-    m_urlString(url)
+    m_urlString(url),
+    m_isRDF(false)
 {
 }
 
@@ -97,6 +106,12 @@
 }
 
 bool
+RDFTransformFactoryImpl::isRDF()
+{
+    return m_isRDF;
+}
+
+bool
 RDFTransformFactoryImpl::isOK()
 {
     return (m_errorString == "");
@@ -137,6 +152,8 @@
         return transforms;
     }
 
+    m_isRDF = true;
+
     if (transformResults.empty()) {
         cerr << "RDFTransformFactory: NOTE: No RDF/TTL transform descriptions found in document at <" << m_urlString.toStdString() << ">" << endl;
         return transforms;
@@ -289,7 +306,7 @@
     }
 
     if (outputValue.type != SimpleSPARQLQuery::URIValue) {
-        m_errorString = "No vamp:output given, or not a URI";
+        m_errorString = QString("vamp:output given for transform <%1> is not a URI").arg(transformUri);
         return false;
     }
 
@@ -310,7 +327,7 @@
          "output_id");
     
     if (outputIdValue.type != SimpleSPARQLQuery::LiteralValue) {
-        m_errorString = "No output vamp:identifier available, or not a literal";
+        m_errorString = QString("No vamp:identifier found for output <%1>, or vamp:identifier is not a literal").arg(outputValue.value);
         return false;
     }