I am afraid you will have to share your data / code here as well to
allow us to give you a meaningful guess.

where is there error coming from? the JenaSpatialExample1?

what version of Jena / JRE is in use?

On Tue, May 30, 2017 at 8:23 AM, Nouwt, B. (Barry) <[email protected]> wrote:
> Marco, thanks for your explanation.
>
> I'm currently testing whether I can actually use the WKT format to describe 
> spatial objects, but it fails (lat/long values work fine). I've traced the 
> error back to this locationtech spatial4j call in this SpatialIndexContext 
> class:
>
> Shape shape = SpatialQuery.ctx.readShape(o.getLiteralLexicalForm());
>
> On github: 
> https://github.com/apache/jena/blob/master/jena-spatial/src/main/java/org/apache/jena/query/spatial/SpatialIndexContext.java#L99
>
> It returns a 'null' Shape value on this correct WKT polygon: Polygon 
> ((-2.0000 51.2000, 1.0000 51.2000, 1.0000 51.8000, -2.0000 51.8000, -2.0000 
> 51.2000))
>
> From the code it seems the spatial4j tries to parse this WKT string on 
> multiple shape format readers, but cannot find one that returns an actual 
> Shape from it, so it returns null. This breaks the code when it tries to add 
> the NULL shape to the Lucene index later.
>
> Do I need to configure the spatial4j shapereaders somewhere?
>
> I'm adding spatial4j-0.6.jar and jts-core-1.14.jar dependency to the Fuseki's 
> classpath.
>
> Kind regards, Barry
>
> -----Original Message-----
> From: Marco Neumann [mailto:[email protected]]
> Sent: dinsdag 30 mei 2017 9:29
> To: [email protected]
> Subject: Re: FW: Apache Jena Spatial
>
> no problem Barry, some of the above could work for you. think about the 
> spatial interaction as a relationship between the spatial search object and 
> the respective spatial data object. e.g. take interesectBox in the test case 
> it builds a spatial search object box and returns among other a match with a 
> wktLiteral (Polygon). the interesectBox can be as small or as big as you wish 
> it to be. behind the scenes it will filter by MBR before it evaluates 
> candidate geometries for exact polygon to box/point interactions.
>
> Marco
>
>
> On Tue, May 30, 2017 at 3:10 AM, Nouwt, B. (Barry) <[email protected]> wrote:
>> Hi Marco, sorry for my persistence, but it is still unclear to me how the 
>> latest apache jena spatial package (3.3.0) can be applied to my use case.
>>
>> You mention "looking at your requirements it I'd say you will be just fine 
>> with the current version of jena-spatial.", but I only see the following 
>> spatial predicates:
>>
>> EastPF.java
>> IntersectsBoxPF.java
>> IsNearByPF.java
>> IsWithinBoxPF.java
>> IsWithinCirclePF.java
>> NorthPF.java
>> SouthPF.java
>> WestPF.java
>>
>> If I understand correctly, I need the 'Contains' predicate that finds all 
>> spatial objects that contain the given GPS coordinate. Can I somehow build 
>> the 'contains' from the predicates above? Maybe a combination of North, 
>> South, West and East?
>>
>> In other words, which of the above list of available spatial predicates 
>> would you say I need to use?
>>
>> Thanks and regards,
>>
>> Barry
>>
>> -----Original Message-----
>> From: Marco Neumann [mailto:[email protected]]
>> Sent: maandag 29 mei 2017 23:38
>> To: [email protected]
>> Subject: Re: FW: Apache Jena Spatial
>>
>> here is the data
>>
>> https://github.com/apache/jena/blob/master/jena-spatial/src/test/resou
>> rces/geoarq-data-1.ttl
>>
>> and here are the tests
>>
>> https://github.com/apache/jena/blob/master/jena-spatial/src/main/java/
>> examples/JenaSpatialExample1.java
>>
>>
>>
>>
>> On Mon, May 29, 2017 at 5:34 PM, Nouwt, B. (Barry) <[email protected]> 
>> wrote:
>>> Hi Marco,
>>>
>>>
>>>
>>> Ok, so, I will not need to implement any spatial predicates myself?
>>> Which existing spatial predicate should I use in my SPARQL query for my 
>>> ‘contains’
>>> requirement?
>>>
>>>
>>>
>>> Could you maybe send me your quick test? That would probably be helpful.
>>>
>>>
>>>
>>> Thanks again!
>>>
>>> Barry
>>>
>>>
>>>
>>> Verzonden vanaf mijn Windows 10-telefoon
>>>
>>>
>>>
>>> Van: Marco Neumann
>>> Verzonden: maandag 29 mei 2017 23:12
>>>
>>>
>>> Aan: [email protected]
>>> Onderwerp: Re: FW: Apache Jena Spatial
>>>
>>>
>>>
>>> looking at your requirements it I'd say you will be just fine with
>>> the current version of jena-spatial. I was thinking more in terms of
>>> number of spatial objects to be indexed as a possible issue.
>>>
>>> I just did a quick test with the latest release 3.3.0 and and it
>>> seems to work for your needs. ignore the spatial documentation for
>>> now and work with code directly. the linked documentation seems to be
>>> out of sync with the current implementation of jena-spatial.
>>>
>>> Marco
>>>
>>>
>>> On Mon, May 29, 2017 at 1:24 PM, Nouwt, B. (Barry)
>>> <[email protected]>
>>> wrote:
>>>> Hi Marco, thanks for your reply!
>>>>
>>>>
>>>>
>>>> I’ve indeed included the JTS library, but haven’t tested the more
>>>> advanced
>>>> (WKT) features yet…
>>>>
>>>>
>>>>
>>>> My (current) requirements are:
>>>>
>>>> Describe spatial objects in RDF using WKT polygons.
>>>> Fire a spatial SPARQL query with a given GPS coordinate (I.e. single
>>>> point)
>>>> Retrieve all spatial RDF objects that contain this given GPS coordinate.
>>>>
>>>>
>>>>
>>>> Do I understand you correctly that the current spatial
>>>> implementation does not support my requirements? So, there is no
>>>> predefined (combination of) predicate like nearby that I can use?
>>>>
>>>>
>>>>
>>>> So, then I need to put more effort in it myself. I’ve seen the ‘simple’
>>>> implementations of the nearby (etc) predicate in jena-spatial… would
>>>> implementing the contains be similar? I am an experienced Java
>>>> developer, but never did spatial calculations before.
>>>>
>>>>
>>>>
>>>> Regards, Barry
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Verzonden vanaf mijn Windows 10-telefoon
>>>>
>>>>
>>>>
>>>> Van: Marco Neumann
>>>> Verzonden: maandag 29 mei 2017 18:39
>>>> Aan: [email protected]
>>>> Onderwerp: Re: FW: Apache Jena Spatial
>>>>
>>>>
>>>>
>>>> Barry,
>>>>
>>>> the jena-spatial implementation has seen a couple of versions and
>>>> iterations of versions over last couple of years.
>>>>
>>>> To perform and test for detailed spatial object interactions on
>>>> polygons the current apache lucene spatial implementation
>>>> (Lucene6.4.1) requires the JTS library.
>>>>
>>>> and of course you can always implement your own or you can just
>>>> build your own spatial filter in sparql to detect polygon / point
>>>> intersections. it requires a bit more effort to detect polygon /
>>>> polygon interactions though.
>>>> it depends on your requirements.
>>>>
>>>> Marco
>>>>
>>>>
>>>>
>>>> On Mon, May 29, 2017 at 11:28 AM, Nouwt, B. (Barry)
>>>> <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>>
>>>>> In one of our projects we would like to use SPARQL to do spatial
>>>>> searches to find all spatial objects (described by a polygon) that
>>>>> contain a particular given GPS coordinate. I can successfully
>>>>> execute the following Apache Jena Spatial query on the test data:
>>>>>
>>>>>
>>>>>
>>>>> PREFIX spatial: <http://jena.apache.org/spatial#
>>>>> <http://jena.apache.org/spatial>>
>>>>>
>>>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#
>>>>> <http://www.w3.org/2000/01/rdf-schema>>
>>>>>
>>>>>
>>>>>
>>>>> SELECT ?placeName
>>>>>
>>>>> {
>>>>>
>>>>>     ?place spatial:nearby (51.46 2.6 *1000* 'km') .
>>>>>
>>>>>     ?place rdfs:label ?placeName
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> However, the *‘nearby’* predicate does not fit my usecase and I
>>>>> cannot find one that does in this list:
>>>>>
>>>>>
>>>>>
>>>>> https://jena.apache.org/documentation/query/spatial-
>>>>> query.html#property-function-library
>>>>>
>>>>>
>>>>>
>>>>> I think I need the ‘Contains’ predicate as described here:
>>>>>
>>>>>
>>>>>
>>>>> http://edndoc.esri.com/arcsde/9.1/general_topics/understand_
>>>>> spatial_relations.htm#Contains
>>>>>
>>>>>
>>>>>
>>>>> but I it seems like it is not supported. Can anyone confirm that?
>>>>>
>>>>>
>>>>>
>>>>> What other options do I have to get the usecase described above working?
>>>>> Can I implement the ‘Contains’ behavior myself (although I have no
>>>>> geo/spatial experience) and contribute it to the Apache Jena
>>>>> Spatial? Can I somehow mimic the contains behavior with regular
>>>>> SPARQL?
>>>>>
>>>>>
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> B. (Barry) Nouwt
>>>>> Medior Innovator Semantische Technologie Connected Business
>>>>>
>>>>> T +31 (0)88 866 56 91
>>>>> M +31 (0)64 977 53 56
>>>>> E [email protected]
>>>>>
>>>>> Location <http://www.tno.nl/locaties/SB>
>>>>>
>>>>>
>>>>>
>>>>> <http://www.tno.nl/>
>>>>>
>>>>> This message may contain information that is not intended for you.
>>>>> If you are not the addressee or if this message was sent to you by
>>>>> mistake, you are requested to inform the sender and delete the
>>>>> message. TNO accepts no liability for the content of this e-mail,
>>>>> for the manner in which you use it and for damage of any kind
>>>>> resulting from the risks inherent to the electronic transmission of 
>>>>> messages.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> ---
>>>> Marco Neumann
>>>> KONA
>>>>
>>>>
>>>>
>>>> This message may contain information that is not intended for you.
>>>> If you are not the addressee or if this message was sent to you by
>>>> mistake, you are requested to inform the sender and delete the
>>>> message. TNO accepts no liability for the content of this e-mail,
>>>> for the manner in which you use it and for damage of any kind
>>>> resulting from the risks inherent to the electronic transmission of 
>>>> messages.
>>>>
>>>
>>>
>>>
>>> --
>>>
>>>
>>> ---
>>> Marco Neumann
>>> KONA
>>>
>>>
>>>
>>> This message may contain information that is not intended for you. If
>>> you are not the addressee or if this message was sent to you by
>>> mistake, you are requested to inform the sender and delete the
>>> message. TNO accepts no liability for the content of this e-mail, for
>>> the manner in which you use it and for damage of any kind resulting
>>> from the risks inherent to the electronic transmission of messages.
>>>
>>
>>
>>
>> --
>>
>>
>> ---
>> Marco Neumann
>> KONA
>
>
>
> --
>
>
> ---
> Marco Neumann
> KONA



-- 


---
Marco Neumann
KONA

Reply via email to