Skip to content

Instantly share code, notes, and snippets.

@kinow
Created March 18, 2018 09:22
Show Gist options
  • Save kinow/23d7c0e1b22201a530d8d137c7afb41e to your computer and use it in GitHub Desktop.
Save kinow/23d7c0e1b22201a530d8d137c7afb41e to your computer and use it in GitHub Desktop.
## Example of a TDB dataset and text index published using Fuseki
@prefix : <#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@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 skos: <http://www.w3.org/2004/02/skos/core#> .
[] ja:loadClass "org.apache.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
[] ja:loadClass "org.apache.jena.query.text.TextQuery" .
text:TextDataset rdfs:subClassOf ja:RDFDataset .
text:TextIndexLucene rdfs:subClassOf text:TextIndex .
[] rdf:type fuseki:Server ;
fuseki:services (
<#service_text_tdb>
) .
<#service_text_tdb> rdf:type fuseki:Service ;
rdfs:label "TDB/text service" ;
fuseki:name "ds" ;
fuseki:serviceQuery "query" ;
fuseki:serviceQuery "sparql" ;
fuseki:serviceUpdate "update" ;
fuseki:serviceUpload "upload" ;
fuseki:serviceReadGraphStore "get" ;
fuseki:serviceReadWriteGraphStore "data" ;
fuseki:dataset <#text_dataset> ;
.
<#text_dataset> rdf:type text:TextDataset ;
text:dataset <#dataset> ;
text:index <#indexLucene> ;
.
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "/home/kinow/Desktop/db" ;
tdb:unionDefaultGraph true ; # Optional
.
<#indexLucene> a text:TextIndexLucene ;
text:directory <file:/home/kinow/Desktop/lucene> ;
text:entityMap <#entMap> ;
text:storeValues true ;
text:analyzer [
a text:StandardAnalyzer
] ;
text:queryAnalyzer [
a text:StandardAnalyzer
] ;
text:queryParser text:AnalyzingQueryParser ;
text:multilingualSupport true ;
.
<#entMap> a text:EntityMap ;
text:defaultField "title" ;
text:entityField "uri" ;
text:uidField "uid" ;
text:langField "lang" ;
text:graphField "graph" ;
text:map (
[ text:field "title" ;
text:predicate dc:title
]
)
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment