Hi Andy. Just got round to trying this again.
I'm now running Java 8 apache-jena-3.0.0 jena-fuseki1-1.3.0 lucene-5.3.0 jts-1.13 I'm still experiencing the same error - i.e. POSTing geo:lat/long triples to the /text/update endpoint doesn't get them indexed. I've worked around this for now. Mark On 11/09/15 12:22, Andy Seaborne wrote: > On 11/09/15 07:05, Mark Wharton wrote: >> Andy >> >> Many thanks for speedy and accurate reply. Good idea to back-port the >> error checking from Fuseki 2. >> >> >> That works now with >> <#service_spatial_tdb> rdf:type fuseki:Service ; >> rdfs:label "TDB/spatial service" ; >> fuseki:name "text" ; >> ...etc... >> >> <#service_text_tdb> rdf:type fuseki:Service ; >> rdfs:label "TDB/text service" ; >> fuseki:name "spatial" ; >> ...etc... >> >> Couple of final things. >> This seems to work only if you POST to the correct endpoint. E.g. if I >> post updates of geo:lat/long triples to the "update/text" endpoint they >> don't get indexed, but GETting a query with spatial:nearby and >> text:query works in either text or spatial. Is this correct behaviour, >> or am I still doing something wrong? > > Could you try the latest version please? > > IIRC There were fixes for the text index in this area. > > I'm not sure the state of the spatial code as to whether the same was > needed or applied. > > Andy > >> >> Can you put an example of this in the docs/release. There are text or >> spatial examples of configs, but not one with both. Took a long time to >> find that one in the mail archive and that has the same mistake as I >> made. (not surprising as I copied it :-) ) >> http://mail-archives.apache.org/mod_mbox/jena-users/201402.mbox/%3cade748d9f3894b85bef1583f6e328...@by2pr04mb613.namprd04.prod.outlook.com%3E >> >> ^^ is wrong >> >> Many thanks again >> >> Mark >> >> >> On 10/09/15 09:22, Andy Seaborne wrote: >>> Hi Mark, >>> >>> You have different two datasets of the same name ("ds"). I doubt any >>> requests are going to the first one each time. The first declaration >>> got replaced by the second. I'll make that an error - it is in Fuseki2. >>> >>> Andy >>> >>> On 10/09/15 06:33, Mark Wharton wrote: >>>> Hi Jena team. >>>> >>>> I'm trying to get both the text and spatial indexes to work on my TDB >>>> store using jena 1.1.0 (and 1.1.1). I can get one or the other to >>>> work, >>>> but not both at the same time. Can you help? >>>> >>>> I based by config with the example here: >>>> http://mail-archives.apache.org/mod_mbox/jena-users/201402.mbox/%3cade748d9f3894b85bef1583f6e328...@by2pr04mb613.namprd04.prod.outlook.com%3E >>>> >>>> >>>> >>>> Which _seemed_ to work fine, but I realised that the text index wasn't >>>> being updated. Queries with spatial predicates worked fine, e.g. >>>> >>>> PREFIX iotic: <http://purl.org/net/iotic-labs#> >>>> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> >>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> >>>> PREFIX spatial:<http://jena.apache.org/spatial#> >>>> PREFIX geo:<http://www.w3.org/2003/01/geo/wgs84_pos#> >>>> >>>> SELECT ?ent ?lat ?long >>>> WHERE >>>> { >>>> ?ent rdf:type iotic:Entity . >>>> ?ent geo:lat ?lat .?ent geo:long ?long . ?ent >>>> spatial:nearby(52.2474 >>>> 0.7183 5.0 'km') >>>> } >>>> >>>> _but_ queries with text predicates did not work. >>>> PREFIX text: <http://jena.apache.org/text#> >>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> >>>> >>>> SELECT ?s >>>> { ?s text:query (rdfs:label 'weather' 10) ; >>>> rdfs:label ?label >>>> } >>>> >>>> Here's the weird thing. If I change the order of the services in this >>>> bit of my config file, delete the data directories and restart fuseki, >>>> then the spatial queries stop working and the text queries do work. >>>> >>>> # Spatial queries work, text do not. >>>> fuseki:services ( >>>> <#service_text_tdb> >>>> <#service_spatial_tdb> >>>> ) >>>> >>>> # Text queries work, spatial do not. >>>> fuseki:services ( >>>> <#service_spatial_tdb> >>>> <#service_text_tdb> >>>> ) >>>> >>>> --------------------------------- >>>> Here's the text of my config file >>>> --------------------------------- >>>> @prefix : <#> . >>>> @prefix fuseki: <http://jena.apache.org/fuseki#> . >>>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . >>>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . >>>> @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . >>>> @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . >>>> @prefix text: <http://jena.apache.org/text#> . >>>> @prefix spatial: <http://jena.apache.org/spatial#> . >>>> @prefix geosparql: <http://www.opengis.net/ont/geosparql#> . >>>> >>>> [] rdf:type fuseki:Server ; >>>> # Timeout - server-wide default: milliseconds. >>>> # Format 1: "1000" -- 1 second timeout >>>> # Format 2: "10000,60000" -- 10s timeout to first result, then 60s >>>> timeout to for rest of query. >>>> # See java doc for ARQ.queryTimeout >>>> # ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue >>>> "10000" ] ; >>>> # ja:loadClass "your.code.Class" ; >>>> >>>> fuseki:services ( >>>> <#service_text_tdb> >>>> <#service_spatial_tdb> >>>> ) . >>>> >>>> # TDB >>>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . >>>> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . >>>> tdb:GraphTDB rdfs:subClassOf ja:Model . >>>> >>>> # Spatial >>>> [] ja:loadClass "org.apache.jena.query.spatial.SpatialQuery" . >>>> spatial:SpatialDataset rdfs:subClassOf ja:RDFDataset . >>>> spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex . >>>> >>>> # Text >>>> [] ja:loadClass "org.apache.jena.query.text.TextQuery" . >>>> text:TextDataset rdfs:subClassOf ja:RDFDataset . >>>> text:TextIndexLucene rdfs:subClassOf text:TextIndex . >>>> >>>> >>>> ## --------------------------------------------------------------- >>>> >>>> <#dataset> rdf:type tdb:DatasetTDB ; >>>> tdb:location "/home/iotic/apache/jena-fuseki-1.1.0/graphs" >>>> . >>>> >>>> ## --------------------------------------------------------------- >>>> >>>> <#service_spatial_tdb> rdf:type fuseki:Service ; >>>> rdfs:label "TDB/spatial service" ; >>>> fuseki:name "ds" ; >>>> fuseki:serviceQuery "query" ; >>>> fuseki:serviceQuery "sparql" ; >>>> fuseki:serviceUpdate "update" ; >>>> fuseki:serviceUpload "upload" ; >>>> fuseki:serviceReadGraphStore "get" ; >>>> fuseki:serviceReadWriteGraphStore "data" ; >>>> fuseki:dataset <#spatial_dataset> ; >>>> . >>>> >>>> <#service_text_tdb> rdf:type fuseki:Service ; >>>> rdfs:label "TDB/text service" ; >>>> fuseki:name "ds" ; >>>> fuseki:serviceQuery "query" ; >>>> fuseki:serviceQuery "sparql" ; >>>> fuseki:serviceUpdate "update" ; >>>> fuseki:serviceUpload "upload" ; >>>> fuseki:serviceReadGraphStore "get" ; >>>> fuseki:serviceReadWriteGraphStore "data" ; >>>> fuseki:dataset <#text_dataset> ; >>>> . >>>> >>>> ## --------------------------------------------------------------- >>>> >>>> <#spatial_dataset> rdf:type spatial:SpatialDataset ; >>>> spatial:dataset <#dataset> ; >>>> spatial:index <#indexSpatialLucene> ; >>>> . >>>> >>>> <#indexSpatialLucene> a spatial:SpatialIndexLucene ; >>>> spatial:directory <file:graphs_spatial_index> ; >>>> spatial:definition <#definition> ; >>>> . >>>> >>>> <#definition> a spatial:EntityDefinition ; >>>> spatial:entityField "uri" ; >>>> spatial:geoField "geo" ; >>>> . >>>> >>>> <#text_dataset> rdf:type text:TextDataset ; >>>> text:dataset <#dataset> ; >>>> text:index <#indexTextLucene> ; >>>> . >>>> >>>> <#indexTextLucene> a text:TextIndexLucene ; >>>> text:directory <file:graphs_text_index> ; >>>> text:entityMap <#entMap> ; >>>> . >>>> >>>> <#entMap> a text:EntityMap ; >>>> text:entityField "uri" ; >>>> text:defaultField "text" ; ## Should be defined in the >>>> text:map. >>>> text:map ( >>>> # rdfs:label >>>> [ text:field "text" ; text:predicate rdfs:label ] >>>> ) . >>>> >>>> >>>> >>> >> > -- Technology Lead, Iotic Labs +44 7973 674404 [email protected] https://www.iotic-labs.com
