Skip to content

Commit

Permalink
load graph from uri in empty config
Browse files Browse the repository at this point in the history
  • Loading branch information
situx committed Jan 30, 2025
1 parent 648fc83 commit 65409ad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions util/sparqlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests
from urllib.request import urlopen
import json

from ..dialogs.info.errormessagebox import ErrorMessageBox
from osgeo import ogr
from qgis.core import Qgis, QgsGeometry,QgsVectorLayer, QgsMessageLog
Expand Down Expand Up @@ -208,8 +209,12 @@ def executeQuery(triplestoreurl, query,triplestoreconf=None):
return "Exists error"
return False
else:
graph=triplestoreurl["instance"]
QgsMessageLog.logMessage("Graph: " + str(triplestoreurl), MESSAGE_CATEGORY, Qgis.Info)
if "instance" in triplestoreurl:
graph=triplestoreurl["instance"]
else:
graph=SPARQLUtils.loadGraph(str(triplestoreurl["url"]))
triplestoreurl["instance"]=graph
#QgsMessageLog.logMessage("Graph: " + str(triplestoreurl), MESSAGE_CATEGORY, Qgis.Info)
QgsMessageLog.logMessage("Query: " + str(query).replace("<", "").replace(">", ""), MESSAGE_CATEGORY, Qgis.Info)
if graph is not None:
if "CONSTRUCT" in str(query):
Expand Down

0 comments on commit 65409ad

Please sign in to comment.