You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Eric Scott <er...@att.net> on 2020/11/23 14:41:41 UTC
Guidance on configuring TDB stores with assembler files
<https://crosschx.slack.com/archives/D01BC93UUCS/p1606141163002200>Hi all-
I'm hoping to be able to use assembler files to maintain a library of
resources that can later be indexed into TDB2, but I think there's
something I'm not getting.
See the appendix below for my minimal config file.
It's my understanding that I should be able to do this:
Dataset ds = TDB2Factory.assembleDataset("path/to/mini-config.ttl") ;
Then run this query against ds:
Select * where {?s ?p ?o.}
And get the triple I encoded with a literalContent statement.
When I run this, the assembleDataset operation does indeed construct the
tdb repo at the indicated location, but the query returns nothing.Is
there some extra step I need to do that I'm missing?
Thanks,
# APPENDIX:mini-config.ttl
@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#> .
[] ja:loadClass "org.apache.jena.tdb2.TDB2" .
tdb:DatasetTDB2 rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB2 rdfs:subClassOf ja:Model .
<#MyTDBDataset> a tdb:DatasetTDB2;
tdb:location "DB" ;
.
<#MyGraph> a tdb:GraphTDB2;
rdfs:comment "A graph with a single triple" ;
tdb:dataset <#MyTDBDataset>;
ja:content [ja:literalContent "<http://eg.com/a> <http://eg.com/b>
<http://eg.com/c>."] ;
.
Re: Guidance on configuring TDB stores with assembler files
Posted by Andy Seaborne <an...@apache.org>.
Hi Eric,
> <#MyGraph> a tdb:GraphTDB2;
> rdfs:comment "A graph with a single triple" ;
> tdb:dataset <#MyTDBDataset>;
> ja:content [ja:literalContent
> "<http://eg.com/a> <http://eg.com/b> <http://eg.com/c>."
> ] ;
tdb:GraphTDB2 does not support ja:content
The assembler file is going to be used every time the application runs,
whereas data is "load once"; it would not know if the data has
previously been load or not.
You can load data before hand:
tdb2.tdbloader --loc "DB"
even from a pipe:
echo "<http://eg.com/a> <http://eg.com/b> <http://eg.com/c>." | \
tdb2.tdbloader --loc DB2
Andy
On 23/11/2020 14:41, Eric Scott wrote:
> <https://crosschx.slack.com/archives/D01BC93UUCS/p1606141163002200>Hi all-
>
> I'm hoping to be able to use assembler files to maintain a library of
> resources that can later be indexed into TDB2, but I think there's
> something I'm not getting.
>
> See the appendix below for my minimal config file.
>
> It's my understanding that I should be able to do this:
>
> Dataset ds = TDB2Factory.assembleDataset("path/to/mini-config.ttl") ;
>
> Then run this query against ds:
>
> Select * where {?s ?p ?o.}
>
> And get the triple I encoded with a literalContent statement.
>
> When I run this, the assembleDataset operation does indeed construct the
> tdb repo at the indicated location, but the query returns nothing.Is
> there some extra step I need to do that I'm missing?
>
> Thanks,
>
>
> # APPENDIX:mini-config.ttl
>
> @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#> .
>
> [] ja:loadClass "org.apache.jena.tdb2.TDB2" .
> tdb:DatasetTDB2 rdfs:subClassOf ja:RDFDataset .
> tdb:GraphTDB2 rdfs:subClassOf ja:Model .
>
> <#MyTDBDataset> a tdb:DatasetTDB2;
> tdb:location "DB" ;
> .
>
> <#MyGraph> a tdb:GraphTDB2;
> rdfs:comment "A graph with a single triple" ;
> tdb:dataset <#MyTDBDataset>;
> ja:content [ja:literalContent "<http://eg.com/a> <http://eg.com/b>
> <http://eg.com/c>."] ;
> .
>
>
>