Version
Fuseki v2 since Jena 2.13.0
Both v1 and v2 are active and maintained.[2015/06/29]
v1
1 start
$ cd FUSEKI_V1_HOME
$ chmod +x fuseki-server s-*
$ ./fuseki-server --update --mem /ds # the dataset name is '/ds'
fuseki-server options
-
--localhost
listen only to localhost NIC
-
--port=PORT
set the port number
-
--update
allow update, otherwise only serve read requests.
ignored if a configuration file is given -
fuseki-server --mem /DatasetPathName
create an empty, in-memory(non-persistent) dataset
-
fuseki-server --file=FILE /DatasetPathName
create an empty, in-memory(non-persistent) dataset, then load FILE into it
-
fuseki-server --loc=DIR /DatasetPathName
use an existing TDB database, create an empty is it doesnot exist
-
fuseki-server --desc=assemblerFile
construct a database based on the general assembler description
-
fuseki-server --config=ConfigFile
construct one or more service endpoints based on the confifuration file, see # 6
2 user interface
http://localhost:3030/
3 script control
$ cd FUSEKI_V1_HOME
-
s-put: load RDF data to default graph of server
$ ./s-put http://localhost:3030/ds/data default ./Data/books.ttl
-
s-get: get the default graph
$ ./s-get http://localhost:3030/ds/data default
-
s-query: use /query endpoint to execute SPARQL query
$ ./s-query --service http://localhost:3030/ds/query 'SELECT * {?s ?p ?o}'
-
s-update: use /update endpoint to execute SPARQL update
$ ./s-update --service http://localhost:3030/ds/update 'CLEAR DEFAULT' # clear the default graph
Server URI schema
Fuseki's default port is 3030
- /dataset/query: SPARQL query endpoint
- /dataset/update: SPARQL update language endpoint
- /dataset/data: SPARQL Graph Store Protocol endpoint
- /dataset/upload: file upload endpoint
4 security
Fuseki does not currently offer security and access control itself.
Data can be updated without access control if the server is started with the --update argument. If started without that argument, data is read-only.
5 logging
see Fuseki_V1_HOME/fuseki-server.jar/jena-log4j.properties
6 configuration
A Fuseki server can be set up using a configuration file.
The command-line arguments for publishing a single dataset are a short cut that, internally, builds a default configuration based on the dataset name given.
The configuration is an RDF graph. One graph consists of one server description, with a number of services, and each service offers a number of endpoints over a dataset.
All datasets are described by assembler descriptions.
samples:
// [1] prefixes
@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 : <#> .
// [2] server - server context, custom code, and avaiable services
## ---------------------------------------------------------------
[] rdf:type fuseki:Server ;
# Server-wide context parameters can be given here.
# For example, to set query timeouts: on a server-wide basis:
# 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" ] ;
# Load custom code (rarely needed)
# ja:loadClass "your.code.Class" ;
# Services available. Only explicitly listed services are configured.
# If there is a service description not linked from this list, it is ignored.
fuseki:services (
<#service1>
<#service2>
) .
// [3] dataset - a tdb dataset
## ---------------------------------------------------------------
# Declaration additional assembler items.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
# TDB
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
// [4] service 1 - a service use in-memory dataset,
// customed dataset's and SPARQL services' endpoint
## ---------------------------------------------------------------
## Updatable in-memory dataset.
<#service1> rdf:type fuseki:Service ;
fuseki:name "ds" ; # http://host:port/ds
fuseki:serviceQuery "query" ; # SPARQL query service
fuseki:serviceQuery "sparql" ; # SPARQL query service
fuseki:serviceUpdate "update" ; # SPARQL query service
fuseki:serviceUpload "upload" ; # Non-SPARQL upload service
fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
# A separate read-only graph store endpoint:
fuseki:serviceReadGraphStore "get" ; # SPARQL Graph store protocol (read only)
fuseki:dataset <#dataset-mem> ;
.
<#dataset-mem> rdf:type ja:RDFDataset .
// [5] service 2 - read only in-memory single graph data
## ---------------------------------------------------------------
<#service2> rdf:type fuseki:Service ;
fuseki:name "books" ; # http://host:port/books
fuseki:serviceQuery "query" ; # SPARQL query service
fuseki:serviceReadGraphStore "data" ; # SPARQL Graph store protocol (read only)
fuseki:dataset <#books> ;
.
<#books> rdf:type ja:RDFDataset ;
rdfs:label "Books" ;
ja:defaultGraph
[ rdfs:label "books.ttl" ;
a ja:MemoryModel ;
ja:content [ja:externalContent <file:Data/books.ttl> ] ;
] ;
.
// [6] service 3 - with a customed TDB
## ---------------------------------------------------------------
<#service3> rdf:type fuseki:Service ;
fuseki:name "tdb" ; # http://host:port/tdb
fuseki:serviceQuery "sparql" ; # SPARQL query service
fuseki:dataset <#dataset> ;
.
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;
# Query timeout on this dataset (1s, 1000 milliseconds)
ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1000" ] ;
# Make the default graph be the union of all named graphs.
## tdb:unionDefaultGraph true ;
.
7 dataset
7.1 TDB
samples:
[1] fuseki-server --desc tdb.ttl /ds
# tdb.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;
.
[2] fuseki-server --loc=DB /ds
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "DB" ;
tdb:unionDefaultGraph true ;
.
7.2 general database description
The Fuseki server can be given an assembler description to build a variety of model and datasets types.
samples:
fuseki-server --desc **assembler.ttl** /ds
// assembler.ttl
# Dataset of default graph and one named graph.
<#dataset> rdf:type ja:RDFDataset ;
ja:defaultGraph <#modelDft> ;
ja:namedGraph
[ ja:graphName <http://example.org/name1> ;
ja:graph <#model1> ] ;
.
<#modelDft> a ja:MemoryModel ;
ja:content [ ja:externalContent <file:Data.ttl> .
<#model1> rdf:type ja:MemoryModel ;
ja:content [ ja:externalContent <file:FILE-1.ttl> ] ;
ja:content [ ja:externalContent <file:FILE-2.ttl> ] ;
.
8 SPARQL Over HTTP(SOH)
see SOH - SPARQL over HTTP for more details.
9 use from Java
see ARQ - Querying Remote SPARQL Services for more details.
v2
TODO