# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

## Example of a TDB dataset published using Fuseki: persistent storage.

@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#> .

[] 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_tdb_opendata>
   ) .

# TDB
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

## ---------------------------------------------------------------
## OpenData dataset.

<#service_tdb_opendata> rdf:type fuseki:Service ;
    rdfs:label                      "TDB Service (RW)" ;
    fuseki:name                     "opendata" ;
    fuseki:serviceQuery             "query" ;
    fuseki:serviceQuery             "sparql" ;
    fuseki:serviceUpdate            "update" ;
    fuseki:serviceUpload            "upload" ;
    fuseki:serviceReadWriteGraphStore      "data" ;
    # A separate read-only graph store endpoint:
    fuseki:serviceReadGraphStore       "get" ;
    fuseki:dataset           <#tdb_dataset_opendata> ;
    .

    <#tdb_dataset_opendata> rdf:type      tdb:DatasetTDB ;
    tdb:location "DB/opendata" ;
    tdb:unionDefaultGraph true ;
    .

## ---------------------------------------------------------------
## Read-only TDB dataset (only read services enabled).

<#service_tdb_read_only> rdf:type fuseki:Service ;
    rdfs:label                      "TDB Service (R)" ;
    fuseki:name                     "ds" ;
    fuseki:serviceQuery             "query" ;
    fuseki:serviceQuery             "sparql" ;
    # Don't allow SPARQL Update.
    #fuseki:serviceUpdate            "update" ;
    # Use the read-only service.
    fuseki:serviceReadGraphStore    "data" ;
    fuseki:serviceReadGraphStore    "get" ;
    fuseki:dataset           <#tdb_dataset_read> ;
    .

<#tdb_dataset_read> rdf:type      tdb:DatasetTDB ;
    tdb:location "DB1" ;
    tdb:unionDefaultGraph true ;
    .

## ---------------------------------------------------------------
## Updatable TDB dataset with all services enabled.

<#service_tdb_all> rdf:type fuseki:Service ;
    rdfs:label                      "TDB Service (RW)" ;
    fuseki:name                     "data" ;
    fuseki:serviceQuery             "query" ;
    fuseki:serviceQuery             "sparql" ;
    fuseki:serviceUpdate            "update" ;
    fuseki:serviceUpload            "upload" ;
    fuseki:serviceReadWriteGraphStore      "data" ;
    # A separate read-only graph store endpoint:
    fuseki:serviceReadGraphStore       "get" ;
    fuseki:dataset           <#tdb_dataset_readwrite> ;
    .

<#tdb_dataset_readwrite> rdf:type      tdb:DatasetTDB ;
    tdb:location "DB2" ;
##     # Query timeout on this dataset (milliseconds)
##     ja:context [ ja:cxtName "arq:queryTimeout" ;  ja:cxtValue "1000" ] ;
##     # Default graph for query is the (read-only) union of all named graphs.
     .
