001 /**
002 * Copyright (C) 2007-2011, Jens Lehmann
003 *
004 * This file is part of DL-Learner.
005 *
006 * DL-Learner is free software; you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation; either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * DL-Learner is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program. If not, see <http://www.gnu.org/licenses/>.
018 */
019
020 package org.dllearner.core.configurators;
021
022 import java.net.URL;
023 import java.util.List;
024 import java.util.Set;
025 import org.dllearner.core.ComponentManager;
026 import org.dllearner.kb.sparql.SparqlKnowledgeSource;
027 import org.dllearner.utilities.datastructures.StringTuple;
028
029 /**
030 * automatically generated, do not edit manually.
031 * run org.dllearner.scripts.ConfigJavaGenerator to update
032 **/
033 public class SparqlKnowledgeSourceConfigurator implements Configurator {
034
035 private boolean reinitNecessary = false;
036 private SparqlKnowledgeSource sparqlKnowledgeSource;
037
038 /**
039 * @param sparqlKnowledgeSource see SparqlKnowledgeSource
040 **/
041 public SparqlKnowledgeSourceConfigurator(SparqlKnowledgeSource sparqlKnowledgeSource){
042 this.sparqlKnowledgeSource = sparqlKnowledgeSource;
043 }
044
045 /**
046 * @param url URL of SPARQL Endpoint
047 * @param instances relevant instances e.g. positive and negative examples in a learning problem
048 * @return SparqlKnowledgeSource
049 **/
050 public static SparqlKnowledgeSource getSparqlKnowledgeSource(URL url, Set<String> instances) {
051 SparqlKnowledgeSource component = ComponentManager.getInstance().knowledgeSource(SparqlKnowledgeSource.class);
052 ComponentManager.getInstance().applyConfigEntry(component, "url", url);
053 ComponentManager.getInstance().applyConfigEntry(component, "instances", instances);
054 return component;
055 }
056
057 /**
058 * url URL of SPARQL Endpoint.
059 * mandatory: true| reinit necessary: true
060 * default value: null
061 * @return URL
062 **/
063 public URL getUrl() {
064 return (URL) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "url") ;
065 }
066 /**
067 * cacheDir dir of cache.
068 * mandatory: false| reinit necessary: true
069 * default value: cache
070 * @return String
071 **/
072 public String getCacheDir() {
073 return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "cacheDir") ;
074 }
075 /**
076 * useCache If true a Cache is used.
077 * mandatory: false| reinit necessary: true
078 * default value: true
079 * @return boolean
080 **/
081 public boolean getUseCache() {
082 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCache") ;
083 }
084 /**
085 * useCacheDatabase If true, H2 database is used, otherwise one file per query is written..
086 * mandatory: false| reinit necessary: true
087 * default value: false
088 * @return boolean
089 **/
090 public boolean getUseCacheDatabase() {
091 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCacheDatabase") ;
092 }
093 /**
094 * instances relevant instances e.g. positive and negative examples in a learning problem.
095 * mandatory: true| reinit necessary: true
096 * default value: null
097 * @return Set(String)
098 **/
099 @SuppressWarnings("unchecked")
100 public Set<String> getInstances() {
101 return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "instances") ;
102 }
103 /**
104 * recursionDepth recursion depth of KB fragment selection.
105 * mandatory: false| reinit necessary: true
106 * default value: 1
107 * @return int
108 **/
109 public int getRecursionDepth() {
110 return (Integer) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "recursionDepth") ;
111 }
112 /**
113 * predefinedFilter the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST.
114 * mandatory: false| reinit necessary: true
115 * default value: null
116 * @return String
117 **/
118 public String getPredefinedFilter() {
119 return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "predefinedFilter") ;
120 }
121 /**
122 * predefinedEndpoint the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK.
123 * mandatory: false| reinit necessary: true
124 * default value: null
125 * @return String
126 **/
127 public String getPredefinedEndpoint() {
128 return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "predefinedEndpoint") ;
129 }
130 /**
131 * predefinedManipulator the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR.
132 * mandatory: false| reinit necessary: true
133 * default value: null
134 * @return String
135 **/
136 public String getPredefinedManipulator() {
137 return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "predefinedManipulator") ;
138 }
139 /**
140 * predList list of all ignored roles.
141 * mandatory: false| reinit necessary: true
142 * default value: []
143 * @return Set(String)
144 **/
145 @SuppressWarnings("unchecked")
146 public Set<String> getPredList() {
147 return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "predList") ;
148 }
149 /**
150 * objList list of all ignored objects.
151 * mandatory: false| reinit necessary: true
152 * default value: []
153 * @return Set(String)
154 **/
155 @SuppressWarnings("unchecked")
156 public Set<String> getObjList() {
157 return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "objList") ;
158 }
159 /**
160 * saveExtractedFragment Specifies whether the extracted ontology is written to a file or not. The OWL file is written to the cache dir.Some DBpedia URI will make the XML invalid.
161 * mandatory: false| reinit necessary: true
162 * default value: false
163 * @return boolean
164 **/
165 public boolean getSaveExtractedFragment() {
166 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "saveExtractedFragment") ;
167 }
168 /**
169 * replacePredicate rule for replacing predicates.
170 * mandatory: false| reinit necessary: true
171 * default value: []
172 * @return List(StringTuple)
173 **/
174 @SuppressWarnings("unchecked")
175 public List<StringTuple> getReplacePredicate() {
176 return (List<StringTuple>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "replacePredicate") ;
177 }
178 /**
179 * replaceObject rule for replacing predicates.
180 * mandatory: false| reinit necessary: true
181 * default value: []
182 * @return List(StringTuple)
183 **/
184 @SuppressWarnings("unchecked")
185 public List<StringTuple> getReplaceObject() {
186 return (List<StringTuple>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "replaceObject") ;
187 }
188 /**
189 * breakSuperClassRetrievalAfter stops a cyclic hierarchy after specified number of classes.
190 * mandatory: false| reinit necessary: true
191 * default value: 1000
192 * @return int
193 **/
194 public int getBreakSuperClassRetrievalAfter() {
195 return (Integer) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "breakSuperClassRetrievalAfter") ;
196 }
197 /**
198 * useLits use Literals in SPARQL query.
199 * mandatory: false| reinit necessary: true
200 * default value: true
201 * @return boolean
202 **/
203 public boolean getUseLits() {
204 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useLits") ;
205 }
206 /**
207 * getAllSuperClasses If true then all superclasses are retrieved until the most general class (owl:Thing) is reached..
208 * mandatory: false| reinit necessary: true
209 * default value: true
210 * @return boolean
211 **/
212 public boolean getGetAllSuperClasses() {
213 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "getAllSuperClasses") ;
214 }
215 /**
216 * closeAfterRecursion gets all classes for all instances.
217 * mandatory: false| reinit necessary: true
218 * default value: true
219 * @return boolean
220 **/
221 public boolean getCloseAfterRecursion() {
222 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "closeAfterRecursion") ;
223 }
224 /**
225 * getPropertyInformation gets all types for extracted ObjectProperties.
226 * mandatory: false| reinit necessary: true
227 * default value: false
228 * @return boolean
229 **/
230 public boolean getGetPropertyInformation() {
231 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "getPropertyInformation") ;
232 }
233 /**
234 * dissolveBlankNodes determines whether Blanknodes are dissolved. This is a costly function..
235 * mandatory: false| reinit necessary: true
236 * default value: true
237 * @return boolean
238 **/
239 public boolean getDissolveBlankNodes() {
240 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "dissolveBlankNodes") ;
241 }
242 /**
243 * useImprovedSparqlTupelAquisitor uses deeply nested SparqlQueries, according to recursion depth, still EXPERIMENTAL.
244 * mandatory: false| reinit necessary: true
245 * default value: false
246 * @return boolean
247 **/
248 public boolean getUseImprovedSparqlTupelAquisitor() {
249 return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useImprovedSparqlTupelAquisitor") ;
250 }
251 /**
252 * verbosity control verbosity of output for this component.
253 * mandatory: false| reinit necessary: true
254 * default value: warning
255 * @return String
256 **/
257 public String getVerbosity() {
258 return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "verbosity") ;
259 }
260 /**
261 * defaultGraphURIs a list of all default Graph URIs.
262 * mandatory: false| reinit necessary: true
263 * default value: []
264 * @return Set(String)
265 **/
266 @SuppressWarnings("unchecked")
267 public Set<String> getDefaultGraphURIs() {
268 return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "defaultGraphURIs") ;
269 }
270 /**
271 * namedGraphURIs a list of all named Graph URIs.
272 * mandatory: false| reinit necessary: true
273 * default value: []
274 * @return Set(String)
275 **/
276 @SuppressWarnings("unchecked")
277 public Set<String> getNamedGraphURIs() {
278 return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "namedGraphURIs") ;
279 }
280
281 /**
282 * @param url URL of SPARQL Endpoint.
283 * mandatory: true| reinit necessary: true
284 * default value: null
285 **/
286 public void setUrl(URL url) {
287 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "url", url);
288 reinitNecessary = true;
289 }
290 /**
291 * @param cacheDir dir of cache.
292 * mandatory: false| reinit necessary: true
293 * default value: cache
294 **/
295 public void setCacheDir(String cacheDir) {
296 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "cacheDir", cacheDir);
297 reinitNecessary = true;
298 }
299 /**
300 * @param useCache If true a Cache is used.
301 * mandatory: false| reinit necessary: true
302 * default value: true
303 **/
304 public void setUseCache(boolean useCache) {
305 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useCache", useCache);
306 reinitNecessary = true;
307 }
308 /**
309 * @param useCacheDatabase If true, H2 database is used, otherwise one file per query is written..
310 * mandatory: false| reinit necessary: true
311 * default value: false
312 **/
313 public void setUseCacheDatabase(boolean useCacheDatabase) {
314 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useCacheDatabase", useCacheDatabase);
315 reinitNecessary = true;
316 }
317 /**
318 * @param instances relevant instances e.g. positive and negative examples in a learning problem.
319 * mandatory: true| reinit necessary: true
320 * default value: null
321 **/
322 public void setInstances(Set<String> instances) {
323 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "instances", instances);
324 reinitNecessary = true;
325 }
326 /**
327 * @param recursionDepth recursion depth of KB fragment selection.
328 * mandatory: false| reinit necessary: true
329 * default value: 1
330 **/
331 public void setRecursionDepth(int recursionDepth) {
332 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "recursionDepth", recursionDepth);
333 reinitNecessary = true;
334 }
335 /**
336 * @param predefinedFilter the mode of the SPARQL Filter, use one of YAGO,SKOS,YAGOSKOS , YAGOSPECIALHIERARCHY, TEST.
337 * mandatory: false| reinit necessary: true
338 * default value: null
339 **/
340 public void setPredefinedFilter(String predefinedFilter) {
341 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "predefinedFilter", predefinedFilter);
342 reinitNecessary = true;
343 }
344 /**
345 * @param predefinedEndpoint the mode of the SPARQL Filter, use one of DBPEDIA, LOCAL, GOVTRACK, REVYU, MYOPENLINK, FACTBOOK.
346 * mandatory: false| reinit necessary: true
347 * default value: null
348 **/
349 public void setPredefinedEndpoint(String predefinedEndpoint) {
350 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "predefinedEndpoint", predefinedEndpoint);
351 reinitNecessary = true;
352 }
353 /**
354 * @param predefinedManipulator the mode of the Manipulator, use one of STANDARD, DBPEDIA-NAVIGATOR.
355 * mandatory: false| reinit necessary: true
356 * default value: null
357 **/
358 public void setPredefinedManipulator(String predefinedManipulator) {
359 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "predefinedManipulator", predefinedManipulator);
360 reinitNecessary = true;
361 }
362 /**
363 * @param predList list of all ignored roles.
364 * mandatory: false| reinit necessary: true
365 * default value: []
366 **/
367 public void setPredList(Set<String> predList) {
368 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "predList", predList);
369 reinitNecessary = true;
370 }
371 /**
372 * @param objList list of all ignored objects.
373 * mandatory: false| reinit necessary: true
374 * default value: []
375 **/
376 public void setObjList(Set<String> objList) {
377 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "objList", objList);
378 reinitNecessary = true;
379 }
380 /**
381 * @param saveExtractedFragment Specifies whether the extracted ontology is written to a file or not. The OWL file is written to the cache dir.Some DBpedia URI will make the XML invalid.
382 * mandatory: false| reinit necessary: true
383 * default value: false
384 **/
385 public void setSaveExtractedFragment(boolean saveExtractedFragment) {
386 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "saveExtractedFragment", saveExtractedFragment);
387 reinitNecessary = true;
388 }
389 /**
390 * @param replacePredicate rule for replacing predicates.
391 * mandatory: false| reinit necessary: true
392 * default value: []
393 **/
394 public void setReplacePredicate(List<StringTuple> replacePredicate) {
395 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "replacePredicate", replacePredicate);
396 reinitNecessary = true;
397 }
398 /**
399 * @param replaceObject rule for replacing predicates.
400 * mandatory: false| reinit necessary: true
401 * default value: []
402 **/
403 public void setReplaceObject(List<StringTuple> replaceObject) {
404 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "replaceObject", replaceObject);
405 reinitNecessary = true;
406 }
407 /**
408 * @param breakSuperClassRetrievalAfter stops a cyclic hierarchy after specified number of classes.
409 * mandatory: false| reinit necessary: true
410 * default value: 1000
411 **/
412 public void setBreakSuperClassRetrievalAfter(int breakSuperClassRetrievalAfter) {
413 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "breakSuperClassRetrievalAfter", breakSuperClassRetrievalAfter);
414 reinitNecessary = true;
415 }
416 /**
417 * @param useLits use Literals in SPARQL query.
418 * mandatory: false| reinit necessary: true
419 * default value: true
420 **/
421 public void setUseLits(boolean useLits) {
422 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useLits", useLits);
423 reinitNecessary = true;
424 }
425 /**
426 * @param getAllSuperClasses If true then all superclasses are retrieved until the most general class (owl:Thing) is reached..
427 * mandatory: false| reinit necessary: true
428 * default value: true
429 **/
430 public void setGetAllSuperClasses(boolean getAllSuperClasses) {
431 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "getAllSuperClasses", getAllSuperClasses);
432 reinitNecessary = true;
433 }
434 /**
435 * @param closeAfterRecursion gets all classes for all instances.
436 * mandatory: false| reinit necessary: true
437 * default value: true
438 **/
439 public void setCloseAfterRecursion(boolean closeAfterRecursion) {
440 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "closeAfterRecursion", closeAfterRecursion);
441 reinitNecessary = true;
442 }
443 /**
444 * @param getPropertyInformation gets all types for extracted ObjectProperties.
445 * mandatory: false| reinit necessary: true
446 * default value: false
447 **/
448 public void setGetPropertyInformation(boolean getPropertyInformation) {
449 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "getPropertyInformation", getPropertyInformation);
450 reinitNecessary = true;
451 }
452 /**
453 * @param dissolveBlankNodes determines whether Blanknodes are dissolved. This is a costly function..
454 * mandatory: false| reinit necessary: true
455 * default value: true
456 **/
457 public void setDissolveBlankNodes(boolean dissolveBlankNodes) {
458 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "dissolveBlankNodes", dissolveBlankNodes);
459 reinitNecessary = true;
460 }
461 /**
462 * @param useImprovedSparqlTupelAquisitor uses deeply nested SparqlQueries, according to recursion depth, still EXPERIMENTAL.
463 * mandatory: false| reinit necessary: true
464 * default value: false
465 **/
466 public void setUseImprovedSparqlTupelAquisitor(boolean useImprovedSparqlTupelAquisitor) {
467 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useImprovedSparqlTupelAquisitor", useImprovedSparqlTupelAquisitor);
468 reinitNecessary = true;
469 }
470 /**
471 * @param verbosity control verbosity of output for this component.
472 * mandatory: false| reinit necessary: true
473 * default value: warning
474 **/
475 public void setVerbosity(String verbosity) {
476 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "verbosity", verbosity);
477 reinitNecessary = true;
478 }
479 /**
480 * @param defaultGraphURIs a list of all default Graph URIs.
481 * mandatory: false| reinit necessary: true
482 * default value: []
483 **/
484 public void setDefaultGraphURIs(Set<String> defaultGraphURIs) {
485 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "defaultGraphURIs", defaultGraphURIs);
486 reinitNecessary = true;
487 }
488 /**
489 * @param namedGraphURIs a list of all named Graph URIs.
490 * mandatory: false| reinit necessary: true
491 * default value: []
492 **/
493 public void setNamedGraphURIs(Set<String> namedGraphURIs) {
494 ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "namedGraphURIs", namedGraphURIs);
495 reinitNecessary = true;
496 }
497
498 /**
499 * true, if this component needs reinitializsation.
500 * @return boolean
501 **/
502 public boolean isReinitNecessary(){
503 return reinitNecessary;
504 }
505
506
507 }