hdt 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/deps/hdt-it/.cproject +42 -0
  2. package/deps/hdt-it/.project +27 -0
  3. package/deps/hdt-it/Camera.cpp +249 -0
  4. package/deps/hdt-it/Camera.h +77 -0
  5. package/deps/hdt-it/Color.cpp +157 -0
  6. package/deps/hdt-it/Color.h +49 -0
  7. package/deps/hdt-it/Info.plist +58 -0
  8. package/deps/hdt-it/LICENSE +280 -0
  9. package/deps/hdt-it/README.md +73 -0
  10. package/deps/hdt-it/StopWatch.cpp +170 -0
  11. package/deps/hdt-it/StopWatch.hpp +61 -0
  12. package/deps/hdt-it/abouthdt.cpp +14 -0
  13. package/deps/hdt-it/abouthdt.hpp +22 -0
  14. package/deps/hdt-it/abouthdt.ui +173 -0
  15. package/deps/hdt-it/colors.hpp +29 -0
  16. package/deps/hdt-it/constants.h +39 -0
  17. package/deps/hdt-it/createdmg.sh +72 -0
  18. package/deps/hdt-it/dictionarysuggestions.cpp +186 -0
  19. package/deps/hdt-it/dictionarysuggestions.hpp +39 -0
  20. package/deps/hdt-it/doc/hdtit.png +0 -0
  21. package/deps/hdt-it/doc/manual.html +88 -0
  22. package/deps/hdt-it/doc/matrix.png +0 -0
  23. package/deps/hdt-it/editreset.png +0 -0
  24. package/deps/hdt-it/hdt-it.pro +135 -0
  25. package/deps/hdt-it/hdt-it_es.qm +0 -0
  26. package/deps/hdt-it/hdt-it_es.ts +906 -0
  27. package/deps/hdt-it/hdtcachedinfo.cpp +155 -0
  28. package/deps/hdt-it/hdtcachedinfo.hpp +38 -0
  29. package/deps/hdt-it/hdtcontroller.cpp +369 -0
  30. package/deps/hdt-it/hdtcontroller.hpp +103 -0
  31. package/deps/hdt-it/hdtico.icns +0 -0
  32. package/deps/hdt-it/hdtico.rc +1 -0
  33. package/deps/hdt-it/hdtit.cpp +400 -0
  34. package/deps/hdt-it/hdtit.hpp +78 -0
  35. package/deps/hdt-it/hdtit.ui +875 -0
  36. package/deps/hdt-it/hdtoperation.cpp +284 -0
  37. package/deps/hdt-it/hdtoperation.hpp +71 -0
  38. package/deps/hdt-it/hdtresources.qrc +7 -0
  39. package/deps/hdt-it/hdtspecform.cpp +180 -0
  40. package/deps/hdt-it/hdtspecform.hpp +38 -0
  41. package/deps/hdt-it/hdtspecform.ui +361 -0
  42. package/deps/hdt-it/hdtsummarygenerator.cpp +109 -0
  43. package/deps/hdt-it/hdtsummarygenerator.hpp +15 -0
  44. package/deps/hdt-it/hdtwinico.ico +0 -0
  45. package/deps/hdt-it/hdtwinico2.ico +0 -0
  46. package/deps/hdt-it/headermodel.cpp +174 -0
  47. package/deps/hdt-it/headermodel.hpp +38 -0
  48. package/deps/hdt-it/loading.gif +0 -0
  49. package/deps/hdt-it/logo-hdt.png +0 -0
  50. package/deps/hdt-it/logo-hdt2.png +0 -0
  51. package/deps/hdt-it/main.cpp +39 -0
  52. package/deps/hdt-it/matrixviewwidget.cpp +501 -0
  53. package/deps/hdt-it/matrixviewwidget.hpp +81 -0
  54. package/deps/hdt-it/myapplication.cpp +45 -0
  55. package/deps/hdt-it/myapplication.hpp +24 -0
  56. package/deps/hdt-it/predicatestatus.cpp +97 -0
  57. package/deps/hdt-it/predicatestatus.hpp +39 -0
  58. package/deps/hdt-it/qclearlineedit.cpp +48 -0
  59. package/deps/hdt-it/qclearlineedit.hpp +30 -0
  60. package/deps/hdt-it/regexmodel.cpp +132 -0
  61. package/deps/hdt-it/regexmodel.hpp +37 -0
  62. package/deps/hdt-it/resultcounter.cpp +47 -0
  63. package/deps/hdt-it/resultcounter.hpp +30 -0
  64. package/deps/hdt-it/searchresultsmodel.cpp +179 -0
  65. package/deps/hdt-it/searchresultsmodel.hpp +39 -0
  66. package/deps/hdt-it/sparqlform.cpp +27 -0
  67. package/deps/hdt-it/sparqlform.hpp +28 -0
  68. package/deps/hdt-it/sparqlform.ui +112 -0
  69. package/deps/hdt-it/sparqlmodel.cpp +155 -0
  70. package/deps/hdt-it/sparqlmodel.hpp +32 -0
  71. package/deps/hdt-it/stringutils.cpp +48 -0
  72. package/deps/hdt-it/stringutils.hpp +18 -0
  73. package/deps/hdt-it/triplecomponentmodel.cpp +146 -0
  74. package/deps/hdt-it/triplecomponentmodel.hpp +33 -0
  75. package/deps/libcds/Doxyfile +307 -0
  76. package/deps/libcds/tutorial/tutorial.pdf +0 -0
  77. package/deps/libhdt/.cproject +304 -0
  78. package/deps/libhdt/Doxyfile +1630 -0
  79. package/lib/hdt.d.ts +8 -0
  80. package/package.json +7 -1
  81. package/.eslintrc +0 -178
  82. package/.github/workflows/ci.yml +0 -73
  83. package/.gitmodules +0 -4
  84. package/.idea/codeStyles/Project.xml +0 -38
  85. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  86. package/.idea/hdt.iml +0 -12
  87. package/.idea/inspectionProfiles/Project_Default.xml +0 -7
  88. package/.idea/jsLinters/jshint.xml +0 -16
  89. package/.idea/modules.xml +0 -8
  90. package/.idea/vcs.xml +0 -7
  91. package/.jshintignore +0 -1
  92. package/.jshintrc +0 -10
  93. package/perf/run.js +0 -43
  94. package/replace-in-file.json +0 -5
@@ -0,0 +1,284 @@
1
+ #include <QApplication>
2
+ #include <QtConcurrent/QtConcurrent>
3
+ #include <QMessageBox>
4
+ #include <QtGui>
5
+ #include <QPushButton>
6
+
7
+ #include <HDTManager.hpp>
8
+
9
+ #include "hdtoperation.hpp"
10
+
11
+ #define USE_DIALOG
12
+ //#define OPERATION_CANCELABLE
13
+
14
+ #ifdef WIN32
15
+ #include <windows.h>
16
+ #define sleep(a) Sleep((a)*1000)
17
+ #else
18
+ #include <iostream>
19
+ #include <unistd.h>
20
+ #define sleep(a) usleep(a)
21
+ #endif
22
+
23
+
24
+ HDTOperationDialog::HDTOperationDialog()
25
+ {
26
+ }
27
+
28
+ void HDTOperationDialog::closeEvent(QCloseEvent *event)
29
+ {
30
+ #ifdef OPERATION_CANCELABLE
31
+ event->accept();
32
+ #else
33
+ event->ignore();
34
+ #endif
35
+ }
36
+
37
+ HDTOperation::HDTOperation() : hdt(NULL), hdtInfo(NULL), errorMessage(NULL)
38
+ {
39
+ }
40
+
41
+ HDTOperation::HDTOperation(QString fileName) : fileName(fileName), hdt(NULL), hdtInfo(NULL), errorMessage(NULL)
42
+ {
43
+ }
44
+
45
+ HDTOperation::HDTOperation(hdt::HDT *hdt) : hdt(hdt), hdtInfo(NULL), errorMessage(NULL)
46
+ {
47
+ }
48
+
49
+ HDTOperation::HDTOperation(hdt::HDT *hdt, HDTCachedInfo *hdtInfo) : hdt(hdt), hdtInfo(hdtInfo), errorMessage(NULL)
50
+ {
51
+ }
52
+
53
+ void HDTOperation::execute() {
54
+ errorMessage=NULL;
55
+ try {
56
+ switch(op) {
57
+ case HDT_READ: {
58
+ hdt::IntermediateListener iListener(dynamic_cast<ProgressListener *>(this));
59
+ iListener.setRange(0,70);
60
+
61
+ // TODO: Decompress GZIP here using progress bar.
62
+ // TODO: Detect whether .hdtcache and .hdt.index exist to be more accurate with the progress
63
+ #if 1
64
+ hdt = hdt::HDTManager::mapIndexedHDT(fileName.toLatin1(), &iListener);
65
+ #else
66
+ hdt = hdt::HDTManager::loadIndexedHDT(fileName.toLatin1(), &iListener);
67
+ #endif
68
+ iListener.setRange(70, 100);
69
+ hdtInfo = new HDTCachedInfo(hdt);
70
+ if(fileName.endsWith('.gz')){
71
+ fileName.left(fileName.length()-3);
72
+ }
73
+ QString infoFile = fileName + ".hdtcache";
74
+ hdtInfo->load(infoFile, &iListener);
75
+
76
+ break;
77
+ }
78
+ case RDF_READ:{
79
+ hdt::IntermediateListener iListener(dynamic_cast<ProgressListener *>(this));
80
+
81
+ iListener.setRange(0,80);
82
+ hdt = hdt::HDTManager::generateHDT(fileName.toLatin1(), baseUri.c_str(), notation, spec, &iListener);
83
+
84
+ iListener.setRange(80, 90);
85
+ hdt = hdt::HDTManager::indexedHDT(hdt);
86
+
87
+ iListener.setRange(90, 100);
88
+ hdtInfo = new HDTCachedInfo(hdt);
89
+ hdtInfo->generateGeneralInfo(&iListener);
90
+ hdtInfo->generateMatrix(&iListener);
91
+
92
+ break;
93
+ }
94
+ case HDT_WRITE:
95
+ hdt->saveToHDT(fileName.toLatin1(), dynamic_cast<ProgressListener *>(this));
96
+ break;
97
+ case RDF_WRITE:{
98
+ hdt::RDFSerializer *serializer = hdt::RDFSerializer::getSerializer(fileName.toLatin1(), notation);
99
+ hdt->saveToRDF(*serializer, dynamic_cast<ProgressListener *>(this));
100
+ delete serializer;
101
+ break;
102
+ }
103
+ case RESULT_EXPORT: {
104
+ hdt::RDFSerializer *serializer = hdt::RDFSerializer::getSerializer(fileName.toLatin1(), notation);
105
+ serializer->serialize(iterator, dynamic_cast<ProgressListener *>(this), numResults );
106
+ delete serializer;
107
+ delete iterator;
108
+ break;
109
+ }
110
+ }
111
+ emit processFinished(0);
112
+ } catch (char* err) {
113
+ cerr << "Error caught: " << err << endl;
114
+ errorMessage = err;
115
+ emit processFinished(1);
116
+ } catch (const char* err) {
117
+ cerr << "Error caught: " << err << endl;
118
+ errorMessage = (char *)err;
119
+ emit processFinished(1);
120
+ }
121
+ sleep(1); // To ensure that dialog receives the signal and closes.
122
+ }
123
+
124
+
125
+ void HDTOperation::notifyProgress(float level, const char *section) {
126
+ #ifdef OPERATION_CANCELABLE
127
+ if(isCancelled) {
128
+ cerr << "Throwing exception to cancel" << endl;
129
+ throw (char *)"Cancelled by user";
130
+ }
131
+ #endif
132
+ #ifdef USE_DIALOG
133
+ emit progressChanged((int)level);
134
+ emit messageChanged(QString(section));
135
+ #endif
136
+ }
137
+
138
+ void HDTOperation::notifyProgress(float task, float level, const char *section)
139
+ {
140
+ #ifdef OPERATION_CANCELABLE
141
+ if(isCancelled) {
142
+ cerr << "Throwing exception to cancel" << endl;
143
+ throw (char *)"Cancelled by user";
144
+ }
145
+ #endif
146
+ int levelInt = (int) level;
147
+ if(levelInt<0) {
148
+ levelInt=0;
149
+ }
150
+ if(levelInt>=100) {
151
+ levelInt=99;
152
+ }
153
+
154
+ emit progressChanged((int)level);
155
+ emit messageChanged(QString(section));
156
+ }
157
+
158
+ void HDTOperation::saveToRDF(QString &fileName, hdt::RDFNotation notation)
159
+ {
160
+ this->op = RDF_WRITE;
161
+ this->fileName = fileName;
162
+ this->notation = notation;
163
+ }
164
+
165
+ void HDTOperation::saveToHDT(QString &fileName)
166
+ {
167
+ this->op = HDT_WRITE;
168
+ this->fileName = fileName;
169
+ }
170
+
171
+ void HDTOperation::loadFromRDF(hdt::HDTSpecification &spec, QString &fileName, hdt::RDFNotation notation, const string &baseUri)
172
+ {
173
+ this->op = RDF_READ;
174
+ this->spec = spec;
175
+ this->fileName = fileName;
176
+ this->notation = notation;
177
+ this->baseUri = baseUri;
178
+ }
179
+
180
+ void HDTOperation::loadFromHDT(QString &fileName)
181
+ {
182
+ this->op = HDT_READ;
183
+ this->fileName = fileName;
184
+ }
185
+
186
+ void HDTOperation::exportResults(QString &fileName, hdt::IteratorTripleString *iterator, unsigned int numResults, hdt::RDFNotation notation)
187
+ {
188
+ this->op = RESULT_EXPORT;
189
+ this->fileName = fileName;
190
+ this->iterator = iterator;
191
+ this->numResults = numResults;
192
+ this->notation = notation;
193
+ }
194
+
195
+ hdt::HDT *HDTOperation::getHDT()
196
+ {
197
+ return hdt;
198
+ }
199
+
200
+ HDTCachedInfo *HDTOperation::getHDTInfo()
201
+ {
202
+ return hdtInfo;
203
+ }
204
+
205
+
206
+ int HDTOperation::exec()
207
+ {
208
+
209
+ #ifdef USE_DIALOG
210
+ dialog.setRange(0,100);
211
+ dialog.setAutoClose(false);
212
+ dialog.setFixedSize(400,130);
213
+
214
+ switch(op) {
215
+ case HDT_READ:
216
+ dialog.setWindowTitle(tr("Loading HDT File"));
217
+ break;
218
+ case RDF_READ:
219
+ dialog.setWindowTitle(tr("Importing RDF File to HDT"));
220
+ break;
221
+ case HDT_WRITE:
222
+ dialog.setWindowTitle(tr("Saving HDT File"));
223
+ break;
224
+ case RDF_WRITE:
225
+ dialog.setWindowTitle(tr("Exporting HDT File to RDF"));
226
+ break;
227
+ case RESULT_EXPORT:
228
+ dialog.setWindowTitle(tr("Exporting results to RDF"));
229
+ break;
230
+ }
231
+
232
+ #ifndef OPERATION_CANCELABLE
233
+ QPushButton btn;
234
+ btn.setEnabled(false);
235
+ btn.setText(tr("Cancel"));
236
+ dialog.setCancelButton(&btn);
237
+ #endif
238
+
239
+ QFutureWatcher<void> watcher;
240
+
241
+ connect(&watcher, SIGNAL(finished()), this, SLOT(finished()), Qt::QueuedConnection);
242
+
243
+ connect(this, SIGNAL(progressChanged(int)), &dialog, SLOT(setValue(int)), Qt::QueuedConnection);
244
+ connect(this, SIGNAL(messageChanged(QString)), &dialog, SLOT(setLabelText(QString)), Qt::QueuedConnection);
245
+ connect(this, SIGNAL(processFinished(int)), &dialog, SLOT(done(int)), Qt::QueuedConnection);
246
+
247
+ #ifdef OPERATION_CANCELABLE
248
+ connect(&dialog, SIGNAL(canceled()), this, SLOT(cancel()));
249
+ #endif
250
+
251
+ isCancelled=false;
252
+ QFuture<void> f = QtConcurrent::run(this, &HDTOperation::execute);
253
+ watcher.setFuture(f);
254
+
255
+ int result = dialog.exec();
256
+
257
+ if(errorMessage) {
258
+ result = 1;
259
+ QMessageBox::critical(NULL, "ERROR", QString(errorMessage) );
260
+ }
261
+
262
+ QApplication::alert(QApplication::activeWindow());
263
+ return result;
264
+ #else
265
+ this->execute();
266
+ if(errorMessage!=NULL) {
267
+ return 1;
268
+ } else {
269
+ return 0;
270
+ }
271
+ #endif
272
+ }
273
+
274
+ void HDTOperation::cancel()
275
+ {
276
+ //cerr << "Operation cancelled" << endl;
277
+ isCancelled = true;
278
+ }
279
+
280
+ void HDTOperation::finished()
281
+ {
282
+ cerr << "Finished! :)" << endl;
283
+ emit processFinished(0);
284
+ }
@@ -0,0 +1,71 @@
1
+ #ifndef HDTOPERATION_HPP
2
+ #define HDTOPERATION_HPP
3
+
4
+ #include <QProgressDialog>
5
+ #include <QMutex>
6
+ #include <QMutexLocker>
7
+ #include <HDTListener.hpp>
8
+ #include <HDT.hpp>
9
+ #include <HDTSpecification.hpp>
10
+ #include <SingleTriple.hpp>
11
+
12
+ #include "hdtcachedinfo.hpp"
13
+
14
+
15
+ class HDTOperationDialog : public QProgressDialog {
16
+ Q_OBJECT
17
+ public:
18
+ HDTOperationDialog();
19
+ void closeEvent(QCloseEvent *event);
20
+ };
21
+
22
+ class HDTOperation : public QObject, public hdt::ProgressListener {
23
+ Q_OBJECT
24
+
25
+ private:
26
+ hdt::HDTSpecification spec;
27
+ hdt::HDT *hdt;
28
+ HDTCachedInfo *hdtInfo;
29
+ hdt::IteratorTripleString *iterator;
30
+ unsigned int numResults;
31
+ QString fileName;
32
+ hdt::RDFNotation notation;
33
+ string baseUri;
34
+ char *errorMessage;
35
+ bool isCancelled;
36
+ HDTOperationDialog dialog;
37
+
38
+ enum Operation {
39
+ HDT_READ,
40
+ RDF_READ,
41
+ HDT_WRITE,
42
+ RDF_WRITE,
43
+ RESULT_EXPORT
44
+ } op;
45
+
46
+ public:
47
+ HDTOperation();
48
+ HDTOperation(QString fileName);
49
+ HDTOperation(hdt::HDT *hdt);
50
+ HDTOperation(hdt::HDT *hdt, HDTCachedInfo *hdtInfo);
51
+ void saveToRDF(QString &fileName, hdt::RDFNotation notation);
52
+ void saveToHDT(QString &fileName);
53
+ void loadFromRDF(hdt::HDTSpecification &spec, QString &fileName, hdt::RDFNotation notation, const string &baseUri);
54
+ void loadFromHDT(QString &fileName);
55
+ void exportResults(QString &fileName, hdt::IteratorTripleString *iterator, unsigned int numResults, hdt::RDFNotation notation);
56
+ hdt::HDT *getHDT();
57
+ HDTCachedInfo *getHDTInfo();
58
+ void execute();
59
+ int exec();
60
+ void notifyProgress(float level, const char *section);
61
+ void notifyProgress(float task, float level, const char *section);
62
+ signals:
63
+ void progressChanged(int progress);
64
+ void messageChanged(QString message);
65
+ void processFinished(int status);
66
+ private slots:
67
+ void cancel();
68
+ void finished();
69
+ };
70
+
71
+ #endif // HDTOPERATION_HPP
@@ -0,0 +1,7 @@
1
+ <RCC>
2
+ <qresource prefix="/images">
3
+ <file>editreset.png</file>
4
+ <file>logo-hdt.png</file>
5
+ <file>loading.gif</file>
6
+ </qresource>
7
+ </RCC>
@@ -0,0 +1,180 @@
1
+ #include <QFileDialog>
2
+ #include <QMessageBox>
3
+
4
+ #include "hdtspecform.hpp"
5
+ #include "ui_hdtspecform.h"
6
+
7
+ #include <QtGui>
8
+
9
+ HDTSpecForm::HDTSpecForm(QWidget *parent) :
10
+ QDialog(parent),
11
+ ui(new Ui::HDTSpecForm)
12
+ {
13
+ ui->setupUi(this);
14
+ }
15
+
16
+ HDTSpecForm::~HDTSpecForm()
17
+ {
18
+ delete ui;
19
+ }
20
+
21
+ void HDTSpecForm::on_triplesTypeCombo_currentIndexChanged(int index)
22
+ {
23
+ switch(index) {
24
+ case 0:
25
+ // BitmapTriples
26
+ ui->streamXcombo->setEnabled(false);
27
+ ui->streamYcombo->setEnabled(true);
28
+ ui->streamZcombo->setEnabled(true);
29
+ break;
30
+ case 1:
31
+ // TriplesList
32
+ ui->streamXcombo->setEnabled(false);
33
+ ui->streamYcombo->setEnabled(false);
34
+ ui->streamZcombo->setEnabled(false);
35
+ break;
36
+ case 2:
37
+ // PlainTriples
38
+ ui->streamXcombo->setEnabled(true);
39
+ ui->streamYcombo->setEnabled(true);
40
+ ui->streamZcombo->setEnabled(true);
41
+ break;
42
+ case 4:
43
+ // FoQTriples
44
+ ui->streamXcombo->setEnabled(false);
45
+ ui->streamYcombo->setEnabled(false);
46
+ ui->streamZcombo->setEnabled(false);
47
+ break;
48
+ }
49
+ ui->triplesOrderCombo->setEnabled(index!=4);
50
+ }
51
+
52
+ void HDTSpecForm::on_inputFileButton_clicked()
53
+ {
54
+ static QString lastDir = QDir::currentPath();
55
+ QString file = QFileDialog::getOpenFileName(this,tr("Select Input RDF File"), lastDir, tr("RDF Files(*)"), 0, 0 );
56
+ if(file!="") {
57
+ lastDir=file;
58
+ if(getBaseUri()=="") {
59
+ ui->baseUriText->setText("<file://"+file+">");
60
+ }
61
+
62
+ QString noCompression=file;
63
+
64
+ if(file.endsWith(".gz", Qt::CaseInsensitive)) {
65
+ noCompression = file.left(file.length()-3);
66
+ }
67
+
68
+ if(noCompression.endsWith(".ttl", Qt::CaseInsensitive)) {
69
+ ui->rdfInputCombo->setCurrentIndex(2);
70
+ } else if(noCompression.endsWith(".nt", Qt::CaseInsensitive)) {
71
+ ui->rdfInputCombo->setCurrentIndex(0);
72
+ } else if(noCompression.endsWith(".n3", Qt::CaseInsensitive)) {
73
+ ui->rdfInputCombo->setCurrentIndex(1);
74
+ } else if(noCompression.endsWith(".rdf", Qt::CaseInsensitive) || noCompression.endsWith(".xml", Qt::CaseInsensitive)) {
75
+ ui->rdfInputCombo->setCurrentIndex(3);
76
+ }
77
+ }
78
+ ui->rdfInputFile->setText(file);
79
+ }
80
+
81
+ QString HDTSpecForm::getFileName()
82
+ {
83
+ return ui->rdfInputFile->text();
84
+ }
85
+
86
+ QString HDTSpecForm::getBaseUri()
87
+ {
88
+ return ui->baseUriText->text();
89
+ }
90
+
91
+ std::string HDTSpecForm::getStreamType(int index) {
92
+ switch(index) {
93
+ case 0:
94
+ // LogStream
95
+ return hdt::HDTVocabulary::SEQ_TYPE_LOG;
96
+ case 1:
97
+ // IntegerStream
98
+ return hdt::HDTVocabulary::SEQ_TYPE_INT32;
99
+ case 2:
100
+ // HuffmanStream
101
+ return hdt::HDTVocabulary::SEQ_TYPE_HUFFMAN;
102
+ case 3:
103
+ // WaveletStream
104
+ return hdt::HDTVocabulary::SEQ_TYPE_WAVELET;
105
+ }
106
+ return "";
107
+ }
108
+
109
+ void HDTSpecForm::fillHDTSpecification(hdt::HDTSpecification &hdt)
110
+ {
111
+ hdt.set("triplesOrder", hdt::getOrderStr((hdt::TripleComponentOrder)(ui->triplesOrderCombo->currentIndex()+1)));
112
+
113
+ hdt.set("header.type", hdt::HDTVocabulary::DICTIONARY_TYPE_PLAIN);
114
+
115
+ switch(ui->dictionaryTypeCombo->currentIndex()) {
116
+ case 0:
117
+ // FourSectionDictionary
118
+ hdt.set("dictionary.type", hdt::HDTVocabulary::DICTIONARY_TYPE_FOUR);
119
+ break;
120
+ case 1:
121
+ // PlainDictionary
122
+ hdt.set("dictionary.type", hdt::HDTVocabulary::DICTIONARY_TYPE_PLAIN);
123
+ break;
124
+ case 2:
125
+ // LiteralDictionary
126
+ hdt.set("dictionary.type", hdt::HDTVocabulary::DICTIONARY_TYPE_LITERAL);
127
+ break;
128
+ }
129
+
130
+ switch(ui->triplesTypeCombo->currentIndex()) {
131
+ case 0:
132
+ // BitmapTriples
133
+ hdt.set("triples.type", hdt::HDTVocabulary::TRIPLES_TYPE_BITMAP);
134
+ break;
135
+ case 1:
136
+ // TriplesList
137
+ hdt.set("triples.type", hdt::HDTVocabulary::TRIPLES_TYPE_TRIPLESLIST);
138
+ break;
139
+ case 2:
140
+ // PlainTriples
141
+ hdt.set("triples.type", hdt::HDTVocabulary::TRIPLES_TYPE_PLAIN);
142
+ break;
143
+ }
144
+
145
+ if(ui->streamXcombo->isEnabled()) {
146
+ hdt.set("stream.x", getStreamType(ui->streamXcombo->currentIndex()));
147
+ }
148
+
149
+ if(ui->streamYcombo->isEnabled()) {
150
+ hdt.set("stream.y", getStreamType(ui->streamYcombo->currentIndex()));
151
+ }
152
+
153
+ if(ui->streamZcombo->isEnabled()) {
154
+ hdt.set("stream.z", getStreamType(ui->streamZcombo->currentIndex()));
155
+ }
156
+ }
157
+
158
+ hdt::RDFNotation HDTSpecForm::getNotation()
159
+ {
160
+ switch(ui->rdfInputCombo->currentIndex()) {
161
+ case 0:
162
+ return hdt::NTRIPLES;
163
+ case 1:
164
+ return hdt::N3;
165
+ case 2:
166
+ return hdt::TURTLE;
167
+ case 3:
168
+ return hdt::XML;
169
+ }
170
+ return hdt::NTRIPLES;
171
+ }
172
+
173
+ void HDTSpecForm::accept()
174
+ {
175
+ if(getFileName()=="") {
176
+ QMessageBox::warning(NULL, tr("Select a file name."), tr("Please insert a file name or URI."));
177
+ } else {
178
+ done(1);
179
+ }
180
+ }
@@ -0,0 +1,38 @@
1
+ #ifndef HDTSPECFORM_HPP
2
+ #define HDTSPECFORM_HPP
3
+
4
+ #include <QDialog>
5
+
6
+ #include <HDTSpecification.hpp>
7
+ #include <HDTVocabulary.hpp>
8
+ #include <HDTEnums.hpp>
9
+
10
+ namespace Ui {
11
+ class HDTSpecForm;
12
+ }
13
+
14
+ class HDTSpecForm : public QDialog
15
+ {
16
+ Q_OBJECT
17
+
18
+ public:
19
+ explicit HDTSpecForm(QWidget *parent = 0);
20
+ ~HDTSpecForm();
21
+
22
+ public:
23
+ QString getFileName();
24
+ QString getBaseUri();
25
+ void fillHDTSpecification(hdt::HDTSpecification &spec);
26
+ hdt::RDFNotation getNotation();
27
+
28
+ private:
29
+ Ui::HDTSpecForm *ui;
30
+ std::string getStreamType(int index);
31
+
32
+ private slots:
33
+ void on_triplesTypeCombo_currentIndexChanged(int index);
34
+ void on_inputFileButton_clicked();
35
+ void accept();
36
+ };
37
+
38
+ #endif // HDTSPECFORM_HPP