You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jeanette Samuelsen <je...@gmail.com> on 2013/12/10 18:41:26 UTC

OWL Inferencing on TDB database in Fuseki

Hello,

I have tried to make a configuration file for Fuseki to make OWL
inferencing work with a TDB database. Thus far I have been able to do
inferencing on an empty dataset, to connect to the TDB database and do
queries, but not both.

This is the error I'm currently getting:
"com.hp.hpl.jena.assembler.exceptions.AmbiguousSpecificTypeException:
cannot find a most specific type for
file:///home/path/jena/jena-fuseki-1.0.0/test.ttl#dataset2, which has as
possibilities: ja:Model tdb:DatasetTDB."

I tried fixing the error by doing tdb:DatasetTDB rdfs:subClassOf ja:Model ,
but this was not possible.

Below is my configuration file.

Any help would be greatly appreciated.

Best regards,
Jeanette

@prefix :     <#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@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 sdb:     <http://jena.hpl.hp.com/2007/sdb#> .

[] rdf:type fuseki:Server ;

fuseki:services ( <#tdb> ) .

<#tdb> rdf:type fuseki:Service ;
    fuseki:name "tdb" ;
    fuseki:serviceQuery "sparql" ;
    fuseki:serviceUpdate "update" ;
    fuseki:dataset <#model2> ;
.

#select which set to . #use
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
    tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
    tdb:GraphTDB rdfs:subClassOf ja:Model .

<#dataset2>
        rdf:type tdb:DatasetTDB;
        tdb:location "/home/path/tdb/sports" ;
        tdb:unionDefaultGraph true ;
.

<#model2> rdf:type ja:InfModel;
    ja:baseModel <#dataset2>;
    ja:reasoner
      [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>;
        ja:schema <#interpretationSchema>
      ] .
        #<#tdbGraph> rdf:type tdb:GraphTDB; tdb:location "DB"; .
    <#interpretationSchema> a ja:MemoryModel ;
        ja:content [ ja:externalContent <file:/home/path/running.n3> ;
    ]
   .

Re: OWL Inferencing on TDB database in Fuseki

Posted by Diogo FC Patrao <dj...@gmail.com>.
Hello Jeanette

Is your configuration file set to store in memory the results of inferences
over TDB data ? I'm interested in loading the whole inference closure at
startup time, is that what you're trying to do?

Thanks!



--
diogo patrĂ£o




On Tue, Dec 10, 2013 at 3:41 PM, Jeanette Samuelsen <
jeanette.samuelsen@gmail.com> wrote:

> Hello,
>
> I have tried to make a configuration file for Fuseki to make OWL
> inferencing work with a TDB database. Thus far I have been able to do
> inferencing on an empty dataset, to connect to the TDB database and do
> queries, but not both.
>
> This is the error I'm currently getting:
> "com.hp.hpl.jena.assembler.exceptions.AmbiguousSpecificTypeException:
> cannot find a most specific type for
> file:///home/path/jena/jena-fuseki-1.0.0/test.ttl#dataset2, which has as
> possibilities: ja:Model tdb:DatasetTDB."
>
> I tried fixing the error by doing tdb:DatasetTDB rdfs:subClassOf ja:Model ,
> but this was not possible.
>
> Below is my configuration file.
>
> Any help would be greatly appreciated.
>
> Best regards,
> Jeanette
>
> @prefix :     <#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @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 sdb:     <http://jena.hpl.hp.com/2007/sdb#> .
>
> [] rdf:type fuseki:Server ;
>
> fuseki:services ( <#tdb> ) .
>
> <#tdb> rdf:type fuseki:Service ;
>     fuseki:name "tdb" ;
>     fuseki:serviceQuery "sparql" ;
>     fuseki:serviceUpdate "update" ;
>     fuseki:dataset <#model2> ;
> .
>
> #select which set to . #use
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>     tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
>     tdb:GraphTDB rdfs:subClassOf ja:Model .
>
> <#dataset2>
>         rdf:type tdb:DatasetTDB;
>         tdb:location "/home/path/tdb/sports" ;
>         tdb:unionDefaultGraph true ;
> .
>
> <#model2> rdf:type ja:InfModel;
>     ja:baseModel <#dataset2>;
>     ja:reasoner
>       [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>;
>         ja:schema <#interpretationSchema>
>       ] .
>         #<#tdbGraph> rdf:type tdb:GraphTDB; tdb:location "DB"; .
>     <#interpretationSchema> a ja:MemoryModel ;
>         ja:content [ ja:externalContent <file:/home/path/running.n3> ;
>     ]
>    .
>

Re: OWL Inferencing on TDB database in Fuseki

Posted by Jeanette Samuelsen <je...@gmail.com>.
Thanks again Andy,

I finally got it working. You made my day! :D

Cheers,
Jeanette


On Tue, Dec 10, 2013 at 7:02 PM, Andy Seaborne <an...@apache.org> wrote:

> On 10/12/13 17:41, Jeanette Samuelsen wrote:
>
>> Hello,
>>
>> I have tried to make a configuration file for Fuseki to make OWL
>> inferencing work with a TDB database. Thus far I have been able to do
>> inferencing on an empty dataset, to connect to the TDB database and do
>> queries, but not both.
>>
>> This is the error I'm currently getting:
>> "com.hp.hpl.jena.assembler.exceptions.AmbiguousSpecificTypeException:
>> cannot find a most specific type for
>> file:///home/path/jena/jena-fuseki-1.0.0/test.ttl#dataset2, which has as
>> possibilities: ja:Model tdb:DatasetTDB."
>>
>> I tried fixing the error by doing tdb:DatasetTDB rdfs:subClassOf ja:Model
>> ,
>> but this was not possible.
>>
>> Below is my configuration file.
>>
>
> At
> [[
>
> <#model2> rdf:type ja:InfModel;
>       ja:baseModel <#dataset2>
> ]]
> it needs a model(=graph) not a dataset (a collection of graphs).
>
> See
> http://jena.apache.org/documentation/tdb/assembler.html#graph
>
> You need something like (untested):
>
>
> <#dataset2> rdf:type tdb:DatasetTDB ;
>     tdb:location "DB" ;
>
> <#graph2> rdf:type tdb:GraphTDB ;
>     tdb:dataset <#dataset2> .
>
>
> <#model2> rdf:type ja:InfModel;
>       ja:baseModel <#graph2>
> ....
>
> Note ja:baseModel -> <#graph2> of type tdb:GraphTDB
>
>
>
>> Any help would be greatly appreciated.
>>
>> Best regards,
>> Jeanette
>>
>> @prefix :     <#> .
>> @prefix fuseki: <http://jena.apache.org/fuseki#> .
>> @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 sdb:     <http://jena.hpl.hp.com/2007/sdb#> .
>>
>> [] rdf:type fuseki:Server ;
>>
>> fuseki:services ( <#tdb> ) .
>>
>> <#tdb> rdf:type fuseki:Service ;
>>      fuseki:name "tdb" ;
>>      fuseki:serviceQuery "sparql" ;
>>      fuseki:serviceUpdate "update" ;
>>      fuseki:dataset <#model2> ;
>> .
>>
>> #select which set to . #use
>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>>      tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
>>      tdb:GraphTDB rdfs:subClassOf ja:Model .
>>
>> <#dataset2>
>>          rdf:type tdb:DatasetTDB;
>>          tdb:location "/home/path/tdb/sports" ;
>>          tdb:unionDefaultGraph true ;
>> .
>>
>> <#model2> rdf:type ja:InfModel;
>>      ja:baseModel <#dataset2>;
>>      ja:reasoner
>>        [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>;
>>          ja:schema <#interpretationSchema>
>>        ] .
>>          #<#tdbGraph> rdf:type tdb:GraphTDB; tdb:location "DB"; .
>>      <#interpretationSchema> a ja:MemoryModel ;
>>          ja:content [ ja:externalContent <file:/home/path/running.n3> ;
>>      ]
>>     .
>>
>>
>

Re: OWL Inferencing on TDB database in Fuseki

Posted by Andy Seaborne <an...@apache.org>.
On 10/12/13 17:41, Jeanette Samuelsen wrote:
> Hello,
>
> I have tried to make a configuration file for Fuseki to make OWL
> inferencing work with a TDB database. Thus far I have been able to do
> inferencing on an empty dataset, to connect to the TDB database and do
> queries, but not both.
>
> This is the error I'm currently getting:
> "com.hp.hpl.jena.assembler.exceptions.AmbiguousSpecificTypeException:
> cannot find a most specific type for
> file:///home/path/jena/jena-fuseki-1.0.0/test.ttl#dataset2, which has as
> possibilities: ja:Model tdb:DatasetTDB."
>
> I tried fixing the error by doing tdb:DatasetTDB rdfs:subClassOf ja:Model ,
> but this was not possible.
>
> Below is my configuration file.

At
[[
<#model2> rdf:type ja:InfModel;
       ja:baseModel <#dataset2>
]]
it needs a model(=graph) not a dataset (a collection of graphs).

See
http://jena.apache.org/documentation/tdb/assembler.html#graph

You need something like (untested):

<#dataset2> rdf:type tdb:DatasetTDB ;
     tdb:location "DB" ;

<#graph2> rdf:type tdb:GraphTDB ;
     tdb:dataset <#dataset2> .

<#model2> rdf:type ja:InfModel;
       ja:baseModel <#graph2>
....

Note ja:baseModel -> <#graph2> of type tdb:GraphTDB

>
> Any help would be greatly appreciated.
>
> Best regards,
> Jeanette
>
> @prefix :     <#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> @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 sdb:     <http://jena.hpl.hp.com/2007/sdb#> .
>
> [] rdf:type fuseki:Server ;
>
> fuseki:services ( <#tdb> ) .
>
> <#tdb> rdf:type fuseki:Service ;
>      fuseki:name "tdb" ;
>      fuseki:serviceQuery "sparql" ;
>      fuseki:serviceUpdate "update" ;
>      fuseki:dataset <#model2> ;
> .
>
> #select which set to . #use
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>      tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
>      tdb:GraphTDB rdfs:subClassOf ja:Model .
>
> <#dataset2>
>          rdf:type tdb:DatasetTDB;
>          tdb:location "/home/path/tdb/sports" ;
>          tdb:unionDefaultGraph true ;
> .
>
> <#model2> rdf:type ja:InfModel;
>      ja:baseModel <#dataset2>;
>      ja:reasoner
>        [ ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>;
>          ja:schema <#interpretationSchema>
>        ] .
>          #<#tdbGraph> rdf:type tdb:GraphTDB; tdb:location "DB"; .
>      <#interpretationSchema> a ja:MemoryModel ;
>          ja:content [ ja:externalContent <file:/home/path/running.n3> ;
>      ]
>     .
>