Reputation: 37
Hi guys I am trying to load data with TDB2 assembler
@prefix cq: <http://www.example.co.uk/hya>
@prefix tdb: <http://jena.apache.org/2016/tdb#> .
@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 text: <http://jena.apache.org/text#>
@prefix lm: <http://jena.hpl.hp.com/2004/08/location-mapping#>
@prefix dc: <http://purl.org/dc/elements/1.1/>
[] ja:loadClass "org.apache.jena.tdb2.TDB2" .
tdb:DatasetTDB2 rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB2 rdfs:subClassOf ja:Model .
<#dataset> rdf:type tdb:DatasetTDB2 ;
tdb:location "DB" ;
tdb:unionDefaultGraph true ;
.
<#data1> rdf:type tdb:GraphTDB ;
tdb:dataset <#dataset> ;
tdb:graphName <http://www.example.co.uk/hya/qdata> ;
ja:content [ja:externalContent <file:////Volumes/data/project/src/test/resources/metadata.ttl>;];
.
which is not working when i try to assemble dataset
Dataset dataset = TDB2Factory.assembleDataset("/Volumes/data/project/src/main/resources/tdb/tdb-assembler.ttl");
if(dataset ==null) {
log.debug("failed");
}else {
1. Model model = dataset.getUnionModel();
2. Model model = dataset.getNamedModel("<dataset>");
3. Model model = dataset.getDefaultModel();
dataset.begin(ReadWrite.WRITE);
model.write(System.out, Lang.TTL.getName());
}
I have tried to print model 3 different ways without success.
Can some suggest the best way to address this issue, and if there is any refrence documentation arounf TDB2.
Ideally i like to configure it later with following
:indexed-dataset
rdf:type text:TextDataset ;
text:dataset <#dataset> ;
text:index <#indexLuceneText> ;
.
# Text index description
<#indexLuceneText> a text:TextIndexLucene ;
text:directory <file:TDB/LUCENE> ;
text:entityMap <#entMap> ;
text:storeValues true ;
text:analyzer [ a text:StandardAnalyzer ] ;
text:queryAnalyzer [ a text:KeywordAnalyzer ] ;
text:queryParser text:AnalyzingQueryParser ;
text:multilingualSupport true ;
.
<#entMap> a text:EntityMap ;
according to assembler schema
"every model can has some content specified by a Content object."
ja:content a rdf:Property
; rdfs:label "Assembler.content"
; rdfs:comment
"""specifies that the subject Loadable is to be loaded with
all the contents specified by the object Content.
"""
; rdfs:domain ja:Loadable
; rdfs:range ja:Content
.
Upvotes: 0
Views: 362
Reputation: 16630
Persistent databases (TDB1, TDB2) don't process ja:content
because that is a directive to load data each time into a memory model.
Instead, load the data with a TDB bulkloader beforehand.
For the text idnex,load the index with the textindexer
command.
https://jena.apache.org/documentation/query/text-query.html
Upvotes: 1