Skip to content

Commit

Permalink
Updated code to use same uris as arcgis version
Browse files Browse the repository at this point in the history
  • Loading branch information
fritosxii committed Mar 24, 2023
1 parent a548b78 commit 7812495
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kwg_geoenrichment/kwg_geoenrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
# Import the code for the dialog

_SPARQL_ENDPOINT_DICT = {
"KnowWhereGraph": "https://stko-kwg.geog.ucsb.edu/graphdb/repositories/KWG",
"KnowWhereGraph - Stage": "https://staging.knowwheregraph.org/graphdb/repositories/KWG"
"KnowWhere Graph V2 (stable)": "https://stko-kwg.geog.ucsb.edu/graphdb/repositories/KWG-V2-Vienna",
"KnowWhere Graph V3 (beta)": "https://stko-kwg.geog.ucsb.edu/sparql"
}

class kwg_geoenrichment:
Expand Down
5 changes: 3 additions & 2 deletions kwg_geoenrichment/kwg_sparqlquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def getEntityValuesFromGeometry(self,

try:
while keepPaginating:
geoPrefix = "kwg-ont" if sparql_endpoint=="https://stko-kwg.geog.ucsb.edu/graphdb/repositories/KWG-V2-Vienna" else "geo"
queryString = """
select distinct ?entity where {
values ?userWKT {"%s"^^geo:wktLiteral}.
Expand All @@ -54,7 +55,7 @@ def getEntityValuesFromGeometry(self,
?arGeo2 geo:asWKT ?arWKT2.
FILTER(geof:sfIntersects(?userWKT, ?arWKT2) || geof:sfWithin(?userWKT, ?arWKT2)).
?adminRegion3 kwg-ont:sfWithin ?adminRegion2.
?adminRegion3 %s:sfWithin ?adminRegion2.
?adminRegion3 a kwg-ont:AdministrativeRegion_3.
?adminRegion3 geo:hasGeometry ?arGeo3.
?arGeo3 geo:asWKT ?arWKT3.
Expand All @@ -69,7 +70,7 @@ def getEntityValuesFromGeometry(self,
{?entity ?p ?s2Cell.} union {?s2Cell ?p ?entity.}
?entity a geo:Feature.
}
""" % (wkt_literal)
""" % (wkt_literal, geoPrefix)

query = queryPrefix + queryString
query += "ORDER BY ?entity "
Expand Down

0 comments on commit 7812495

Please sign in to comment.