On 11/07/14 14:08, Arthur Vaïsse-Lesteven wrote:
Thank for the answer ANdy, but it only change the error to :
Exception in thread "main"
com.hp.hpl.jena.assembler.exceptions.NoSpecificTypeException: the root
<http://www.thesis_project.org#spatial_dataset> has no most specific
type that is a subclass of ja:Object
That's the same message as your original message, isn't it?
(PS better style:
@prefix : <http://www.thesis_project.org/#> .
)
at
com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:113)
at
com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
at
com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:52)
at
com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:48)
at
com.hp.hpl.jena.query.DatasetFactory.assemble(DatasetFactory.java:267)
at
com.hp.hpl.jena.query.DatasetFactory.assemble(DatasetFactory.java:242)
It seems that it's an assembler relative problem/
Considering this error message I read the documentation about assembler
(Assembler quicksart/Assembler How to/inside assembler).
It seems strange that I get this error message that inform me that my
spatial dataset hasn't any specific type because as far as I understand
assembler definition, this line of my config file :
:spatial_dataset rdf:type spatial:SpatialDataset ;
specify that it is a "spatial:SpatialDataset", and so is more specific
than just a generic object.
Did I miss mandatory properties that must be used ?
(catching up ..)
Could you please post the current complete assembler description?
Detail matter
The assembler mechanism by default does not know about spatial that's
why you need;
# Get the Spatial subsystem to initialize
[] ja:loadClass "org.apache.jena.query.spatial.SpatialQuery" .
# Tell assemblers that SpatialDataset isa kind of RDFDataset
spatial:SpatialDataset rdfs:subClassOf ja:RDFDataset .
# And lucene implements a spatial index
spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex .
Andy
And also, do the spatial assembler has its own description ? I searched
for a while about "http://jena.apache.org/spatial#" and dont find
anything. I suppose so that this is only a link to a pure java class
that is invoke behind the scene.
VAISSE-LESTEVEN Arthur.
------------------------------------------------------------------------
*De :* Andy Seaborne <[email protected]>
*À :* "[email protected]" <[email protected]>; Arthur
Vaïsse-Lesteven <[email protected]>
*Envoyé le :* Jeudi 10 juillet 2014 19h29
*Objet :* Re: Jena Spatial - How to create a SpatialDataset
Inline ...
On 10 July 2014 16:42, Arthur Vaïsse-Lesteven <[email protected]
<mailto:[email protected]>> wrote:
> Hi everyone,
> I present you my apologies in advance for the long text.
>
> I searched for a while before asking to the mailing list how to
instantiate a SpatialDataset, but I still fail my attempts of doing it.
>
>
> Here is my problem : I have some RDF data with some that are
localized geographically.
> Here come an extract of RDF(N-TRIPLES) data that I have :
>
...
> And I use the following config.ttl file :
>
__________________________________________________________________________________________________________________
> ## A config based on the example furnished with the tutorial at
http://jena.apache.org/documentation/query/spatial-query.html
> @prefix : <http://www.thesis_project.org#
<http://www.thesis_project.org/#>> .
> @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 spatial: <http://jena.apache.org/spatial#> .
> @prefix wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#>
>
> # 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:SpatialtDataset rdfs:subClassOf ja:RDFDataset .
Typo - not "SpatialtDataset" - but "SpatialDataset" (there is an extra
"t" before "D" in your config file)
I'm not in a position to test this but it does correlate to the error.
> spatial:SpatialIndexLucene rdfs:subClassOf spatial:SpatialIndex .
>
> ## ---------------------------------------------------------------
> :spatial_dataset rdf:type spatial:SpatialDataset ;
> spatial:dataset <#dataset> ;
>
> spatial:index <#indexLucene> ;
> .
>
> <#dataset> rdf:type tdb:DatasetTDB ;
> tdb:location "--mem--" ;
>
> tdb:unionDefaultGraph true ;
> .
>
> <#indexLucene> a spatial:SpatialIndexLucene ;
> #spatial:directory <file:Lucene> ;
> spatial:directory "mem" ;
> spatial:definition <#definition> ;
> .
>
> <#definition> a spatial:EntityDefinition ;
> spatial:entityField "uri" ;
> spatial:geoField "geo" ;
> # custom geo predicates for 1) Latitude/Longitude
> Format
> spatial:hasSpatialPredicatePairs ([ spatial:latitude wgs:lat ;
spatial:longitude wgs:long ]) ;
> .
>
__________________________________________________________________________________________________________________
>
> I really don't understand what I'm missing.
> As far as
> I understood, the process consist in :
> - create an index model ( here the standard one that use wsg84
lat/long properties of resources )[#3]
> - define a binding between model attributes and RDF properties
using the configuration file [#1]
> - build a dataset that contains resources compliant with the index
previously defined (loading my RDF data into a Model) + the binding[#2]
>
> - give a storage space for the spatial index ( a "in memory" one
in my case)[#4]
> - fill the index the entity of the dataset[#5]
>
> But This code fail with the following error :
>
> Exception in thread "main"
> com.hp.hpl.jena.assembler.exceptions.NoSpecificTypeException: the root
> <http://www.thesis_project.org#spatial_dataset
<http://www.thesis_project.org/#spatial_dataset>> has no most
> specific type that is a subclass of ja:Object
> at
com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:113)
> at
com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
> at
com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:52)
> at
com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:48)
> at
> com.hp.hpl.jena.query.DatasetFactory.assemble(DatasetFactory.java:267)
> at
com.hp.hpl.jena.query.DatasetFactory.assemble(DatasetFactory.java:242)
> at Main.main(Main.java:30)
>
> I don't understand this error. Could someone explain me what is wrong
in this "minimal" use case ?
>
> Sincerely,
> VAISSE-LESTEVEN Arthur.