You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Harkishan Singh <ha...@gmail.com> on 2014/04/08 15:16:13 UTC
Inferencing on TDB
Hi,
I have created TDB which stores bulky data.
Now I have some rules and I want to apply these rules on tdb.
This is my assembler file:
@prefix : <http://localhost/jena_example/#> .
@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 dc: <http://purl.org/dc/terms/> .
@prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#>
.
@prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#>
.
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dita: <http://purl.org/dita/ns#> .
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .
<#dataset> rdf:type ja:RDFDataset ;
ja:defaultGraph<#infModel> .
<#infModel> a ja:InfModel ;
ja:baseModel<#tdbGraph>;
ja:reasoner
[ja:rule "[r1: (?bt rdf:type dc:Document) ,(?doc foaf:topic ?bt
),(?doc dc:title ?name) -> (?bt predicate ?name)]"] .
<#tdbGraph> rdf:type tdb:GraphTDB ;
tdb:location "DB" ;
Now I want to run the infer command (riotcmd.infer --rdfs VOCAB FILE
FILE...)which I got from this link -
http://jena.apache.org/documentation/io/
The problem is :
1)I'm not able to make out what parameters to pass in above command.
2)After applying the rules, inferred results will be merged into a tdb or
if I want to store inferred results in a separate file then what additional
configurations I have to do?
Thanks a lot! Hope you can help.
Re: Inferencing on TDB
Posted by Dave Reynolds <da...@gmail.com>.
riodcmd.infer is for streaming RDFS inference, not general rule processing.
The rulemap command will run general rules. It doesn't know about TDB or
assemblers but will work from files. The rule processing is memory
limited anyway. Having generated your closure file you can then load it
into TDB how you wish.
Alternatively you could write a short program to do the inference direct
from the TDB (won't be any faster) and put the results where you want them.
Dave
On 08/04/14 14:16, Harkishan Singh wrote:
> Hi,
>
> I have created TDB which stores bulky data.
> Now I have some rules and I want to apply these rules on tdb.
>
> This is my assembler file:
>
> @prefix : <http://localhost/jena_example/#> .
> @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 dc: <http://purl.org/dc/terms/> .
> @prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#>
> .
> @prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#>
> .
> @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
> @prefix dita: <http://purl.org/dita/ns#> .
>
>
>
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
> tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
> tdb:GraphTDB rdfs:subClassOf ja:Model .
>
> <#dataset> rdf:type ja:RDFDataset ;
> ja:defaultGraph<#infModel> .
>
> <#infModel> a ja:InfModel ;
> ja:baseModel<#tdbGraph>;
> ja:reasoner
> [ja:rule "[r1: (?bt rdf:type dc:Document) ,(?doc foaf:topic ?bt
> ),(?doc dc:title ?name) -> (?bt predicate ?name)]"] .
>
> <#tdbGraph> rdf:type tdb:GraphTDB ;
> tdb:location "DB" ;
>
>
> Now I want to run the infer command (riotcmd.infer --rdfs VOCAB FILE
> FILE...)which I got from this link -
> http://jena.apache.org/documentation/io/
>
> The problem is :
> 1)I'm not able to make out what parameters to pass in above command.
> 2)After applying the rules, inferred results will be merged into a tdb or
> if I want to store inferred results in a separate file then what additional
> configurations I have to do?
>
>
> Thanks a lot! Hope you can help.
>