Geosparql - problem querying spatial data

Hi,

I encountered a problem querying spatial data based on multiple RDF-files.
I created a spatial index file and inserted an IFC-RDF file as well as an SHP-RDF file.
Both files contain spatial WKT-literals.

next query works without a problem.

PREFIX geontology:  <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX units: <http://www.opengis.net/def/uom/OGC/1.0/>
PREFIX geo:     <http://www.opengis.net/ont/geosparql#>
PREFIX sf:      <http://www.opengis.net/ont/sf#>
PREFIX dc:      <http://purl.org/dc/terms/>
PREFIX georesource:  <http://geoknow.eu/geodata#>

SELECT ?dist
WHERE {
	?loc1  georesource:name "Hariiss"@en;
          	geo:hasGeometry ?geom_point .
    ?geom_point  geo:asWKT ?point .
	?loc2  georesource:name "Trewellard Meadery"@en;
           	geo:hasGeometry ?geom_point2 .
    ?geom_point2  geo:asWKT ?point2 .
  	bind(geof:distance(?geom_point,?geom_point2,units:metre) as ?dist)
  }
RES: dist   10182.827992981162

But next query gives error: “Internal Server Error”:
PREFIX geontology: http://www.opengis.net/ont/geosparql#
PREFIX geof: http://www.opengis.net/def/function/geosparql/
PREFIX units: http://www.opengis.net/def/uom/OGC/1.0/
PREFIX geo: http://www.opengis.net/ont/geosparql#
PREFIX sf: http://www.opengis.net/ont/sf#
PREFIX dc: http://purl.org/dc/terms/
PREFIX georesource: http://geoknow.eu/geodata#

SELECT ?f
WHERE { 
?f geo:hasGeometry ?g .
?g geo:asWKT ?gWKT .
FILTER (geof:sfWithin(?gWKT, 
      "POLYGON ((-5.540361 50.129262, -5.540448 50.129043, -5.540282 50.129045, -5.540243 50.129257 ))"^^sf:wktLiteral)) 
  }

Anyone who could help me solve this problem?
thanks!

Filip

Hi Filip,

Did you configure Stardog to use enhanced polygons?
If so, what’s the stacktrace in stardog.log?

-pedro

Hi Pedro,

thank for your quick reply.
I indeed didn’t configure my Stardog to use enhanced polygons.

In the meanwhile tried to configure my stardog.properties file but not sure i managed to do that properly.
I restarted stardog server, but face the same problems performing the spatial query.
Probably stardog.properties is still not configured correct. -> I will need to do a bit more research on that part.

thanks already for the suggestion about enhanced polygons!

Filip

Did you include the JTS jar and is it somewhere on the Stardog classpath? ie. $STARDOG_EXT or $STARDOG_HOME/server/ext

I did indeed download the JTS jar. It’s located on the location as you mentioned.

What exact jar did you download? I’m always a little confused when trying to locate the right one. There’s jts and jts-core artifacts and one from vividsolutions at 1.14 and one from location tech at 1.15. The Stardog docs recommends com.vividsolutions:jts-core:1.14

If you would like to include your stardog.properties file I’d be happy to take a look and see if I can spot anything wrong to help get you going.

I did download the jts-core-1.14.0.jar and located it on STARDOG_HOME/server/ext.

the properties-file is located on STARDOG_HOME.
I took the one which is posted on GitHub and opened it on my GitHub Desktop.
(attached a jpg of it because attachment of file itself gave an error.)

thanks already for your assistance.

What’s the output from running the following command?

stardog-admin metadata get myDatabase

Are there errors or warnings in stardog.log?

output from running stardog -admin metadata get Gebouw5WKTDb
gives
C:\Users\fvdl\Documents\Filip\Data\stardog-5.2.2\bin>stardog-admin metadata get Gebouw5WKTDb
±------------------------------------------±---------------------------------------------------------------------------------+
| Option | Value |
±------------------------------------------±---------------------------------------------------------------------------------+
| database.archetypes | |
| database.connection.timeout | 10m |
| database.creator | admin |
| database.name | Gebouw5WKTDb |
| database.namespaces | rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#, |
| | rdfs=http://www.w3.org/2000/01/rdf-schema#, |
| | xsd=http://www.w3.org/2001/XMLSchema#, owl=http://www.w3.org/2002/07/owl#, |
| | stardog=tag:stardog:api:, =http://api.stardog.com/, |
| | ifcowl=http://www.buildingsmart-tech.org/ifcOWL/IFC2X3_TC1#, |
| | inst=http://linkedbuildingdata.net/ifc/resources20180309_133804/, |
| | list=http://www.co-ode.org/ontologies/list.owl#, |
| | express=http://purl.org/voc/express#, geo=http://www.opengis.net/ont/geosparql#, |
| | sf=http://www.opengis.net/ont/sf#, georesource=http://geoknow.eu/geodata#, |
| | dc=http://purl.org/dc/terms/ |
| database.online | true |
| database.time.creation | 2018-04-05T16:51:43.634+02:00 |
| database.time.modification | 2018-04-05T16:54:14.443+02:00 |
| docs.default.rdf.extractors | tika |
| docs.default.text.extractors | tika |
| docs.filesystem.uri | file:/// |
| docs.opennlp.models.path | |
| docs.path | docs |
| docs.s3.protocol | HTTPS |
| graphql.default.limit | 10000 |
| icv.active.graphs | * |
| icv.consistency.automatic | false |
| icv.enabled | false |
| icv.reasoning.enabled | false |
| index.differential.enable.limit | 500000 |
| index.differential.merge.limit | 20000 |
| index.differential.size | 0 |
| index.disk.page.count.total | 140 |
| index.disk.page.count.used | 115 |
| index.disk.page.fill.ratio | 0.8623397163722826 |
| index.last.tx | 5069d569-b264-421d-b4b6-50341c9939ff |
| index.literals.canonical | true |
| index.lucene.mmap | true |
| index.named.graphs | true |
| index.persist | true |
| index.persist.sync | true |
| index.size | 16344 |
| index.statistics.update.automatic | true |
| index.type | Disk |
| literal.comparison.extended | true |
| preserve.bnode.ids | true |
| progress.monitor.enabled | true |
| query.all.graphs | false |
| query.plan.reuse | ALWAYS |
| query.pp.contexts | false |
| query.timeout | 5m |
| reasoning.approximate | false |
| reasoning.classify.eager | true |
| reasoning.consistency.automatic | false |
| reasoning.punning.enabled | false |
| reasoning.sameas | OFF |
| reasoning.schema.graphs | * |
| reasoning.schema.timeout | 1m |
| reasoning.type | SL |
| reasoning.virtual.graph.enabled | true |
| search.default.limit | -1 |
| search.enabled | false |
| search.index.datatypes | http://www.w3.org/2001/XMLSchema#string, |
| | http://www.w3.org/1999/02/22-rdf-syntax-ns#langString |
| search.reindex.tx | true |
| search.wildcard.search.enabled | false |
| security.named.graphs | false |
| spatial.enabled | true |
| spatial.index.version | 1 |
| spatial.precision | 11 |
| strict.parsing | true |
| transaction.isolation | SNAPSHOT |
| transaction.logging | false |
| transaction.logging.ignore.startup.errors | true |
| transaction.logging.rotation.remove | true |
| transaction.logging.rotation.size | 524288000 |
| versioning.directory | versioning |
| versioning.enabled | false

restarted stardog just now, this is the logfile since restart.

w.ErrorHandling.lambda$safeDispatch$1(ErrorHandling.java:71) ~[stardog-protocols-http-server-5.2.2.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_161]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_161]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_161]
 INFO  2018-04-05 21:06:54,834 [main] com.complexible.stardog.virtual.DefaultVirtualGraphRegistry:syncCache(176): Initializing R2RML registry
        INFO  2018-04-05 21:06:54,887 [main] com.complexible.stardog.virtual.DefaultVirtualGraphRegistry:syncCache(185): Loaded R2RML registry with 0 sources
        INFO  2018-04-05 21:06:57,161 [main] com.complexible.stardog.StardogKernel:start(2246): Initializing Stardog
        INFO  2018-04-05 21:07:03,870 [main] com.complexible.stardog.StardogKernel:write(77): Loading Databases: 80% complete in 00:00:06
        INFO  2018-04-05 21:07:05,345 [main] com.complexible.stardog.StardogKernel:write(77): Loading Databases: 90% complete in 00:00:08
        INFO  2018-04-05 21:07:05,365 [main] com.complexible.stardog.StardogKernel:write(77): Loading Databases: 100% complete in 00:00:08
        INFO  2018-04-05 21:07:05,365 [main] com.complexible.stardog.StardogKernel:write(77): 
        INFO  2018-04-05 21:07:05,366 [main] com.complexible.stardog.StardogKernel:write(77): Loading Databases finished in 00:00:08.198
        INFO  2018-04-05 21:07:06,173 [main] com.complexible.stardog.cli.impl.ServerStart:call(233): Memory options
        INFO  2018-04-05 21:07:06,174 [main] com.complexible.stardog.cli.impl.ServerStart:call(234): Memory mode: DEFAULT
        INFO  2018-04-05 21:07:06,174 [main] com.complexible.stardog.cli.impl.ServerStart:call(235): Min Heap Size: 2,0G
        INFO  2018-04-05 21:07:06,174 [main] com.complexible.stardog.cli.impl.ServerStart:call(236): Max Heap Size: 1,9G
        INFO  2018-04-05 21:07:06,174 [main] com.complexible.stardog.cli.impl.ServerStart:call(237): Max Direct Mem: 1,0G
        INFO  2018-04-05 21:07:06,174 [main] com.complexible.stardog.cli.impl.ServerStart:call(238): Max Mapped Mem: 115M
        INFO  2018-04-05 21:07:06,174 [main] com.complexible.stardog.cli.impl.ServerStart:call(239): System Memory: 16G

Can you run a query that produces the “Internal server error” and then check the logs?

ERROR 2018-04-05 21:22:32,277 [stardog-user-9] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(235): An unexpected exception was handled by the server
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.ExecutionException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:207) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:190) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.executeQuery(QueryPanelService.java:167) ~[stardog-webconsole-annex-5.2.2.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.post(QueryPanelService.java:120) ~[stardog-webconsole-annex-5.2.2.jar:?]
	at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:196) ~[stardog-protocols-http-server-5.2.2.jar:?]
	at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) ~[shiro-core-1.2.3.jar:1.2.3]
	at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) ~[shiro-core-1.2.3.jar:1.2.3]
	at com.stardog.http.server.undertow.ErrorHandling.lambda$safeDispatch$1(ErrorHandling.java:71) ~[stardog-protocols-http-server-5.2.2.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_161]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_161]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_161]
Caused by: com.complexible.stardog.plan.eval.ExecutionException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.plan.eval.QueryEngine.planFor(QueryEngine.java:273) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:331) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:279) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:215) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:204) ~[stardog-5.2.2.jar:?]
	... 10 more
Caused by: com.complexible.stardog.plan.PlanException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:528) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:475) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:99) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.planFor(QueryEngine.java:270) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:331) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:279) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:215) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:204) ~[stardog-5.2.2.jar:?]
	... 10 more
Caused by: java.lang.UnsupportedOperationException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.plan.filter.functions.FunctionRegistry.get(FunctionRegistry.java:163) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$ExpressionBuilder.visit(QueryParserImpl.java:3790) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$ExpressionBuilder.visit(QueryParserImpl.java:3634) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTFunctionCall.jjtAccept(ASTFunctionCall.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:1247) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTConstraint.jjtAccept(ASTConstraint.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:710) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTScope.jjtAccept(ASTScope.java:22) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.SimpleNode.childrenAccept(SimpleNode.java:162) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:739) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTGraphPatternGroup.jjtAccept(ASTGraphPatternGroup.java:35) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:2729) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTWhereClause.jjtAccept(ASTWhereClause.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.query(QueryParserImpl.java:2530) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:2325) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTSelectQuery.jjtAccept(ASTSelectQuery.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:499) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:475) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:99) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.planFor(QueryEngine.java:270) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:331) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:279) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:215) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:204) ~[stardog-5.2.2.jar:?]
	... 10 more
ERROR 2018-04-05 21:26:08,234 [stardog-user-10] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(235): An unexpected exception was handled by the server
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.ExecutionException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:207) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:190) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.executeQuery(QueryPanelService.java:167) ~[stardog-webconsole-annex-5.2.2.jar:?]
	at com.complexible.stardog.protocols.http.annex.QueryPanelService.post(QueryPanelService.java:120) ~[stardog-webconsole-annex-5.2.2.jar:?]
	at com.stardog.http.server.undertow.jaxrs.ExtractRoutes.lambda$handleIt$5(ExtractRoutes.java:196) ~[stardog-protocols-http-server-5.2.2.jar:?]
	at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120) ~[shiro-core-1.2.3.jar:1.2.3]
	at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108) ~[shiro-core-1.2.3.jar:1.2.3]
	at com.stardog.http.server.undertow.ErrorHandling.lambda$safeDispatch$1(ErrorHandling.java:71) ~[stardog-protocols-http-server-5.2.2.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_161]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_161]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_161]
Caused by: com.complexible.stardog.plan.eval.ExecutionException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.plan.eval.QueryEngine.planFor(QueryEngine.java:273) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:331) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:279) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:215) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:204) ~[stardog-5.2.2.jar:?]
	... 10 more
Caused by: com.complexible.stardog.plan.PlanException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:528) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:475) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:99) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.planFor(QueryEngine.java:270) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:331) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:279) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:215) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:204) ~[stardog-5.2.2.jar:?]
	... 10 more
Caused by: java.lang.UnsupportedOperationException: Unrecognized function: http://www.opengis.net/def/function/geosparql/sfWithin
	at com.complexible.stardog.plan.filter.functions.FunctionRegistry.get(FunctionRegistry.java:163) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$ExpressionBuilder.visit(QueryParserImpl.java:3790) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$ExpressionBuilder.visit(QueryParserImpl.java:3634) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTFunctionCall.jjtAccept(ASTFunctionCall.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:1247) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTConstraint.jjtAccept(ASTConstraint.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:710) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTScope.jjtAccept(ASTScope.java:22) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.SimpleNode.childrenAccept(SimpleNode.java:162) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:739) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTGraphPatternGroup.jjtAccept(ASTGraphPatternGroup.java:35) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:2729) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTWhereClause.jjtAccept(ASTWhereClause.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.query(QueryParserImpl.java:2530) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:2325) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl$GeneratePlan.visit(QueryParserImpl.java:629) ~[stardog-5.2.2.jar:?]
	at com.complexible.common.rdf.query.parser.sparql.ast.ASTSelectQuery.jjtAccept(ASTSelectQuery.java:19) ~[stardog-utils-rdf-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:499) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.parser.QueryParserImpl.parseQuery(QueryParserImpl.java:475) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.PlanContext.planFor(PlanContext.java:99) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.planFor(QueryEngine.java:270) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:331) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.getExecutablePlan(QueryEngine.java:279) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.plan.eval.QueryEngine.executeSelect(QueryEngine.java:215) ~[stardog-5.2.2.jar:?]
	at com.complexible.stardog.query.DefaultQueryFactory$TupleQuery.execute(DefaultQueryFactory.java:204) ~[stardog-5.2.2.jar:?]
	... 10 more

try using geof:within rather than geof:sfWithin. From the documentation that’s the name of the function that Stardog supports although I can’t find a reference to a geof:within in the GeoSPARQL spec just geof.sfWithin.

Zachary,

geof:within didn’t do the trick immediately, but I saw a loose end in my polygon , i didn’t close it. So perhaps this was an error as well.
new query looks like this and gives me a result!

PREFIX geontology:  <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX units: <http://www.opengis.net/def/uom/OGC/1.0/>
PREFIX geo:     <http://www.opengis.net/ont/geosparql#>
PREFIX sf:      <http://www.opengis.net/ont/sf#>
PREFIX georesource:  <http://geoknow.eu/geodata#>

SELECT ?f
WHERE {
  ?f geo:hasGeometry ?g .
  
FILTER(geof:Within(?g,
     "POLYGON ((-5.540448 50.129262, -5.540282 50.129262, -5.540282 50.129045, -5.540448 50.129045, -5.540448 50.129262))"^^geo:wktLiteral))
}

SPARQL Results(returned in 203 ms)
f
 inst:IfcSite_2184
 georesource:points_2184
 georesource:points_682270771
 georesource:points_682270769

massive thanks for all your help!

Filip

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.