Hi Andy, 

Thank you for the information, I manage to do this with the following code: 

“
Model spec = FileManager.get().loadModel(config);
Resource root = spec.createResource( spec.expandPrefix( rootDS ));
dataset = DatasetFactory.assemble(root) ;
“

I have a following question, rather out of curiosity, that it seems that if I 
use this code, I can’t use transaction (throwing 
java.lang.UnsupportedOperationException). Is there possible that model with 
inference could support transaction?

Best regards,
--
Fajar J. Ekaputra



On 11 Mar 2014, at 12:51, Andy Seaborne <[email protected]> wrote:

> On 08/03/14 01:54, Fajar Juang Ekaputra wrote:
>> Hi,
>> 
>> I am trying to run TDB with jena rules inference using assembly
>> file.
> I could do it with Fuseki, but I cannot find any example to run it with
> non-Fuseki TDB storage. Is it possible to do this?
> 
> Yes.
> 
> <#dataset> rdf:type       ja:RDFDataset ;
>    ja:defaultGraph       <#model_inf> ;
>     .
> 
> <#model_inf> a ja:InfModel ;
>     ja:baseModel <#tdbGraph> ;
>     ja:reasoner [
>         ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
>     ] .
> 
> <#tdbDataset> rdf:type tdb:DatasetTDB ;
>    tdb:location "DB" ;
>    # If the unionDefaultGraph is used, then the "update" service should be 
> removed.
>    # The unionDefaultGraph is read only.
>    # tdb:unionDefaultGraph true ;
>    .
> 
> <#tdbGraph> rdf:type tdb:GraphTDB ;
>    tdb:dataset <#tdbDataset> .
> 
> It's a general dataset, with a graph from a TDB dataset as base data.
> 
> You need to specificy which dataset you are interested in when you call the 
> assembler.  Name the root with the absolute URI for the  #dataset one which 
> is the top of the construction.
> 
>       Andy
> 
>> 
>> I copy my assembler file below. Using this assembler, it seems that
> Jena only read from the database location and ignore other configurations.
> 
>> Thank you and best regards,
>> --
>> Fajar J. Ekaputra
>> 
>> 
>> **Assembler file**
>> 
>> @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#> .
>> 
>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>> 
>> tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
>> tdb:GraphTDB    rdfs:subClassOf  ja:Model .
>> 
>> <#tdbDataset> rdf:type tdb:DatasetTDB ;
>>     tdb:location "tdb/db"
>>     .
>> 
>> <#data> a ja:InfModel ;
>>      ja:baseModel <#tdbGraph> ;
>>      ja:reasoner <#ekbRules>
>>      .
>>      
>> <#ekbRules> a ja:reasoner ;
>>      ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner>;
>>      ja:rulesFrom <file:tdb/ekb.rules>
>>      .
>> 
>> <#tdbGraph> rdf:type tdb:GraphTDB ;
>>     tdb:dataset <#tdbDataset> ;
>>     tdb:location "tdb/db"
>>     .
>> 
> 

Reply via email to