annotate rdf/SimpleSPARQLQuery.h @ 449:a75edaa08d28
* Support importing features from RDF whose times are intervals rather
than only instants; import them into region or note models. Sadly
this makes RDF import much, much slower, because we need to work around
Rasqal's single-OPTIONAL limitation by repeatedly querying each feature
for time and range.
* Add segmentation view to region layer, and display label texts
author |
Chris Cannam |
date |
Tue, 07 Oct 2008 12:42:17 +0000 |
parents |
5746c559af15 |
children |
3ffce691c9bf |
rev |
line source |
Chris@439
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@439
|
2
|
Chris@439
|
3 /*
|
Chris@439
|
4 Sonic Visualiser
|
Chris@439
|
5 An audio file viewer and annotation editor.
|
Chris@439
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@439
|
7 This file copyright 2008 QMUL.
|
Chris@439
|
8
|
Chris@439
|
9 This program is free software; you can redistribute it and/or
|
Chris@439
|
10 modify it under the terms of the GNU General Public License as
|
Chris@439
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@439
|
12 License, or (at your option) any later version. See the file
|
Chris@439
|
13 COPYING included with this distribution for more information.
|
Chris@439
|
14 */
|
Chris@439
|
15
|
Chris@439
|
16 #ifndef _SIMPLE_SPARQL_QUERY_H_
|
Chris@439
|
17 #define _SIMPLE_SPARQL_QUERY_H_
|
Chris@439
|
18
|
Chris@439
|
19 #include <QString>
|
Chris@439
|
20 #include <map>
|
Chris@439
|
21 #include <vector>
|
Chris@439
|
22
|
Chris@439
|
23 class ProgressReporter;
|
Chris@439
|
24
|
Chris@439
|
25 class SimpleSPARQLQuery
|
Chris@439
|
26 {
|
Chris@439
|
27 public:
|
Chris@439
|
28 enum ValueType { NoValue, URIValue, LiteralValue, BlankValue };
|
Chris@439
|
29
|
Chris@439
|
30 struct Value {
|
Chris@439
|
31 Value() : type(NoValue), value() { }
|
Chris@439
|
32 Value(ValueType t, QString v) : type(t), value(v) { }
|
Chris@439
|
33 ValueType type;
|
Chris@439
|
34 QString value;
|
Chris@439
|
35 };
|
Chris@439
|
36
|
Chris@439
|
37 typedef std::map<QString, Value> KeyValueMap;
|
Chris@439
|
38 typedef std::vector<KeyValueMap> ResultList;
|
Chris@439
|
39
|
Chris@439
|
40 SimpleSPARQLQuery(QString query);
|
Chris@439
|
41 ~SimpleSPARQLQuery();
|
Chris@439
|
42
|
Chris@439
|
43 void setProgressReporter(ProgressReporter *reporter);
|
Chris@439
|
44 bool wasCancelled() const;
|
Chris@439
|
45
|
Chris@439
|
46 ResultList execute();
|
Chris@439
|
47
|
Chris@439
|
48 bool isOK() const;
|
Chris@439
|
49 QString getErrorString() const;
|
Chris@439
|
50
|
Chris@440
|
51 // Do a query and return the value for the given binding, from the
|
Chris@440
|
52 // first result that has a value for it
|
Chris@440
|
53 static Value singleResultQuery(QString query, QString binding);
|
Chris@440
|
54
|
Chris@439
|
55 protected:
|
Chris@439
|
56 class Impl;
|
Chris@439
|
57 Impl *m_impl;
|
Chris@439
|
58 };
|
Chris@439
|
59
|
Chris@439
|
60 #endif
|