comparison rdf/PluginRDFDescription.cpp @ 1843:3ec563af0a4f

Retrieve download URL, download type, and "pack" information
author Chris Cannam
date Fri, 17 Apr 2020 17:45:34 +0100
parents e802e550a1f2
children 5b1b03c1d8d4
comparison
equal deleted inserted replaced
1842:19fa7bf208d8 1843:3ec563af0a4f
82 PluginRDFDescription::getPluginInfoURL() const 82 PluginRDFDescription::getPluginInfoURL() const
83 { 83 {
84 return m_pluginInfoURL; 84 return m_pluginInfoURL;
85 } 85 }
86 86
87 QString
88 PluginRDFDescription::getPluginDownloadURL() const
89 {
90 return m_pluginDownloadURL;
91 }
92
93 std::set<PluginRDFDescription::DownloadType>
94 PluginRDFDescription::getPluginDownloadTypes() const
95 {
96 return m_pluginDownloadTypes;
97 }
98
99 std::map<QString, PluginRDFDescription::Pack>
100 PluginRDFDescription::getPluginFoundInPacks() const
101 {
102 return m_pluginFoundInPacks;
103 }
104
87 QStringList 105 QStringList
88 PluginRDFDescription::getOutputIds() const 106 PluginRDFDescription::getOutputIds() const
89 { 107 {
90 QStringList ids; 108 QStringList ids;
91 for (OutputDispositionMap::const_iterator i = m_outputDispositions.begin(); 109 for (OutputDispositionMap::const_iterator i = m_outputDispositions.begin();
215 233
216 if (n.type == Node::URI && n.value != "") { 234 if (n.type == Node::URI && n.value != "") {
217 m_pluginInfoURL = n.value; 235 m_pluginInfoURL = n.value;
218 } 236 }
219 237
220 n = index->complete 238 Node libn = index->complete
221 (Triple(Node(), index->expand("vamp:available_plugin"), plugin)); 239 (Triple(Node(), index->expand("vamp:available_plugin"), plugin));
222 240
223 if (n.value != "") { 241 if (libn.value != "") {
224 n = index->complete(Triple(n, index->expand("foaf:page"), Node())); 242
243 n = index->complete
244 (Triple(libn, index->expand("foaf:page"), Node()));
245 if (n.type == Node::URI && n.value != "" && m_pluginInfoURL == "") {
246 m_pluginInfoURL = n.value;
247 }
248
249 // And the download page for the library
250 n = index->complete
251 (Triple(libn, index->expand("doap:download-page"), Node()));
252
225 if (n.type == Node::URI && n.value != "") { 253 if (n.type == Node::URI && n.value != "") {
226 m_pluginInfoURL = n.value; 254
227 } 255 m_pluginDownloadURL = n.value;
228 } 256
229 257 n = index->complete
258 (Triple(libn, index->expand("vamp:has_source"), Node()));
259 if (n.type == Node::Literal && n.value == "true") {
260 m_pluginDownloadTypes.insert(DownloadSourceCode);
261 }
262
263 Nodes binaries = index->match
264 (Triple(libn, index->expand("vamp:has_binary"), Node()))
265 .objects();
266
267 for (Node bin: binaries) {
268 if (bin.type != Node::Literal) continue;
269 if (bin.value == "linux32") {
270 m_pluginDownloadTypes.insert(DownloadLinux32);
271 } else if (bin.value == "linux64") {
272 m_pluginDownloadTypes.insert(DownloadLinux64);
273 } else if (bin.value == "win32") {
274 m_pluginDownloadTypes.insert(DownloadWindows);
275 } else if (bin.value == "osx") {
276 m_pluginDownloadTypes.insert(DownloadMac);
277 }
278 }
279 }
280 }
281
282 Nodes packs = index->match
283 (Triple(Node(), index->expand("vamp:available_library"), libn))
284 .objects();
285
286 for (Node packn: packs) {
287 if (packn.type != Node::URI) continue;
288
289 Pack pack;
290 n = index->complete
291 (Triple(packn, index->expand("dc:title"), Node()));
292 if (n.type == Node::Literal) {
293 pack.name = n.value;
294 }
295 n = index->complete
296 (Triple(packn, index->expand("foaf:page"), Node()));
297 if (n.type == Node::URI) {
298 pack.downloadURL = n.value;
299 }
300
301 if (pack.name != "" && pack.downloadURL != "") {
302 m_pluginFoundInPacks[packn.value] = pack;
303 }
304 }
305
230 return true; 306 return true;
231 } 307 }
232 308
233 bool 309 bool
234 PluginRDFDescription::indexOutputs() 310 PluginRDFDescription::indexOutputs()