blob: 5da672a4fd4615d3438f126eaf9513177c52092b [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<title>Apache Jena - Fuseki: Configuring Fuseki</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="/css/bootstrap-extension.css" rel="stylesheet" type="text/css">
<link href="/css/jena.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="/images/favicon.ico" />
<script src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
crossorigin="anonymous"></script>
<script src="/js/jena-navigation.js" type="text/javascript"></script>
<script src="/js/bootstrap.min.js" type="text/javascript"></script>
<script src="/js/improve.js" type="text/javascript"></script>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/index.html">
<img class="logo-menu" src="/images/jena-logo/jena-logo-notext-small.png" alt="jena logo">Apache Jena</a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li id="homepage"><a href="/index.html"><span class="glyphicon glyphicon-home"></span> Home</a></li>
<li id="download"><a href="/download/index.cgi"><span class="glyphicon glyphicon-download-alt"></span> Download</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-book"></span> Learn <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="dropdown-header">Tutorials</li>
<li><a href="/tutorials/index.html">Overview</a></li>
<li><a href="/documentation/fuseki2/index.html">Fuseki Triplestore</a></li>
<li><a href="/documentation/notes/index.html">How-To's</a></li>
<li><a href="/documentation/query/manipulating_sparql_using_arq.html">Manipulating SPARQL using ARQ</a></li>
<li><a href="/tutorials/rdf_api.html">RDF core API tutorial</a></li>
<li><a href="/tutorials/sparql.html">SPARQL tutorial</a></li>
<li><a href="/tutorials/using_jena_with_eclipse.html">Using Jena with Eclipse</a></li>
<li class="divider"></li>
<li class="dropdown-header">References</li>
<li><a href="/documentation/index.html">Overview</a></li>
<li><a href="/documentation/query/index.html">ARQ (SPARQL)</a></li>
<li><a href="/documentation/assembler/index.html">Assembler</a></li>
<li><a href="/documentation/tools/index.html">Command-line tools</a></li>
<li><a href="/documentation/rdfs/">Data with RDFS Inferencing</a></li>
<li><a href="/documentation/geosparql/index.html">GeoSPARQL</a></li>
<li><a href="/documentation/inference/index.html">Inference API</a></li>
<li><a href="/documentation/javadoc.html">Javadoc</a></li>
<li><a href="/documentation/ontology/">Ontology API</a></li>
<li><a href="/documentation/permissions/index.html">Permissions</a></li>
<li><a href="/documentation/extras/querybuilder/index.html">Query Builder</a></li>
<li><a href="/documentation/rdf/index.html">RDF API</a></li>
<li><a href="/documentation/rdfconnection/">RDF Connection - SPARQL API</a></li>
<li><a href="/documentation/io/">RDF I/O</a></li>
<li><a href="/documentation/rdfstar/index.html">RDF-star</a></li>
<li><a href="/documentation/shacl/index.html">SHACL</a></li>
<li><a href="/documentation/shex/index.html">ShEx</a></li>
<li><a href="/documentation/jdbc/index.html">SPARQL over JDBC</a></li>
<li><a href="/documentation/tdb/index.html">TDB</a></li>
<li><a href="/documentation/tdb2/index.html">TDB2</a></li>
<li><a href="/documentation/query/text-query.html">Text Search</a></li>
</ul>
</li>
<li class="drop down">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-book"></span> Javadoc <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/documentation/javadoc.html">All Javadoc</a></li>
<li><a href="/documentation/javadoc/arq/">ARQ</a></li>
<li><a href="/documentation/javadoc_elephas.html">Elephas</a></li>
<li><a href="/documentation/javadoc/fuseki2/">Fuseki</a></li>
<li><a href="/documentation/javadoc/geosparql/">GeoSPARQL</a></li>
<li><a href="/documentation/javadoc/jdbc/">JDBC</a></li>
<li><a href="/documentation/javadoc/jena/">Jena Core</a></li>
<li><a href="/documentation/javadoc/permissions/">Permissions</a></li>
<li><a href="/documentation/javadoc/extras/querybuilder/">Query Builder</a></li>
<li><a href="/documentation/javadoc/shacl/">SHACL</a></li>
<li><a href="/documentation/javadoc/tdb/">TDB</a></li>
<li><a href="/documentation/javadoc/text/">Text Search</a></li>
</ul>
</li>
<li id="ask"><a href="/help_and_support/index.html"><span class="glyphicon glyphicon-question-sign"></span> Ask</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-bullhorn"></span> Get involved <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/getting_involved/index.html">Contribute</a></li>
<li><a href="/help_and_support/bugs_and_suggestions.html">Report a bug</a></li>
<li class="divider"></li>
<li class="dropdown-header">Project</li>
<li><a href="/about_jena/about.html">About Jena</a></li>
<li><a href="/about_jena/architecture.html">Architecture</a></li>
<li><a href="/about_jena/citing.html">Citing</a></li>
<li><a href="/about_jena/team.html">Project team</a></li>
<li><a href="/about_jena/contributions.html">Related projects</a></li>
<li><a href="/about_jena/roadmap.html">Roadmap</a></li>
<li class="divider"></li>
<li class="dropdown-header">ASF</li>
<li><a href="http://www.apache.org/">Apache Software Foundation</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
<li><a href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li>
<li><a href="http://www.apache.org/security/">Security</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
</ul>
</li>
<li id="edit"><a href="https://github.com/apache/jena-site/edit/main/source/documentation/fuseki2/fuseki-configuration.md" title="Edit this page on GitHub"><span class="glyphicon glyphicon-pencil"></span> Edit this page</a></li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="breadcrumbs">
<ol class="breadcrumb">
<li><a href='/documentation'>DOCUMENTATION</a></li>
<li><a href='/documentation/fuseki2'>FUSEKI2</a></li>
<li class="active">FUSEKI CONFIGURATION</li>
</ol>
</div>
<h1 class="title">Fuseki: Configuring Fuseki</h1>
<p>A Fuseki server is configured by defining the data services (data and actions available on the data). There is also server configuration although this is often unnecessary.</p>
<p>The data services configuration can come from:</p>
<p>For Fuseki Full (webapp with UI):</p>
<ol>
<li>The directory <code>FUSEKI_BASE/configuration/</code> with one data service assembler per file (includes endpoint details and the dataset description.)</li>
<li>The system database. This includes uploaded assembler files. It also keeps the state of each data service (whether it&rsquo;s active or offline).</li>
<li>The server configuration file <code>config.ttl</code>. For compatibility, the server configuration file can also have data services.</li>
<li>The command line, if not running as a web application from a .war file.</li>
</ol>
<p><code>FUSEKI_BASE</code> is the location of the <a href="./fuseki-layout.html">Fuseki run area</a>.</p>
<p>For <a href="fuseki-main.html">Fuseki Main</a>:</p>
<ol>
<li>The command line, using <code>--conf</code> to provide a configuration file.</li>
<li>The command line, using arguments (e.g. <code>--mem /ds</code> or <code>--tdb2 --loc DB2 /ds</code>).</li>
<li><a href="fuseki-main.html#build">Programmatic configuration</a> of the server.</li>
</ol>
<p>See <a href="fuseki-security.html">Fuseki Security</a> for more information on security configuration.</p>
<h2 id="examples">Examples</h2>
<p>Example server configuration files can be found at <a href="https://github.com/apache/jena/tree/main/jena-fuseki2/examples">jena-fuseki2/examples</a>.</p>
<h2 id="security-and-access-control">Security and Access Control</h2>
<p>Access Control can be configured on any of the server, data service or dataset.
<a href="fuseki-data-access-control.html">Fuseki Data Access Control</a>.</p>
<p>Separately, Fuseki Full has request based security filtering provided by Apache Shiro:
<a href="fuseki-security.html">Fuseki Full Security</a></p>
<h2 id="fuseki-configuration-file">Fuseki Configuration File</h2>
<p>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.</p>
<p>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.</p>
<p>The example below is all one file (RDF graph in Turtle syntax)
split to allow for commentary.</p>
<h3 id="prefix-declarations">Prefix declarations</h3>
<p>Some useful prefix declarations:</p>
<pre><code>PREFIX fuseki: &lt;http://jena.apache.org/fuseki#&gt;
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX tdb1: &lt;http://jena.hpl.hp.com/2008/tdb#&gt;
PREFIX tdb2: &lt;http://jena.apache.org/2016/tdb#&gt;
PREFIX ja: &lt;http://jena.hpl.hp.com/2005/11/Assembler#&gt;
PREFIX : &lt;#&gt;
</code></pre>
<h3 id="assembler-initialization">Assembler Initialization</h3>
<p>All datasets are described by
<a href="../assembler/index.html">assembler descriptions</a>.
Assemblers provide an extensible way of describing many kinds of
objects.</p>
<h3 id="defining-the-service-name-and-endpoints-available">Defining the service name and endpoints available</h3>
<p>Each data service assembler defines:</p>
<ul>
<li>The base name</li>
<li>The operations and endpoint names</li>
<li>The dataset for the RDF data.</li>
</ul>
<p>This example offers SPARQL Query, SPARQL Update and SPARQL Graph
Store protocol, as well as file upload.</p>
<p>See <a href="fuseki-config-endpoint.html">Data Service Configuration Syntax</a> for the complete details of the endpoint configuration description. Here, we show some examples.</p>
<p>The <a href="fuseki-old-config-endpoint.html">original configuration</a> syntax, using, for example, <code>fuseki:serviceQuery</code>, is still supported.</p>
<p>The base name is <code>/ds</code>.</p>
<pre><code>## Updatable in-memory dataset.
&lt;#service1&gt; rdf:type fuseki:Service ;
fuseki:name &quot;ds&quot; ; # http://host:port/ds
fuseki:endpoint [
# SPARQL query service
fuseki:operation fuseki:query ;
fuseki:name &quot;sparql&quot;
] ;
fuseki:endpoint [
# SPARQL query service (alt name)
fuseki:operation fuseki:query ;
fuseki:name &quot;query&quot;
] ;
fuseki:endpoint [
# SPARQL update service
fuseki:operation fuseki:update ;
fuseki:name &quot;update&quot;
] ;
fuseki:endpoint [
# HTML file upload service
fuseki:operation fuseki:update ;
fuseki:name &quot;update&quot;
] ;
fuseki:endpoint [
# SPARQL Graph Store Protocol (read)
fuseki:operation fuseki:gsp_r ;
fuseki:name &quot;get&quot;
] ;
fuseki:endpoint [
# SPARQL Graph Store Protcol (read and write)
fuseki:operation fuseki:gsp_rw ;
fuseki:name &quot;data&quot;
] ;
fuseki:dataset &lt;#dataset&gt; ;
.
</code></pre>
<p><code>&lt;#dataset&gt;</code> refers to a dataset description in the same file.</p>
<p>HTTP requests will include the service name: <tt>http://<i>host:port</i>/ds/sparql?query=...</tt>.</p>
<h3 id="read-only-service">Read-only service</h3>
<p>This example offers only read-only endpoints (SPARQL Query and HTTP GET
SPARQL Graph Store protocol).</p>
<p>This service offers read-only access to a dataset with a single
graph of data.</p>
<pre><code>&lt;#service2&gt; rdf:type fuseki:Service ;
fuseki:name &quot;/ds-ro&quot; ; # http://host:port/ds-ro
fuseki:endpoint [ fuseki:operation fuseki:query ; fuseki:name &quot;sparql&quot; ];
fuseki:endpoint [ fuseki:operation fuseki:query ; fuseki:name &quot;query&quot; ];
fuseki:endpoint [ fuseki:operation fuseki:gsp_r ; fuseki:name &quot;data&quot; ];
fuseki:dataset &lt;#dataset&gt; ;
.
</code></pre>
<h3 id="data-services-on-the-dataset">Data services on the dataset</h3>
<p>The standard SPARQL operations can also be defined on the dataset URL with no secondary service name:</p>
<p>&lt;#service2&gt; rdf:type fuseki:Service ;
fuseki:name &ldquo;/dataset&rdquo; ;
fuseki:endpoint [ fuseki:operation fuseki:query ];
fuseki:endpoint [ fuseki:operation fuseki:gsp_r ];
fuseki:dataset &lt;#dataset&gt; ;
.</p>
<p>HTTP requests use the URL of the dataset.</p>
<ul>
<li>SPARQL Query: <tt>http://<i>host:port</i>/dataset?query=...</tt></li>
<li>Fetch the default graph
(<a href="https://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL Graph Store Protocol</a>):
<tt>http://<i>host:port</i>/dataset?default</tt></li>
</ul>
<h2 id="server-configuration">Server Configuration</h2>
<p>If you need to load additional classes, or set global parameters, then these go in
<code>FUSEKI_BASE/config.ttl</code>.</p>
<p>Additional classes can not be loaded if running as a <code>.war</code> file. You will
need to create a custom <code>.war</code> file consisting of the contents of the Fuseki
web application and the additional classes</p>
<p>The server section is optional.</p>
<p>If absent, fuseki configuration is performed
by searching the configuration file for the type <code>fuseki:Service</code>.</p>
<h3 id="server-section">Server Section</h3>
<pre><code>[] 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: &quot;1000&quot; -- 1 second timeout
# Format 2: &quot;10000,60000&quot; -- 10s timeout to first result, then 60s timeout to for rest of query.
# See java doc for ARQ.queryTimeout
# ja:context [ ja:cxtName &quot;arq:queryTimeout&quot; ; ja:cxtValue &quot;10000&quot; ] ;
# Explicitly choose which services to add to the server.
# If absent, include all descriptions of type `fuseki:Service`.
# fuseki:services (&lt;#service1&gt; &lt;#service2&gt;)
.
</code></pre>
<h2 id="datasets">Datasets</h2>
<h3 id="in-memory">In-memory</h3>
<p>An in-memory dataset, with data in the default graph taken from a local file.</p>
<pre><code>&lt;#books&gt; rdf:type ja:RDFDataset ;
rdfs:label &quot;Books&quot; ;
ja:defaultGraph
[ rdfs:label &quot;books.ttl&quot; ;
a ja:MemoryModel ;
ja:content [ja:externalContent &lt;file:Data/books.ttl&gt; ] ;
] ;
.
</code></pre>
<h3 id="tdb">TDB</h3>
<pre><code>&lt;#dataset&gt; rdf:type tdb:DatasetTDB ;
tdb:location &quot;DB&quot; ;
# Query timeout on this dataset (1s, 1000 milliseconds)
ja:context [ ja:cxtName &quot;arq:queryTimeout&quot; ; ja:cxtValue &quot;1000&quot; ] ;
# Make the default graph be the union of all named graphs.
## tdb:unionDefaultGraph true ;
.
</code></pre>
<h3 id="tdb2">TDB2</h3>
<pre><code>&lt;#dataset&gt; rdf:type tdb:DatasetTDB2 ;
tdb:location &quot;DB2&quot; ;
# Query timeout on this dataset (1s, 1000 milliseconds)
ja:context [ ja:cxtName &quot;arq:queryTimeout&quot; ; ja:cxtValue &quot;1000&quot; ] ;
# Make the default graph be the union of all named graphs.
## tdb:unionDefaultGraph true ;
.
</code></pre>
<h3 id="inference">Inference</h3>
<p>An inference reasoner can be layered on top of a dataset as defined above. The type of reasoner must be selected carefully and should not include more reasoning than is required by the application, as extensive reasoning can be detrimental to performance.</p>
<p>You have to build up layers of dataset, inference model, and graph.</p>
<pre><code>&lt;#dataset&gt; rdf:type ja:RDFDataset;
ja:defaultGraph &lt;#inferenceModel&gt;
.
&lt;#inferenceModel&gt; rdf:type ja:InfModel;
ja:reasoner [ ja:reasonerURL &lt;http://example/someReasonerURLHere&gt; ];
ja:baseModel &lt;#baseModel&gt;;
.
&lt;#baseModel&gt; rdf:type tdb:GraphTDB2; # for example.
tdb2:location &quot;/some/path/to/store/data/to&quot;;
# etc
.
</code></pre>
<p>where <code>http://example/someReasonerURLHere</code> is one of the URLs below.</p>
<h4 id="possible-reasoners">Possible reasoners:</h4>
<p>Details are in <a href="/documentation/inference/">the main documentation for inference</a>.</p>
<ul>
<li>
<p><strong>Generic Rule Reasoner</strong>: <code>http://jena.hpl.hp.com/2003/GenericRuleReasoner</code></p>
<p>The specific rule set and mode configuration can be set through parameters in the configuration Model.</p>
</li>
<li>
<p><strong>Transitive Reasoner</strong>: <code>http://jena.hpl.hp.com/2003/TransitiveReasoner</code></p>
<p>A simple &ldquo;reasoner&rdquo; used to help with API development.</p>
<p>This reasoner caches a transitive closure of the subClass and subProperty graphs. The generated infGraph allows both the direct and closed versions of these properties to be retrieved. The cache is built when the tbox is bound in but if the final data graph contains additional subProperty/subClass declarations then the cache has to be rebuilt.</p>
<p>The triples in the tbox (if present) will also be included in any query. Any of tbox or data graph are allowed to be null.</p>
<p><strong>RDFS Rule Reasoner</strong>: <code>http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner</code></p>
<p>A full implementation of RDFS reasoning using a hybrid rule system, together with optimized subclass/subproperty closure using the transitive graph caches. Implements the container membership property rules using an optional data scanning hook. Implements datatype range validation.</p>
</li>
<li>
<p><strong>Full OWL Reasoner</strong>: <code>http://jena.hpl.hp.com/2003/OWLFBRuleReasoner</code></p>
<p>A hybrid forward/backward implementation of the OWL closure rules.</p>
</li>
<li>
<p><strong>Mini OWL Reasoner</strong>: <code>http://jena.hpl.hp.com/2003/OWLMiniFBRuleReasoner</code></p>
<p>Key limitations over the normal OWL configuration are:</p>
<ul>
<li>omits the someValuesFrom =&gt; bNode entailments</li>
<li>avoids any guard clauses which would break the find() contract</li>
<li>omits inheritance of range implications for XSD datatype ranges</li>
</ul>
</li>
<li>
<p><strong>Micro OWL Reasoner</strong>: <code>http://jena.hpl.hp.com/2003/OWLMicroFBRuleReasoner</code></p>
</li>
</ul>
<p>This only supports:</p>
<ul>
<li>RDFS entailments</li>
<li>basic OWL axioms like ObjectProperty subClassOf Property</li>
<li>intersectionOf, equivalentClass and forward implication of unionOf sufficient for traversal of explicit class hierarchies</li>
<li>Property axioms (inverseOf, SymmetricProperty, TransitiveProperty, equivalentProperty)</li>
</ul>
<p>There is some experimental support for the cheaper class restriction handling which should not be relied on at this point.</p>
</div>
</div>
</div>
<footer class="footer">
<div class="container" style="font-size:80%" >
<p>
Copyright &copy; 2011&ndash;2022 The Apache Software Foundation, Licensed under the
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.
</p>
<p>
Apache Jena, Jena, the Apache Jena project logo, Apache and the Apache feather logos are trademarks of
The Apache Software Foundation.
<br/>
<a href="https://privacy.apache.org/policies/privacy-policy-public.html"
>Apache Software Foundation Privacy Policy</a>.
</p>
</div>
</footer>
<script type="text/javascript">
var link = $('a[href="' + this.location.pathname + '"]');
if (link != undefined)
link.parents('li,ul').addClass('active');
</script>
</body>
</html>