Debian Codegraph @

Source/Control/Interface/CommandLine/CSPARQLServerComandLinePreparationTranslator.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CSPARQLServerComandLinePreparationTranslator.h"
22
23
24 namespace Konclude {
25
26 namespace Control {
27
28 namespace Interface {
29
30 namespace CommandLine {
31
32
33 CSPARQLServerComandLinePreparationTranslator::CSPARQLServerComandLinePreparationTranslator(CLoaderFactory *loaderFactory) : CCommandLinePreparationTranslator(loaderFactory) {
34 mInterfaceTypeString = QString("CLI");
35 mMinNecessaryArguments = true;
36 mFirstArgumentTranslation = false;
37 mReasonerConfList.append(QString("+=Konclude.Calculation.Querying.ComplexQueryingSupport=true"));
38 mReasonerConfList.append(QString("+=Konclude.Calculation.Optimization.RepresentativePropagation=false"));
39 mReasonerConfList.append(QString("+=Konclude.Calculation.Optimization.SignatureMirroringBlocking=false"));
40 }
41
42
43 CSPARQLServerComandLinePreparationTranslator::~CSPARQLServerComandLinePreparationTranslator() {
44 }
45
46
47 bool CSPARQLServerComandLinePreparationTranslator::translate(const QString& argumentText, QStringList& remainingArgList) {
48
49 bool argumentTranslated = false;
50
51
52 QString modArgText = argumentText.trimmed();
53 if (!mSkipTranslation) {
54 if (CCommandLinePreparationTranslator::translate(argumentText,remainingArgList)) {
55 argumentTranslated = true;
56 } else {
57 if (modArgText.indexOf("-") == 0) {
58 while (modArgText.startsWith("-")) {
59 modArgText.remove(0,1);
60 modArgText = modArgText.trimmed();
61 }
62
63 if (modArgText.indexOf("p") == 0 || modArgText.indexOf("P") == 0) {
64 argumentTranslated = true;
65 QString portVal = "";
66 if (remainingArgList.count() > 0) {
67 portVal = remainingArgList.takeFirst();
68 }
69 mParameterizingConfList.append(QString("+=Konclude.SPARQL.Server.Port=%2").arg(portVal.trimmed()));
70
71 }
72
73 } else if (modArgText == "sparqlserver" || modArgText == "sserver") {
74 argumentTranslated = true;
75 mFirstArgumentTranslation = true;
76 }
77 }
78 }
79 return argumentTranslated;
80 }
81
82 bool CSPARQLServerComandLinePreparationTranslator::canTranslate(const QString& string) {
83 if (QString::compare(string,"sparqlserver",Qt::CaseInsensitive) == 0 || QString::compare(string,"sserver",Qt::CaseInsensitive) == 0) {
84 return true;
85 }
86 return false;
87 }
88
89
90 QStringList CSPARQLServerComandLinePreparationTranslator::combineTranslatedArguments() {
91 QStringList translatedArgList;
92
93 if (!mFirstArgumentTranslation) {
94 mMinNecessaryArguments = false;
95 }
96
97 if (!mMinNecessaryArguments) {
98 LOG(ERROR,getLogDomain(),logTr("Execution with inadequate command line arguments."),this);
99 mHelpRequested = true;
100 }
101
102
103 if (!mHelpRequested) {
104 if (mLogConfList.isEmpty()) {
105 mLogConfList.append(QString("-ConfigurableCoutLogObserverLoader -LoggerConfigurationLoader"));
106 }
107 translatedArgList += mLogConfList;
108 translatedArgList += mGeneralConfList;
109
110 translatedArgList += QString("-DefaultReasonerLoader ");
111 translatedArgList += mReasonerConfList;
112 translatedArgList += mGeneralConfList;
113
114 if (!mConfigConfList.isEmpty()) {
115 translatedArgList += QString("-OWLlinkBatchFileLoader +=Konclude.OWLlink.CloseAfterProcessedRequest=false +=Konclude.OWLlink.BlockUntilProcessedRequest=true");
116 translatedArgList += mConfigConfList;
117 }
118
119 if (!mRequestConfList.isEmpty()) {
120 translatedArgList += QString("-CLILoadingBatchProcessingLoader +=Konclude.CLI.CloseAfterProcessedRequest=false +=Konclude.CLI.BlockUntilProcessedRequest=true");
121 translatedArgList += mRequestConfList;
122 }
123
124 translatedArgList += QString("-SPARQLHttpServerLoader");
125 translatedArgList += mParameterizingConfList;
126
127 translatedArgList += mMiscellaneousList;
128 } else {
129 translatedArgList += QString("-ConfigurableCoutLogObserverLoader -CommandLineTranlatorHelpLoader");
130 }
131 return translatedArgList;
132 }
133
134
135
136
137
138 }; // end namespace CommandLine
139
140 }; // end namespace Interface
141
142 }; // end namespace Control
143
144 }; // end namespace Konclude