Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoSPARQL support #29

Open
MadsHolten opened this issue Nov 14, 2024 · 1 comment
Open

GeoSPARQL support #29

MadsHolten opened this issue Nov 14, 2024 · 1 comment

Comments

@MadsHolten
Copy link

Is it possible to set up a database that has both full text and GeoSPARQL support? Here is the assembler I tried. Unfortunately I had no luck with my test query 😒

@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@prefix tdb:     <http://jena.hpl.hp.com/2008/tdb#> .
@prefix text:    <http://jena.apache.org/text#> .
@prefix skos:    <http://www.w3.org/2004/02/skos/core#> .
@prefix geosparql: <http://jena.apache.org/geosparql#> .

<#service> a fuseki:Service ;
    fuseki:name              "ds" ;   # http://host:port/ds
    fuseki:serviceQuery      "sparql" ;    # SPARQL query service
    fuseki:serviceUpdate     "update" ;    # SPARQL update service
    fuseki:serviceReadWriteGraphStore "data" ;     # SPARQL Graph store protocol
    #fuseki:serviceReadGraphStore    "data" ;     # SPARQL Graph store protocol (read only)
    fuseki:endpoint [ fuseki:operation fuseki:shacl ; fuseki:name "shacl" ] ;
    fuseki:dataset           <#text_ds> ;
#    fuseki:dataset           <#tdb> ;
    .

<#text_ds> a text:TextDataset , geosparql:geosparqlDataset ;
    text:dataset <#tdb> ;
    text:index <#lucene> ;
    geosparql:dataset <#tdb> ;
    geosparql:spatialIndexFile     "/fuseki-base/databases/tdb/spatial.index";
    .

<#tdb> a tdb:DatasetTDB ;
    tdb:location "/fuseki-base/databases/tdb" ;
    tdb:unionDefaultGraph true ;
    .

<#lucene> a text:TextIndexLucene ;
    text:directory <file:/fuseki-base/databases/lucene> ;
    text:storeValues true ;
    text:entityMap <#entity-map> ;
    .

<#entity-map> a text:EntityMap ;
    text:entityField "uri" ;
    text:graphField "graph" ; ## enable graph-specific indexing
    text:defaultField "text" ; ## Must be defined in the text:map
    text:uidField "uid" ;
    text:langField "lang" ;
    text:map (
         [ text:field "text" ; text:predicate skos:prefLabel ]
         [ text:field "text" ; text:predicate skos:altLabel ]
         [ text:field "text" ; text:predicate skos:hiddenLabel ]
         [ text:field "text" ; text:predicate skos:notation ]
         )
    .

And my test query:

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>

SELECT ?point
WHERE {
    BIND("POLYGON ((-64.8 32.3, -65.5 18.3, -80.3 25.2, -64.8 32.3))"^^geo:wktLiteral AS ?polygon)
    VALUES ?point { "POINT (-70.268555 25.522615)"^^geo:wktLiteral "POINT (-60.996094 24.846565)"^^geo:wktLiteral }
    FILTER(geof:sfWithin(?point, ?polygon))
}
@MadsHolten
Copy link
Author

MadsHolten commented Nov 21, 2024

I got it to work by simply adding the geosparql jar to the jena-fuseki dir. Same config file and all (https://github.com/SemanticComputing/fuseki-docker/blob/master/assembler.ttl). I was quite surprised to find that it was so simple.

So a simple Dockerfile like this will do the job:

FROM secoresearch/fuseki:5.2.0

USER root
RUN wget https://repo1.maven.org/maven2/org/apache/jena/jena-fuseki-geosparql/5.2.0/jena-fuseki-geosparql-5.2.0.jar -O /jena-fuseki/fuseki-geosparql.jar

To give you the full picture, here is that config file I am using with basically no additions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant