GEOSPARQL Within

19 views
Skip to first unread message

Chris Morris

unread,
Jan 27, 2017, 6:09:35 AM1/27/17
to Stardog
I'm struggling with the geosparql in particular geo:Within.

The documentation I can find at http://www.opengis.net/doc/IS/geosparql/1.0  states that it needs a geo:SpatialObject and that a geo:Feature is a type of geo:SpatialObject. I have a number of features which have points for there location. When I run

    SELECT Distinct *
WHERE {  
  ?g geo:asWKT ?gWKT . 
}


I get 25 points returned, all of which should be in the (rather large) polygon defined below.

However

SELECT *
WHERE {  
      ?g geo:asWKT ?gWKT .
      FILTER geof:within( ?g ,"POLYGON(51.45, -0.115,51.52,-0.08)"^^geo:wktLiteral  ) .
    }


Causes "Internal server error".

Any idea's what I'm doing wrong? I'm new to geosparql, though passingly familiar with standard sparql.
If I run the query from the command line I get "The query returned a partail response. This is normally due to a server timeout" however the time-out is set to 5 minutes and I get the message instantly (as far as I can see). I'm using version 4.2.3

Many thanks for your time

Chris Morris

Zachary Whitley

unread,
Jan 27, 2017, 6:15:35 AM1/27/17
to sta...@clarkparsia.com
Can you send and errors or warnings you're seeing in stardog.log? It should be in your $STARDOG_HOME directory
--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

Chris Morris

unread,
Jan 27, 2017, 7:53:03 AM1/27/17
to Stardog
Certainly:

Caused by: java.text.ParseException: Expected [(] found [5]
    at com.spatial4j.core.io.WktShapeParser$State.nextExpect(WktShapeParser.java:493) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.io.jts.JtsWktShapeParser.coordinateSequence(JtsWktShapeParser.java:220) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.io.jts.JtsWktShapeParser.coordinateSequenceList(JtsWktShapeParser.java:206) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.io.jts.JtsWktShapeParser.polygon(JtsWktShapeParser.java:160) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.io.jts.JtsWktShapeParser.parsePolygonShape(JtsWktShapeParser.java:127) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.io.jts.JtsWktShapeParser.parseShapeByType(JtsWktShapeParser.java:89) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.io.WktShapeParser.parseIfSupported(WktShapeParser.java:114) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.io.WktShapeParser.parse(WktShapeParser.java:86) ~[spatial4j-0.4.1.jar:?]
    at com.spatial4j.core.context.SpatialContext.readShapeFromWkt(SpatialContext.java:294) ~[spatial4j-0.4.1.jar:?]
    at com.complexible.stardog.spatial.db.query.WithinPropertyFunction$WithinOperator.compute(WithinPropertyFunction.java:300) ~[stardog-spatial-core-4.2.3.jar:?]
    at com.complexible.stardog.spatial.db.query.SpatialOperator.computeNext(SpatialOperator.java:119) ~[stardog-spatial-core-4.2.3.jar:?]
    at com.complexible.stardog.spatial.db.query.SpatialOperator.computeNext(SpatialOperator.java:44) ~[stardog-spatial-core-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.FilterOp.computeNext(FilterOp.java:83) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.FilterOp.computeNext(FilterOp.java:28) ~[stardog-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:83) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.SingleProjectionOp.computeNext(SingleProjectionOp.java:33) ~[stardog-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.LazyUnsortedGroupify$1.computeNext(GroupifyAlgorithms.java:139) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.LazyUnsortedGroupify$1.computeNext(GroupifyAlgorithms.java:130) ~[stardog-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.AbstractGroupOp.computeNext(AbstractGroupOp.java:141) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.AbstractGroupOp.computeNext(AbstractGroupOp.java:34) ~[stardog-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.DistinctOp.computeNext(DistinctOp.java:53) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.DistinctOp.computeNext(DistinctOp.java:21) ~[stardog-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.SliceOp._hasNext(SliceOp.java:87) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:95) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.impl.SliceOp.computeNext(SliceOp.java:26) ~[stardog-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:115) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.util.AutoCloseOperator.computeNext(AutoCloseOperator.java:25) ~[stardog-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.tryToComputeNext(AbstractSkippingIterator.java:143) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.common.collect.AbstractSkippingIterator.hasNext(AbstractSkippingIterator.java:130) ~[stardog-utils-common-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:110) ~[stardog-4.2.3.jar:?]
    at com.complexible.stardog.plan.eval.operator.util.OpBasedBindingSetIteration.computeNext(OpBasedBindingSetIteration.java:34) ~[stardog-4.2.3.jar:?]
    at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) ~[guava-18.0.jar:?]
    at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) ~[guava-18.0.jar:?]
    at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:77) ~[stardog-utils-rdf-4.2.3.jar:?]

Is the last stack trace \ error in the log file.

Many thanks

Chris Morris

Stephen Nowell

unread,
Jan 27, 2017, 7:58:43 AM1/27/17
to sta...@clarkparsia.com
Hi Chris,

Have you downloaded/included the JTS jar as described in the docs [1] to enable the use of POLYGONs? If so, have you set `spatial.use.jts=true` in your stardog properties?

Cheers,
Stephen

[1] http://docs.stardog.com/#_enhanced_polygons

Zachary Whitley

unread,
Jan 27, 2017, 8:03:11 AM1/27/17
to sta...@clarkparsia.com
In addition to that I think the syntax for your polygon wit is a bit off. 

Zachary Whitley

unread,
Jan 27, 2017, 8:26:29 AM1/27/17
to sta...@clarkparsia.com
I believe you need a second set of parentheses and it should be long lat points separated by a space with points separated by a comma. 

Chris Morris

unread,
Jan 27, 2017, 10:04:02 AM1/27/17
to Stardog
Many thanks for your assistance thus far. I have placed the jts-core-1.14.0.jar file in the /client/api directory. Is that on the classpath? As you can tell I'm not normally a Java person. I have set spatial.use.jts=true in stardog.properties as well as spatial.enabled = true in the database.properties file used to create the database.

I have taken on board your advice re:polygon definition and now I'm running this.

SELECT Distinct ?g WHERE {  
 
?g geo:asWKT ?gWKT .
  FILTER
(geof:within( ?g ,"POLYGON((-0.05 51.1 , 0.25 51.1 ,-0.05 52,0.25 52 ))"^^geo:wktLiteral  ))  
}



I am now using a database create just for testing this problem, holding geosparql (<http://www.opengis.net/ont/geosparql>), (<http://www.w3.org/2003/01/geo/wgs84_pos>) and nothing else - no instance data at this time and I still just get the same "Internal server error" message.

I deleted the the log file, restarted the program and then ran the query. The log now looks like this:

INFO  2017-01-27 14:38:18,247 [main] com.complexible.stardog.virtual.DefaultVirtualGraphRegistry:syncCache(162): Initializing R2RML registry
INFO  2017-01-27 14:38:18,275 [main] com.complexible.stardog.virtual.DefaultVirtualGraphRegistry:syncCache(171): Loaded R2RML registry with 0 sources
INFO  2017-01-27 14:38:19,341 [main] com.complexible.stardog.StardogKernel:start(1871): Initializing Stardog

************************************************************
This copy of Stardog is licensed to Chris Morris (), BCCRE
This is a trial Enterprise license
This license will expire in 25 days on Tue Feb 21 18:07:11 GMT 2017
************************************************************

                                                             :;  
                                      ;;                   `;`:  
  `'+',    ::                        `++                    `;:`  
 +###++,  ,#+                        `++                    .    
 ##+.,',  '#+                         ++                     +    
,##      ####++  ####+:   ##,++` .###+++   .####+    ####++++#    
`##+     ####+'  ##+#++   ###++``###'+++  `###'+++  ###`,++,:    
 ####+    ##+        ++.  ##:   ###  `++  ###  `++` ##`  ++:      
  ###++,  ##+        ++,  ##`   ##;  `++  ##:   ++; ##,  ++:      
    ;+++  ##+    ####++,  ##`   ##:  `++  ##:   ++' ;##'#++      
     ;++  ##+   ###  ++,  ##`   ##'  `++  ##;   ++:  ####+        
,.   +++  ##+   ##:  ++,  ##`   ###  `++  ###  .++  '#;          
,####++'  +##++ ###+#+++` ##`   :####+++  `####++'  ;####++`      
`####+;    ##++  ###+,++` ##`    ;###:++   `###+;   `###++++      
                                                    ##   `++      
                                                   .##   ;++      
                                                    #####++`      
                                                     `;;;.        
************************************************************


Stardog server 4.2.3 started on Fri Jan 27 14:38:20 GMT 2017.

Stardog server is listening on all network interfaces.
HTTP server available at http://localhost:5820.

STARDOG_HOME=/data/stardoghome

INFO  2017-01-27 14:38:20,589 [main] com.complexible.stardog.cli.impl.ServerStart:call(249): Memory options
INFO  2017-01-27 14:38:20,590 [main] com.complexible.stardog.cli.impl.ServerStart:call(250): Min Heap Size: 2.0G
INFO  2017-01-27 14:38:20,590 [main] com.complexible.stardog.cli.impl.ServerStart:call(251): Max Heap Size: 1.9G
INFO  2017-01-27 14:38:20,590 [main] com.complexible.stardog.cli.impl.ServerStart:call(252): Max Off-Heap : 1.0G
INFO  2017-01-27 14:38:20,590 [main] com.complexible.stardog.cli.impl.ServerStart:call(253): System Memory: 8.0G
ERROR 2017-01-27 14:38:44,370 [StardogServer.WorkerGroup-0] com.complexible.stardog.protocols.http.server.HttpMessageEncoder:write(161): There was an error while encoding the response
com.complexible.common.protocols.EncodingException: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:473) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$2.encode(ResponseBodyEncoders.java:101) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.annex.QueryPanelEncoder.encode(QueryPanelEncoder.java:112) ~[stardog-webconsole-annex-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.HttpMessageEncoder.write(HttpMessageEncoder.java:158) [stardog-protocols-http-server-4.2.3.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]
Caused by: org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:81) ~[stardog-utils-rdf-4.2.3.jar:?]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    ... 11 more
Caused by: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.stardog.spatial.db.query.WithinPropertyFunction$WithinOperator.compute(WithinPropertyFunction.java:334) ~[stardog-spatial-core-4.2.3.jar:?]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    ... 11 more
Caused by: java.text.ParseException: Expected [(] found [-]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    ... 11 more
ERROR 2017-01-27 14:38:44,390 [StardogServer.WorkerGroup-0] com.complexible.stardog.protocols.http.server.HttpMessageEncoder:write(171): There was an error writing the HTTP response
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:81) ~[stardog-utils-rdf-4.2.3.jar:?]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$2.encode(ResponseBodyEncoders.java:101) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.annex.QueryPanelEncoder.encode(QueryPanelEncoder.java:112) ~[stardog-webconsole-annex-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.HttpMessageEncoder.write(HttpMessageEncoder.java:158) [stardog-protocols-http-server-4.2.3.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]
Caused by: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.stardog.spatial.db.query.WithinPropertyFunction$WithinOperator.compute(WithinPropertyFunction.java:334) ~[stardog-spatial-core-4.2.3.jar:?]
    ... 15 more
Caused by: java.text.ParseException: Expected [(] found [-]
    ... 15 more
ERROR 2017-01-27 14:39:32,211 [StardogServer.WorkerGroup-0] com.complexible.stardog.protocols.http.server.HttpMessageEncoder:write(161): There was an error while encoding the response
com.complexible.common.protocols.EncodingException: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:473) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$2.encode(ResponseBodyEncoders.java:101) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.annex.QueryPanelEncoder.encode(QueryPanelEncoder.java:112) ~[stardog-webconsole-annex-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.HttpMessageEncoder.write(HttpMessageEncoder.java:158) [stardog-protocols-http-server-4.2.3.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]
Caused by: org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:81) ~[stardog-utils-rdf-4.2.3.jar:?]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    ... 11 more
Caused by: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.stardog.spatial.db.query.WithinPropertyFunction$WithinOperator.compute(WithinPropertyFunction.java:334) ~[stardog-spatial-core-4.2.3.jar:?]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    ... 11 more
Caused by: java.text.ParseException: Expected [(] found [-]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    ... 11 more
ERROR 2017-01-27 14:39:32,213 [StardogServer.WorkerGroup-0] com.complexible.stardog.protocols.http.server.HttpMessageEncoder:write(171): There was an error writing the HTTP response
org.openrdf.query.QueryEvaluationException: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.common.rdf.query.IteratorAsTupleQueryResult.hasNext(IteratorAsTupleQueryResult.java:81) ~[stardog-utils-rdf-4.2.3.jar:?]
    at com.complexible.stardog.protocols.server.ConnectionFinishQueryResult.hasNext(ConnectionFinishQueryResult.java:75) ~[stardog-protocols-spec-server-4.2.3.jar:?]
    at org.openrdf.query.QueryResults.report(QueryResults.java:158) ~[sesame-query-4.0.0.jar:?]
    at org.openrdf.query.resultio.QueryResultIO.writeTuple(QueryResultIO.java:449) ~[sesame-queryresultio-api-4.0.0.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$13.encode(ResponseBodyEncoders.java:470) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.io.ResponseBodyEncoders$2.encode(ResponseBodyEncoders.java:101) ~[stardog-protocols-http-server-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.annex.QueryPanelEncoder.encode(QueryPanelEncoder.java:112) ~[stardog-webconsole-annex-4.2.3.jar:?]
    at com.complexible.stardog.protocols.http.server.HttpMessageEncoder.write(HttpMessageEncoder.java:158) [stardog-protocols-http-server-4.2.3.jar:?]
    at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.32.Final.jar:4.0.32.Final]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_72]
Caused by: com.complexible.stardog.plan.eval.operator.OperatorException: Expected [(] found [-]
    at com.complexible.stardog.spatial.db.query.WithinPropertyFunction$WithinOperator.compute(WithinPropertyFunction.java:334) ~[stardog-spatial-core-4.2.3.jar:?]
    ... 15 more
Caused by: java.text.ParseException: Expected [(] found [-]
    ... 15 more



On Friday, January 27, 2017 at 1:26:29 PM UTC, Zachary Whitley wrote:
I believe you need a second set of parentheses and it should be long lat points separated by a space with points separated by a comma. 

On Jan 27, 2017, at 8:03 AM, Zachary Whitley <zachary...@wavestrike.com> wrote:

In addition to that I think the syntax for your polygon wit is a bit off. Enter code here...

Zachary Whitley

unread,
Jan 27, 2017, 10:23:19 AM1/27/17
to sta...@clarkparsia.com
Close. I think the jar needs to be in the directory $STARDOG_HOME/server/ext  You'll need to create the ext directory first. It needs to be available to the server. I'm not sure if the client dir is included on the server classpath but it would make sense if it wasn't. 

Chris Morris

unread,
Jan 27, 2017, 10:41:53 AM1/27/17
to Stardog
Many thanks, that, combined with changing the SPARQL as below has fixed the error. I'm still not getting the results I expect, I suspect that to be a problem with my SPARQL rather anything relating to how I've set stardog up.

SELECT Distinct ?g WHERE {  
 
?g geo:asWKT ?gWKT .

  FILTER
(geof:within( "POLYGON((-0.05 51.1 , 0.25 51.1 ,-0.05 52,0.25 52 ))"^^geo:wktLiteral , ?g ))  
}
...

Stephen Nowell

unread,
Jan 27, 2017, 12:17:13 PM1/27/17
to sta...@clarkparsia.com
Hi Chris,

I notice that you switched around the arguments to geof:within. This would explain your lack of results, as this would check for any shapes in your data that the _polygon_ is within, versus the other way around, which is what I'm assuming you want to query.

I narrowed down the error being returned by JTS while parsing your POLYGON, and I get "Points of LinearRing do not form a closed linestring." This means your polygon is invalid since the beginning and end points must be identical so that it is "closed." Try that out and see if your query yields the right results.

Cheers,
Stephen
--

Evren Sirin

unread,
Jan 27, 2017, 2:37:29 PM1/27/17
to Stardog
We recently tweaked the stardog-admin script so you can define an
environment variable called STARDOG_EXT where you can put the external
jar files (jts, jdbc connectors, plugins, etc.). This makes it easier
to upgrade Stardog without moving jars just as your databases stay in
STARDOG_HOME between versions. Set the variable as

$ export STARDOG_EXT=~/stardog-ext/

and use server start as before. We'll update the documentation to
mention this variable.

Best,
Evren

Chris Morris

unread,
Jan 29, 2017, 5:29:25 AM1/29/17
to Stardog
You notice correctly. As I found on another forum, I in fact only needed ENVELOPE - I was trying to describe a simple rectangle, I was just unaware of that option.
I've corrected the order of the arguements to within as well and now everything works perfectly.


Many thanks for your assistance.

Chris
>>     at com.complex...
Reply all
Reply to author
Forward
0 new messages