335 def detectTripleStoreConfiguration(self,triplestorename,triplestoreurl,detectnamespaces,prefixstore,progress,credentialUserName=None,credentialPassword=None,authmethod=None):
- 336 self.configuration=self.addDefaultConfigurationParameters(triplestorename,triplestoreurl,credentialUserName,credentialPassword,authmethod)
-
- 338 if self.testTripleStoreConnection(self.configuration[
"resource"],self.testQueries[
"available"],credentialUserName,credentialPassword,authmethod):
- 339 capabilitylist=self.detectTripleStoreType(self.configuration,credentialUserName,credentialPassword,authmethod,capabilitylist)
- 340 gottype=self.detectLiteralType(self.configuration,credentialUserName,credentialPassword,authmethod,capabilitylist)
- 341 equivprops=self.detectEquivalentProperties( self.configuration[
"resource"],credentialUserName, credentialPassword, authmethod,self.configuration)
- 342 equivcls=self.detectEquivalentClasses( self.configuration[
"resource"],credentialUserName, credentialPassword, authmethod,self.configuration)
-
- 344 self.message =
"SPARQL endpoint does not seem to include the following geometry relations:<ul><li>geo:asWKT</li><li>geo:asGeoJSON</li><li> geo:lat, geo:long</li></ul><br>A manual configuration is probably necessary to include this SPARQL endpoint if it contains geometries<br>Do you still want to add this SPARQL endpoint?"
- 345 self.feasibleConfiguration =
True
-
- 347 if isinstance(triplestoreurl,Graph):
- 348 for nstup
in triplestoreurl.namespaces():
- 349 if str(nstup[1])
in prefixstore[
"reversed"]:
- 350 self.configuration[
"prefixes"][prefixstore[
"reversed"][str(nstup[1])]] = str(nstup[0])
-
- 352 self.configuration[
"prefixes"][nstup[0]] = nstup[1]
- 353 elif detectnamespaces:
- 354 newtext =
"\n".join(progress.labelText().split(
"\n")[0:-1])
- 355 progress.setLabelText(newtext +
"\nCurrent Task: Namespace detection (1/3)")
- 356 res = set(self.detectNamespaces(-1,progress,self.configuration[
"resource"],credentialUserName,credentialPassword,authmethod) + self.detectNamespaces(0,progress,self.configuration[
"resource"],credentialUserName,credentialPassword,authmethod) + self.detectNamespaces(1,progress,self.configuration[
"resource"],credentialUserName,credentialPassword,authmethod))
-
-
- 359 if ns !=
"http://" and ns.startswith(
"http://"):
- 360 if ns
in prefixstore[
"reversed"]:
- 361 self.configuration[
"prefixes"][prefixstore[
"reversed"][ns]] = ns
-
- 363 self.configuration[
"prefixes"][
"ns" + str(i)] = ns
-
- 365 self.feasibleConfiguration =
True
- 366 QgsMessageLog.logMessage(str(self.configuration))
- 367 if self.testTripleStoreConnection(self.configuration[
"resource"],self.testQueries[
"hasDCTermsTitleLabel"]):
- 368 self.configuration[
"labelproperty"].append(
"http://purl.org/dc/terms/title")
- 369 if self.testTripleStoreConnection(self.configuration[
"resource"],self.testQueries[
"hasSKOSPrefLabel"]):
- 370 self.configuration[
"labelproperty"].append(
"http://www.w3.org/2004/02/skos/core#prefLabel")
- 371 self.configuration[
"classfromlabelquery"] =
"SELECT DISTINCT ?class ?label { ?class %%typeproperty%% <http://www.w3.org/2002/07/owl#Class> . \n"+SPARQLUtils.resolvePropertyToTriplePattern(
"%%labelproperty%%",
"?label",
"?class",self.configuration,
"OPTIONAL",
"")+
" FILTER(CONTAINS(?label,\"%%label%%\"))} LIMIT 100 "
-
- 373 "propertyfromlabelquery"] =
"SELECT DISTINCT ?class ?label { ?class %%typeproperty%% <http://www.w3.org/2002/07/owl#ObjectProperty> . \n"+SPARQLUtils.resolvePropertyToTriplePattern(
"%%labelproperty%%",
"?label",
"?class",self.configuration,
"OPTIONAL",
"")+
" FILTER(CONTAINS(?label,\"%%label%%\"))} LIMIT 100 "
-
- 375 self.detectGeometryObjectRelations()
-
- 377 self.message =
"URL does not depict a valid SPARQL Endpoint!"
- 378 self.feasibleConfiguration =
False
-
- 380 self.message=self.createCapabilityMessage(capabilitylist)
-
+ 368 def detectTripleStoreConfiguration(self,triplestorename,triplestoreurl,detectnamespaces,prefixstore,progress,credentialUserName=None,credentialPassword=None,authmethod=None):
+
369 self.configuration=self.addDefaultConfigurationParameters(triplestorename,triplestoreurl,credentialUserName,credentialPassword,authmethod)
+
+
371 if self.testTripleStoreConnection(self.configuration[
"resource"],self.testQueries[
"available"],credentialUserName,credentialPassword,authmethod):
+
372 capabilitylist=self.detectTripleStoreType(self.configuration,credentialUserName,credentialPassword,authmethod,capabilitylist)
+
373 gottype=self.detectLiteralType(self.configuration,credentialUserName,credentialPassword,authmethod,capabilitylist)
+
374 subclassof=self.detectSubClassOfProperty(self.configuration[
"resource"],credentialUserName, credentialPassword, authmethod,self.configuration)
+
375 equivprops=self.detectEquivalentProperties(self.configuration[
"resource"],credentialUserName, credentialPassword, authmethod,self.configuration)
+
376 equivcls=self.detectEquivalentClasses(self.configuration[
"resource"],credentialUserName, credentialPassword, authmethod,self.configuration)
+
+
378 self.message =
"SPARQL endpoint does not seem to include the following geometry relations:<ul><li>geo:asWKT</li><li>geo:asGeoJSON</li><li> geo:lat, geo:long</li></ul><br>A manual configuration is probably necessary to include this SPARQL endpoint if it contains geometries<br>Do you still want to add this SPARQL endpoint?"
+
379 self.feasibleConfiguration =
True
+
+
381 if isinstance(triplestoreurl,Graph):
+
382 for nstup
in triplestoreurl.namespaces():
+
383 if str(nstup[1])
in prefixstore[
"reversed"]:
+
384 self.configuration[
"prefixes"][prefixstore[
"reversed"][str(nstup[1])]] = str(nstup[0])
+
+
386 self.configuration[
"prefixes"][nstup[0]] = nstup[1]
+
387 elif detectnamespaces:
+
388 newtext =
"\n".join(progress.labelText().split(
"\n")[0:-1])
+
389 progress.setLabelText(newtext +
"\nCurrent Task: Namespace detection (1/3)")
+
390 res = set(self.detectNamespaces(-1,progress,self.configuration[
"resource"],credentialUserName,credentialPassword,authmethod) + self.detectNamespaces(0,progress,self.configuration[
"resource"],credentialUserName,credentialPassword,authmethod) + self.detectNamespaces(1,progress,self.configuration[
"resource"],credentialUserName,credentialPassword,authmethod))
+
+
+
393 if ns !=
"http://" and ns.startswith(
"http://"):
+
394 if ns
in prefixstore[
"reversed"]:
+
395 self.configuration[
"prefixes"][prefixstore[
"reversed"][ns]] = ns
+
+
397 self.configuration[
"prefixes"][
"ns" + str(i)] = ns
+
+
399 self.feasibleConfiguration =
True
+
400 QgsMessageLog.logMessage(str(self.configuration))
+
401 if self.testTripleStoreConnection(self.configuration[
"resource"],self.testQueries[
"hasDCTermsTitleLabel"]):
+
402 self.configuration[
"labelproperty"].append(
"http://purl.org/dc/terms/title")
+
403 if self.testTripleStoreConnection(self.configuration[
"resource"],self.testQueries[
"hasSKOSPrefLabel"]):
+
404 self.configuration[
"labelproperty"].append(
"http://www.w3.org/2004/02/skos/core#prefLabel")
+
405 self.configuration[
"classfromlabelquery"] =
"SELECT DISTINCT ?class ?label { ?class %%typeproperty%% <http://www.w3.org/2002/07/owl#Class> . \n"+SPARQLUtils.resolvePropertyToTriplePattern(
"%%labelproperty%%",
"?label",
"?class",self.configuration,
"OPTIONAL",
"")+
" FILTER(CONTAINS(?label,\"%%label%%\"))} LIMIT 100 "
+
+
407 "propertyfromlabelquery"] =
"SELECT DISTINCT ?class ?label { ?class %%typeproperty%% <http://www.w3.org/2002/07/owl#ObjectProperty> . \n"+SPARQLUtils.resolvePropertyToTriplePattern(
"%%labelproperty%%",
"?label",
"?class",self.configuration,
"OPTIONAL",
"")+
" FILTER(CONTAINS(?label,\"%%label%%\"))} LIMIT 100 "
+
+
409 self.detectGeometryObjectRelations()
+
+
411 self.message =
"URL does not depict a valid SPARQL Endpoint!"
+
412 self.feasibleConfiguration =
False
+
+
414 self.message=self.createCapabilityMessage(capabilitylist)
+
-References GraphUtils.addDefaultConfigurationParameters(), GraphUtils.configuration, GraphUtils.createCapabilityMessage(), GraphUtils.detectEquivalentClasses(), GraphUtils.detectEquivalentProperties(), GraphUtils.detectGeometryObjectRelations(), GraphUtils.detectLiteralType(), GraphUtils.detectNamespaces(), GraphUtils.detectTripleStoreType(), GraphUtils.feasibleConfiguration, GraphUtils.message, GraphUtils.testQueries, and GraphUtils.testTripleStoreConnection().
+References GraphUtils.addDefaultConfigurationParameters(), GraphUtils.configuration, GraphUtils.createCapabilityMessage(), GraphUtils.detectEquivalentClasses(), GraphUtils.detectEquivalentProperties(), GraphUtils.detectGeometryObjectRelations(), GraphUtils.detectLiteralType(), GraphUtils.detectNamespaces(), GraphUtils.detectSubClassOfProperty(), GraphUtils.detectTripleStoreType(), GraphUtils.feasibleConfiguration, GraphUtils.message, GraphUtils.testQueries, and GraphUtils.testTripleStoreConnection().