Mercurial > hg > svcore
comparison rdf/RDFTransformFactory.cpp @ 1172:59ae7e04f7e9
Merge
author | Chris Cannam |
---|---|
date | Fri, 04 Mar 2016 12:29:35 +0000 |
parents | d094598f84bd |
children |
comparison
equal
deleted
inserted
replaced
1171:fa1bec83441e | 1172:59ae7e04f7e9 |
---|---|
127 } else { | 127 } else { |
128 qurl = QUrl::fromLocalFile(url); | 128 qurl = QUrl::fromLocalFile(url); |
129 } | 129 } |
130 m_store->import(qurl, BasicStore::ImportIgnoreDuplicates); | 130 m_store->import(qurl, BasicStore::ImportIgnoreDuplicates); |
131 m_isRDF = true; | 131 m_isRDF = true; |
132 } catch (...) { } | 132 } catch (const std::exception &e) { |
133 // The file is not RDF -- we report this by returning false | |
134 // from isRDF (because we have not reached the m_isRDF = true | |
135 // line above), but we also set the error string | |
136 m_errorString = e.what(); | |
137 } | |
133 } | 138 } |
134 | 139 |
135 RDFTransformFactoryImpl::~RDFTransformFactoryImpl() | 140 RDFTransformFactoryImpl::~RDFTransformFactoryImpl() |
136 { | 141 { |
137 delete m_store; | 142 delete m_store; |
144 } | 149 } |
145 | 150 |
146 bool | 151 bool |
147 RDFTransformFactoryImpl::isOK() | 152 RDFTransformFactoryImpl::isOK() |
148 { | 153 { |
149 return (m_errorString == ""); | 154 return m_isRDF && (m_errorString == ""); |
150 } | 155 } |
151 | 156 |
152 QString | 157 QString |
153 RDFTransformFactoryImpl::getErrorString() const | 158 RDFTransformFactoryImpl::getErrorString() const |
154 { | 159 { |
158 std::vector<Transform> | 163 std::vector<Transform> |
159 RDFTransformFactoryImpl::getTransforms(ProgressReporter *) | 164 RDFTransformFactoryImpl::getTransforms(ProgressReporter *) |
160 { | 165 { |
161 std::vector<Transform> transforms; | 166 std::vector<Transform> transforms; |
162 | 167 |
168 if (!m_isRDF) return transforms; | |
169 | |
163 std::map<QString, Transform> uriTransformMap; | 170 std::map<QString, Transform> uriTransformMap; |
164 | 171 |
165 Nodes tnodes = m_store->match | 172 Nodes tnodes = m_store->match |
166 (Triple(Node(), Uri("a"), m_store->expand("vamp:Transform"))).subjects(); | 173 (Triple(Node(), Uri("a"), m_store->expand("vamp:Transform"))).subjects(); |
167 | 174 |