You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Mark Wharton <ma...@iotic-labs.com> on 2015/11/09 16:34:47 UTC
Splitting a fuseki1 config file into services for fuseki2
Hi Jena
I run fuseki as a service and I've just migrated to Fuseki 2, but kept
my config file as it was. I've just been trying to do what the docs
suggest, i.e. to separate it out into a file per service. I quote:
"To convert a Fuseki 1 configuration setup to Fuseki 2 style, move each
data service assembler and put in it's own file under
FUSEKI_BASE/configuration/"
Can you point me to examples of this style of using config file(s) and
what do I put in the fuseki init script for FUSEKI_CONF (if anything)?
I have two fuseki services, one for text indexing and one for spatial.
FWIW this is my existing 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 "org.apache.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/fuseki/graphs"
.
## ---------------------------------------------------------------
<#service_spatial_tdb> rdf:type fuseki:Service ;
rdfs:label "TDB/spatial service" ;
fuseki:name "spatial" ;
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 "text" ;
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:langField "lang" ;
text:map (
[ text:field "text" ; text:predicate rdfs:label ]
[ text:field "text" ; text:predicate rdfs:comment ]
) .
Thanks in advance
Mark
Re: Splitting a fuseki1 config file into services for fuseki2
Posted by Andy Seaborne <an...@apache.org>.
On 09/11/15 15:34, Mark Wharton wrote:
> Hi Jena
>
> I run fuseki as a service and I've just migrated to Fuseki 2, but kept
> my config file as it was. I've just been trying to do what the docs
> suggest, i.e. to separate it out into a file per service. I quote:
>
> "To convert a Fuseki 1 configuration setup to Fuseki 2 style, move each
> data service assembler and put in it's own file under
> FUSEKI_BASE/configuration/"
>
> Can you point me to examples of this style of using config file(s) and
> what do I put in the fuseki init script for FUSEKI_CONF (if anything)?
Start an empty server and create a couple of datasets with the UI.
Look in FUSEKI_BASE/configuration/
>
> I have two fuseki services, one for text indexing and one for spatial.
>
> FWIW this is my existing config file
inline:
> ---------------------------------------------
>
> @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" ;
>
If there are server settings then put them in FUSEKI_BASE/config.ttl
None here - you can drop this part.
> fuseki:services (
> <#service_text_tdb>
> <#service_spatial_tdb>
> ) .
Not needed.
The presence of a file in configuration/ is enough.
> # TDB
> [] ja:loadClass "org.apache.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 .
Put in each configuration file.
And these will not be needed at the next release of Jena but they do no
harm.
>
>
> ## ---------------------------------------------------------------
>
> <#dataset> rdf:type tdb:DatasetTDB ;
> tdb:location "/home/fuseki/graphs"
> .
This needs to go in both - don't worry - it is one database as it is
shared JVM-wide by keying on location.
>
> ## ---------------------------------------------------------------
>
> <#service_spatial_tdb> rdf:type fuseki:Service ;
> rdfs:label "TDB/spatial service" ;
> fuseki:name "spatial" ;
> fuseki:serviceQuery "query" ;
> fuseki:serviceQuery "sparql" ;
> fuseki:serviceUpdate "update" ;
> fuseki:serviceUpload "upload" ;
> fuseki:serviceReadGraphStore "get" ;
> fuseki:serviceReadWriteGraphStore "data" ;
> fuseki:dataset <#spatial_dataset> ;
Put this service description and <#spatial_dataset> and below in one
file in configuration/
> .
>
> <#service_text_tdb> rdf:type fuseki:Service ;
> rdfs:label "TDB/text service" ;
> fuseki:name "text" ;
> fuseki:serviceQuery "query" ;
> fuseki:serviceQuery "sparql" ;
> fuseki:serviceUpdate "update" ;
> fuseki:serviceUpload "upload" ;
> fuseki:serviceReadGraphStore "get" ;
> fuseki:serviceReadWriteGraphStore "data" ;
> fuseki:dataset <#text_dataset> ;
> .
and this one + <#text_dataset> and below in another.
one service - one file.
>
> ## ---------------------------------------------------------------
>
Put <#spatial_dataset> and below in the
> <#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:langField "lang" ;
> text:map (
> [ text:field "text" ; text:predicate rdfs:label ]
> [ text:field "text" ; text:predicate rdfs:comment ]
> ) .
>
>
>
> Thanks in advance
>
> Mark
Andy
>