You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Alexei Golovko <al...@gmail.com> on 2013/10/01 14:57:36 UTC

Datatype restrictions.

Can fuseki infer subclassing between faceted datatypes?

E.g., if I run update

PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

INSERT {

  :ev1 a [
    a rdfs:Datatype ;
    owl:onDatatype xsd:integer ;
    owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive 2013])
  ];
  a :my .

} WHERE {}

... than only first select finds :ev1, though I expect both should.

The first select:

prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?s WHERE { ?s a :my .
  ?s a [
    a rdfs:Datatype ;
    owl:onDatatype xsd:integer ;
    owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive 2013])
  ] .
}

The second select:

prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?s WHERE { ?s a :my .
  ?s a [
    a rdfs:Datatype ;
    owl:onDatatype xsd:integer ;
    owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive 2014])
  ] .
}

I am running jena-fuseki-1.0.0 with config config-inf-tdb.ttl.

Re: Datatype restrictions.

Posted by Andy Seaborne <an...@apache.org>.
On 11/10/13 09:25, Alexei Golovko wrote:
> 2013/10/11 Andy Seaborne <an...@apache.org>
>
>> On 10/10/13 07:25, Alexei Golovko wrote:
>>
>>> Could not enable pellet reasoner.
>>>
>>> If I use approach from the quoted thread, I see:
>>>
>>>
>>> Error 500: tried to access field
>>> com.hp.hpl.jena.reasoner.**BaseInfGraph.isPrepared from class
>>> org.mindswap.pellet.jena.**PelletInfGraph

...

> Now fuseki starts, the only remaining problem is 500 error, same as above.

Is the version of Pellet you are using compatible with the version of 
Jena in the Fuseki you have? (it looks like it is not)  This is a 
question for the Pellet mailing list.

	Andy

>
>
>>           Andy
>>
>>
>>
>>> 2013/10/7 Alexei Golovko <al...@gmail.com>
>>>
>>>   Thank you, I will try Pellet. (Actually, this was already in my plans,
>>>> but
>>>> section of Pellet documentation about using with Jena is so short. Though
>>>> there seems to exist configuration example in
>>>> http://mail-archives.apache.**org/mod_mbox/jena-users/**
>>>> 201106.mbox/%3CDDD95E03-9BB4-**423A-8FB6-A1DEE8E2EA97@gmx.**net%3E<http://mail-archives.apache.org/mod_mbox/jena-users/201106.mbox/%3CDDD95E03-9BB4-423A-8FB6-A1DEE8E2EA97@gmx.net%3E>
>>>> .)
>>>>
>>>>
>>>>   I use fuseki-1.0.0, pellet-2.3.1.
>>>
>>> echo ${JARS}
>>> /home/i/jena-fuseki-1.0.0/**fuseki-server.jar:/home/i/**
>>> pellet-2.3.1/lib/aterm-java-1.**6.jar:/home/i/pellet-2.3.1/**
>>> lib/pellet-cli.jar:/home/i/**pellet-2.3.1/lib/pellet-core.**
>>> jar:/home/i/pellet-2.3.1/lib/**pellet-datatypes.jar:/home/i/**
>>> pellet-2.3.1/lib/pellet-el.**jar:/home/i/pellet-2.3.1/lib/**
>>> pellet-explanation.jar:/home/**i/pellet-2.3.1/lib/pellet-**
>>> jena.jar:/home/i/pellet-2.3.1/**lib/pellet-modularity.jar:/**
>>> home/i/pellet-2.3.1/lib/**pellet-owlapiv3.jar:/home/i/**
>>> pellet-2.3.1/lib/pellet-**pellint.jar:/home/i/pellet-2.**
>>> 3.1/lib/pellet-query.jar:/**home/i/pellet-2.3.1/lib/**
>>> pellet-rules.jar:/home/i/**pellet-2.3.1/lib/pellet-test.**jar
>>>
>>>
>>> pellet-ex.ttl (used as --desc=pellet-ex.ttl):
>>> @prefix rdf:     <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>
>>> .
>>> @prefix rdfs:    <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>
>>> .
>>> @prefix ja:      <http://jena.hpl.hp.com/2005/**11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>>
>>> .
>>> <#dataset> rdf:type ja:RDFDataset ;
>>>       ja:defaultGraph <#inf_graph> ;
>>> .
>>> <#inf_graph> rdf:type ja:InfModel ;
>>>       ja:reasoner [ja:reasonerClass
>>>           "org.mindswap.pellet.jena.**PelletReasonerFactory" ;
>>>       ] ;
>>>       ja:baseModel <#baseGraph>
>>> .
>>>
>>> <#baseGraph> a ja:MemoryModel ;
>>>       ja:content [ja:externalContent
>>> <file:///home/i/jena-fuseki-1.**0.0/Data/books.ttl>]
>>> .
>>>
>>> pellet.ttl (used as config):
>>> # Licensed under the terms of http://www.apache.org/**
>>> licenses/LICENSE-2.0 <http://www.apache.org/licenses/LICENSE-2.0>
>>>
>>> @prefix :        <#> .
>>> @prefix fuseki:  <http://jena.apache.org/**fuseki#<http://jena.apache.org/fuseki#>>
>>> .
>>> @prefix rdf:     <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>
>>> .
>>> @prefix owl:     <http://www.w3.org/2002/07/**owl#<http://www.w3.org/2002/07/owl#>>
>>> .
>>> @prefix rdfs:   <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>
>>> .
>>> @prefix tdb:     <http://jena.hpl.hp.com/2008/**tdb#<http://jena.hpl.hp.com/2008/tdb#>>
>>> .
>>> @prefix ja:      <http://jena.hpl.hp.com/2005/**11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>>
>>> .
>>>
>>> [] rdf:type fuseki:Server ;
>>>      ja:context [ ja:cxtName "arq:outputGraphBNodeLabels" ; ja:cxtValue
>>> "true" ] ;
>>>      fuseki:services (
>>>        <#service1>
>>>      ) .
>>>
>>> # Custom code.
>>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>>>
>>> # TDB
>>> tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
>>> tdb:GraphTDB    rdfs:subClassOf  ja:Model .
>>>
>>> ## ------------------------------**------------------------------**---
>>> ## Service with only SPARQL query on an inference model.
>>> ## Inference model bbase data in TDB.
>>>
>>> <#service1>  rdf:type fuseki:Service ;
>>>       fuseki:name              "inf" ;             # http://host/inf
>>>       fuseki:serviceQuery      "sparql" ;          # SPARQL query service
>>>       fuseki:serviceUpdate     "update" ;
>>>       fuseki:dataset           <#dataset> ;
>>>       .
>>>
>>> <#dataset> rdf:type       ja:RDFDataset ;
>>>       ja:defaultGraph       <#model_inf> ;
>>>        .
>>>
>>> <#model_inf> a ja:InfModel ;
>>>        ###ja:baseModel <#tdbGraph> ;
>>>        #ja:baseModel <#memGraph> ; ##
>>>        ja:reasoner <#myReasoner> . <#myReasoner> #[
>>>            #ja:reasonerURL <http://jena.hpl.hp.com/2003/**
>>> OWLFBRuleReasoner <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>>
>>>            ja:reasoner [ja:reasonerClass
>>> "org.mindswap.pellet.jena.**PelletReasonerFactory"];
>>>            rdf:type ja:ReasonerFactory;
>>>            #rdf:type [owl:complementOf ja:InfModel]
>>>        . #] .
>>>
>>> ###<#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> .
>>> ##
>>> <#memGraph> a ja:MemoryModel .
>>>
>>>
>>
>


Re: Datatype restrictions.

Posted by Alexei Golovko <al...@gmail.com>.
2013/10/11 Andy Seaborne <an...@apache.org>

> On 10/10/13 07:25, Alexei Golovko wrote:
>
>> Could not enable pellet reasoner.
>>
>> If I use approach from the quoted thread, I see:
>>
>>
>> Error 500: tried to access field
>> com.hp.hpl.jena.reasoner.**BaseInfGraph.isPrepared from class
>> org.mindswap.pellet.jena.**PelletInfGraph
>>
>>
>
Running
java -cp "${JARS}" org.apache.jena.fuseki.FusekiCmd --update --version
--desc=pellet-ex.ttl /inf
gives:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/home/i/jena-fuseki-1.0.0/fuseki-server.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/home/i/pellet-2.3.1/lib/jena/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
Jena:       VERSION: 2.11.0
Jena:       BUILD_DATE: 2013-09-12T10:49:49+0100
ARQ:        VERSION: 2.11.0
ARQ:        BUILD_DATE: 2013-09-12T10:49:49+0100
RIOT:       VERSION: 2.11.0
RIOT:       BUILD_DATE: 2013-09-12T10:49:49+0100
TDB:        VERSION: 1.0.0
TDB:        BUILD_DATE: 2013-09-12T10:49:49+0100
Fuseki:     VERSION: 1.0.0
Fuseki:     BUILD_DATE: 2013-09-12T10:49:49+0100



>  Is the version of Pellet you are using compatible with the version of
> Jena in the Fuseki you have?
>
> (start fuseki with argument "--version" to get the version of components.)
>
>
>
>  (running fuseki as
>> java -cp "${JARS}" org.apache.jena.fuseki.**FusekiCmd --update
>> --desc=pellet-ex.ttl /inf
>> , where content of pellet-ex.ttl is given below).
>>
>> If I try select pellet reasoner in modified config-inf-tdb.ttl (running
>> fuseki as
>> java -cp "${JARS}" org.apache.jena.fuseki.**FusekiCmd
>> --config=pellet.ttl /inf
>> , where pellet.ttl is given below), fuseki does not start with message:
>> com.hp.hpl.jena.assembler.**exceptions.**AmbiguousSpecificTypeException**:
>> cannot
>> find a most specific type for
>> file:///home/i/jena-fuseki-1.**0.0/pellet.ttl#myReasoner, which has as
>> possibilities: ja:ReasonerFactory ja:InfModel.
>>    doing:
>>      root: file:///home/i/jena-fuseki-1.**0.0/pellet.ttl#model_inf with
>> type:
>> http://jena.hpl.hp.com/2005/**11/Assembler#InfModel<http://jena.hpl.hp.com/2005/11/Assembler#InfModel>assembler class: class
>> com.hp.hpl.jena.assembler.**assemblers.InfModelAssembler
>>      root: file:///home/i/jena-fuseki-1.**0.0/pellet.ttl#dataset with
>> type:
>> http://jena.hpl.hp.com/2005/**11/Assembler#RDFDataset<http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset>assembler class: class
>> com.hp.hpl.jena.sparql.core.**assembler.DatasetAssembler
>>
>> What am I missing?
>>
>
> Something in the config is wrong at <#myReasoner_inf>  -- it coudl be that
> it is both a model and an inference engine.
>
>
Oh, sorry, I have repeatedly used
... ja:reasoner <#myReasoner> .
<#myReasoner> ja:reasoner ... .
which obviously raise this error.

Now fuseki starts, the only remaining problem is 500 error, same as above.


>          Andy
>
>
>
>> 2013/10/7 Alexei Golovko <al...@gmail.com>
>>
>>  Thank you, I will try Pellet. (Actually, this was already in my plans,
>>> but
>>> section of Pellet documentation about using with Jena is so short. Though
>>> there seems to exist configuration example in
>>> http://mail-archives.apache.**org/mod_mbox/jena-users/**
>>> 201106.mbox/%3CDDD95E03-9BB4-**423A-8FB6-A1DEE8E2EA97@gmx.**net%3E<http://mail-archives.apache.org/mod_mbox/jena-users/201106.mbox/%3CDDD95E03-9BB4-423A-8FB6-A1DEE8E2EA97@gmx.net%3E>
>>> .)
>>>
>>>
>>>  I use fuseki-1.0.0, pellet-2.3.1.
>>
>> echo ${JARS}
>> /home/i/jena-fuseki-1.0.0/**fuseki-server.jar:/home/i/**
>> pellet-2.3.1/lib/aterm-java-1.**6.jar:/home/i/pellet-2.3.1/**
>> lib/pellet-cli.jar:/home/i/**pellet-2.3.1/lib/pellet-core.**
>> jar:/home/i/pellet-2.3.1/lib/**pellet-datatypes.jar:/home/i/**
>> pellet-2.3.1/lib/pellet-el.**jar:/home/i/pellet-2.3.1/lib/**
>> pellet-explanation.jar:/home/**i/pellet-2.3.1/lib/pellet-**
>> jena.jar:/home/i/pellet-2.3.1/**lib/pellet-modularity.jar:/**
>> home/i/pellet-2.3.1/lib/**pellet-owlapiv3.jar:/home/i/**
>> pellet-2.3.1/lib/pellet-**pellint.jar:/home/i/pellet-2.**
>> 3.1/lib/pellet-query.jar:/**home/i/pellet-2.3.1/lib/**
>> pellet-rules.jar:/home/i/**pellet-2.3.1/lib/pellet-test.**jar
>>
>>
>> pellet-ex.ttl (used as --desc=pellet-ex.ttl):
>> @prefix rdf:     <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>
>> .
>> @prefix rdfs:    <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>
>> .
>> @prefix ja:      <http://jena.hpl.hp.com/2005/**11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>>
>> .
>> <#dataset> rdf:type ja:RDFDataset ;
>>      ja:defaultGraph <#inf_graph> ;
>> .
>> <#inf_graph> rdf:type ja:InfModel ;
>>      ja:reasoner [ja:reasonerClass
>>          "org.mindswap.pellet.jena.**PelletReasonerFactory" ;
>>      ] ;
>>      ja:baseModel <#baseGraph>
>> .
>>
>> <#baseGraph> a ja:MemoryModel ;
>>      ja:content [ja:externalContent
>> <file:///home/i/jena-fuseki-1.**0.0/Data/books.ttl>]
>> .
>>
>> pellet.ttl (used as config):
>> # Licensed under the terms of http://www.apache.org/**
>> licenses/LICENSE-2.0 <http://www.apache.org/licenses/LICENSE-2.0>
>>
>> @prefix :        <#> .
>> @prefix fuseki:  <http://jena.apache.org/**fuseki#<http://jena.apache.org/fuseki#>>
>> .
>> @prefix rdf:     <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>>
>> .
>> @prefix owl:     <http://www.w3.org/2002/07/**owl#<http://www.w3.org/2002/07/owl#>>
>> .
>> @prefix rdfs:   <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>>
>> .
>> @prefix tdb:     <http://jena.hpl.hp.com/2008/**tdb#<http://jena.hpl.hp.com/2008/tdb#>>
>> .
>> @prefix ja:      <http://jena.hpl.hp.com/2005/**11/Assembler#<http://jena.hpl.hp.com/2005/11/Assembler#>>
>> .
>>
>> [] rdf:type fuseki:Server ;
>>     ja:context [ ja:cxtName "arq:outputGraphBNodeLabels" ; ja:cxtValue
>> "true" ] ;
>>     fuseki:services (
>>       <#service1>
>>     ) .
>>
>> # Custom code.
>> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>>
>> # TDB
>> tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
>> tdb:GraphTDB    rdfs:subClassOf  ja:Model .
>>
>> ## ------------------------------**------------------------------**---
>> ## Service with only SPARQL query on an inference model.
>> ## Inference model bbase data in TDB.
>>
>> <#service1>  rdf:type fuseki:Service ;
>>      fuseki:name              "inf" ;             # http://host/inf
>>      fuseki:serviceQuery      "sparql" ;          # SPARQL query service
>>      fuseki:serviceUpdate     "update" ;
>>      fuseki:dataset           <#dataset> ;
>>      .
>>
>> <#dataset> rdf:type       ja:RDFDataset ;
>>      ja:defaultGraph       <#model_inf> ;
>>       .
>>
>> <#model_inf> a ja:InfModel ;
>>       ###ja:baseModel <#tdbGraph> ;
>>       #ja:baseModel <#memGraph> ; ##
>>       ja:reasoner <#myReasoner> . <#myReasoner> #[
>>           #ja:reasonerURL <http://jena.hpl.hp.com/2003/**
>> OWLFBRuleReasoner <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>>
>>           ja:reasoner [ja:reasonerClass
>> "org.mindswap.pellet.jena.**PelletReasonerFactory"];
>>           rdf:type ja:ReasonerFactory;
>>           #rdf:type [owl:complementOf ja:InfModel]
>>       . #] .
>>
>> ###<#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> .
>> ##
>> <#memGraph> a ja:MemoryModel .
>>
>>
>

Re: Datatype restrictions.

Posted by Andy Seaborne <an...@apache.org>.
On 10/10/13 07:25, Alexei Golovko wrote:
> Could not enable pellet reasoner.
>
> If I use approach from the quoted thread, I see:
>
>
> Error 500: tried to access field
> com.hp.hpl.jena.reasoner.BaseInfGraph.isPrepared from class
> org.mindswap.pellet.jena.PelletInfGraph
>

Is the version of Pellet you are using compatible with the version of 
Jena in the Fuseki you have?

(start fuseki with argument "--version" to get the version of components.)


> (running fuseki as
> java -cp "${JARS}" org.apache.jena.fuseki.FusekiCmd --update
> --desc=pellet-ex.ttl /inf
> , where content of pellet-ex.ttl is given below).
>
> If I try select pellet reasoner in modified config-inf-tdb.ttl (running
> fuseki as
> java -cp "${JARS}" org.apache.jena.fuseki.FusekiCmd --config=pellet.ttl /inf
> , where pellet.ttl is given below), fuseki does not start with message:
> com.hp.hpl.jena.assembler.exceptions.AmbiguousSpecificTypeException: cannot
> find a most specific type for
> file:///home/i/jena-fuseki-1.0.0/pellet.ttl#myReasoner, which has as
> possibilities: ja:ReasonerFactory ja:InfModel.
>    doing:
>      root: file:///home/i/jena-fuseki-1.0.0/pellet.ttl#model_inf with type:
> http://jena.hpl.hp.com/2005/11/Assembler#InfModel assembler class: class
> com.hp.hpl.jena.assembler.assemblers.InfModelAssembler
>      root: file:///home/i/jena-fuseki-1.0.0/pellet.ttl#dataset with type:
> http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset assembler class: class
> com.hp.hpl.jena.sparql.core.assembler.DatasetAssembler
>
> What am I missing?

Something in the config is wrong at <#myReasoner_inf>  -- it coudl be 
that it is both a model and an inference engine.

	Andy

>
> 2013/10/7 Alexei Golovko <al...@gmail.com>
>
>> Thank you, I will try Pellet. (Actually, this was already in my plans, but
>> section of Pellet documentation about using with Jena is so short. Though
>> there seems to exist configuration example in
>> http://mail-archives.apache.org/mod_mbox/jena-users/201106.mbox/%3CDDD95E03-9BB4-423A-8FB6-A1DEE8E2EA97@gmx.net%3E.)
>>
>>
> I use fuseki-1.0.0, pellet-2.3.1.
>
> echo ${JARS}
> /home/i/jena-fuseki-1.0.0/fuseki-server.jar:/home/i/pellet-2.3.1/lib/aterm-java-1.6.jar:/home/i/pellet-2.3.1/lib/pellet-cli.jar:/home/i/pellet-2.3.1/lib/pellet-core.jar:/home/i/pellet-2.3.1/lib/pellet-datatypes.jar:/home/i/pellet-2.3.1/lib/pellet-el.jar:/home/i/pellet-2.3.1/lib/pellet-explanation.jar:/home/i/pellet-2.3.1/lib/pellet-jena.jar:/home/i/pellet-2.3.1/lib/pellet-modularity.jar:/home/i/pellet-2.3.1/lib/pellet-owlapiv3.jar:/home/i/pellet-2.3.1/lib/pellet-pellint.jar:/home/i/pellet-2.3.1/lib/pellet-query.jar:/home/i/pellet-2.3.1/lib/pellet-rules.jar:/home/i/pellet-2.3.1/lib/pellet-test.jar
>
>
> pellet-ex.ttl (used as --desc=pellet-ex.ttl):
> @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#> .
> <#dataset> rdf:type ja:RDFDataset ;
>      ja:defaultGraph <#inf_graph> ;
> .
> <#inf_graph> rdf:type ja:InfModel ;
>      ja:reasoner [ja:reasonerClass
>          "org.mindswap.pellet.jena.PelletReasonerFactory" ;
>      ] ;
>      ja:baseModel <#baseGraph>
> .
>
> <#baseGraph> a ja:MemoryModel ;
>      ja:content [ja:externalContent
> <file:///home/i/jena-fuseki-1.0.0/Data/books.ttl>]
> .
>
> pellet.ttl (used as config):
> # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
>
> @prefix :        <#> .
> @prefix fuseki:  <http://jena.apache.org/fuseki#> .
> @prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix owl:     <http://www.w3.org/2002/07/owl#> .
> @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#> .
>
> [] rdf:type fuseki:Server ;
>     ja:context [ ja:cxtName "arq:outputGraphBNodeLabels" ; ja:cxtValue
> "true" ] ;
>     fuseki:services (
>       <#service1>
>     ) .
>
> # Custom code.
> [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
>
> # TDB
> tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
> tdb:GraphTDB    rdfs:subClassOf  ja:Model .
>
> ## ---------------------------------------------------------------
> ## Service with only SPARQL query on an inference model.
> ## Inference model bbase data in TDB.
>
> <#service1>  rdf:type fuseki:Service ;
>      fuseki:name              "inf" ;             # http://host/inf
>      fuseki:serviceQuery      "sparql" ;          # SPARQL query service
>      fuseki:serviceUpdate     "update" ;
>      fuseki:dataset           <#dataset> ;
>      .
>
> <#dataset> rdf:type       ja:RDFDataset ;
>      ja:defaultGraph       <#model_inf> ;
>       .
>
> <#model_inf> a ja:InfModel ;
>       ###ja:baseModel <#tdbGraph> ;
>       #ja:baseModel <#memGraph> ; ##
>       ja:reasoner <#myReasoner> . <#myReasoner> #[
>           #ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
>           ja:reasoner [ja:reasonerClass
> "org.mindswap.pellet.jena.PelletReasonerFactory"];
>           rdf:type ja:ReasonerFactory;
>           #rdf:type [owl:complementOf ja:InfModel]
>       . #] .
>
> ###<#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> .
> ##
> <#memGraph> a ja:MemoryModel .
>


Re: Datatype restrictions.

Posted by Alexei Golovko <al...@gmail.com>.
Could not enable pellet reasoner.

If I use approach from the quoted thread, I see:


Error 500: tried to access field
com.hp.hpl.jena.reasoner.BaseInfGraph.isPrepared from class
org.mindswap.pellet.jena.PelletInfGraph

(running fuseki as
java -cp "${JARS}" org.apache.jena.fuseki.FusekiCmd --update
--desc=pellet-ex.ttl /inf
, where content of pellet-ex.ttl is given below).

If I try select pellet reasoner in modified config-inf-tdb.ttl (running
fuseki as
java -cp "${JARS}" org.apache.jena.fuseki.FusekiCmd --config=pellet.ttl /inf
, where pellet.ttl is given below), fuseki does not start with message:
com.hp.hpl.jena.assembler.exceptions.AmbiguousSpecificTypeException: cannot
find a most specific type for
file:///home/i/jena-fuseki-1.0.0/pellet.ttl#myReasoner, which has as
possibilities: ja:ReasonerFactory ja:InfModel.
  doing:
    root: file:///home/i/jena-fuseki-1.0.0/pellet.ttl#model_inf with type:
http://jena.hpl.hp.com/2005/11/Assembler#InfModel assembler class: class
com.hp.hpl.jena.assembler.assemblers.InfModelAssembler
    root: file:///home/i/jena-fuseki-1.0.0/pellet.ttl#dataset with type:
http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset assembler class: class
com.hp.hpl.jena.sparql.core.assembler.DatasetAssembler

What am I missing?

2013/10/7 Alexei Golovko <al...@gmail.com>

> Thank you, I will try Pellet. (Actually, this was already in my plans, but
> section of Pellet documentation about using with Jena is so short. Though
> there seems to exist configuration example in
> http://mail-archives.apache.org/mod_mbox/jena-users/201106.mbox/%3CDDD95E03-9BB4-423A-8FB6-A1DEE8E2EA97@gmx.net%3E.)
>
>
I use fuseki-1.0.0, pellet-2.3.1.

echo ${JARS}
/home/i/jena-fuseki-1.0.0/fuseki-server.jar:/home/i/pellet-2.3.1/lib/aterm-java-1.6.jar:/home/i/pellet-2.3.1/lib/pellet-cli.jar:/home/i/pellet-2.3.1/lib/pellet-core.jar:/home/i/pellet-2.3.1/lib/pellet-datatypes.jar:/home/i/pellet-2.3.1/lib/pellet-el.jar:/home/i/pellet-2.3.1/lib/pellet-explanation.jar:/home/i/pellet-2.3.1/lib/pellet-jena.jar:/home/i/pellet-2.3.1/lib/pellet-modularity.jar:/home/i/pellet-2.3.1/lib/pellet-owlapiv3.jar:/home/i/pellet-2.3.1/lib/pellet-pellint.jar:/home/i/pellet-2.3.1/lib/pellet-query.jar:/home/i/pellet-2.3.1/lib/pellet-rules.jar:/home/i/pellet-2.3.1/lib/pellet-test.jar


pellet-ex.ttl (used as --desc=pellet-ex.ttl):
@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#> .
<#dataset> rdf:type ja:RDFDataset ;
    ja:defaultGraph <#inf_graph> ;
.
<#inf_graph> rdf:type ja:InfModel ;
    ja:reasoner [ja:reasonerClass
        "org.mindswap.pellet.jena.PelletReasonerFactory" ;
    ] ;
    ja:baseModel <#baseGraph>
.

<#baseGraph> a ja:MemoryModel ;
    ja:content [ja:externalContent
<file:///home/i/jena-fuseki-1.0.0/Data/books.ttl>]
.

pellet.ttl (used as config):
# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0

@prefix :        <#> .
@prefix fuseki:  <http://jena.apache.org/fuseki#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@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#> .

[] rdf:type fuseki:Server ;
   ja:context [ ja:cxtName "arq:outputGraphBNodeLabels" ; ja:cxtValue
"true" ] ;
   fuseki:services (
     <#service1>
   ) .

# Custom code.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .

# TDB
tdb:DatasetTDB  rdfs:subClassOf  ja:RDFDataset .
tdb:GraphTDB    rdfs:subClassOf  ja:Model .

## ---------------------------------------------------------------
## Service with only SPARQL query on an inference model.
## Inference model bbase data in TDB.

<#service1>  rdf:type fuseki:Service ;
    fuseki:name              "inf" ;             # http://host/inf
    fuseki:serviceQuery      "sparql" ;          # SPARQL query service
    fuseki:serviceUpdate     "update" ;
    fuseki:dataset           <#dataset> ;
    .

<#dataset> rdf:type       ja:RDFDataset ;
    ja:defaultGraph       <#model_inf> ;
     .

<#model_inf> a ja:InfModel ;
     ###ja:baseModel <#tdbGraph> ;
     #ja:baseModel <#memGraph> ; ##
     ja:reasoner <#myReasoner> . <#myReasoner> #[
         #ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>
         ja:reasoner [ja:reasonerClass
"org.mindswap.pellet.jena.PelletReasonerFactory"];
         rdf:type ja:ReasonerFactory;
         #rdf:type [owl:complementOf ja:InfModel]
     . #] .

###<#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> .
##
<#memGraph> a ja:MemoryModel .

Re: Datatype restrictions.

Posted by Alexei Golovko <al...@gmail.com>.
Thank you, I will try Pellet. (Actually, this was already in my plans, but
section of Pellet documentation about using with Jena is so short. Though
there seems to exist configuration example in
http://mail-archives.apache.org/mod_mbox/jena-users/201106.mbox/%3CDDD95E03-9BB4-423A-8FB6-A1DEE8E2EA97@gmx.net%3E.)


2013/10/5 Dave Reynolds <da...@gmail.com>

> Datatype facets are OWL 2 and Jena only supports OWL 1.
>
> It may be possible to use third party reasoners like Pellet to provide
> some OWL 2 capability.
>
> Dave
>
>
> On 01/10/13 13:57, Alexei Golovko wrote:
>
>> Can fuseki infer subclassing between faceted datatypes?
>>
>> E.g., if I run update
>>
>> PREFIX rdf:     <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>> >
>> PREFIX rdfs:   <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>
>> >
>> PREFIX owl: <http://www.w3.org/2002/07/**owl#<http://www.w3.org/2002/07/owl#>
>> >
>> PREFIX : <http://example.org/>
>> PREFIX xsd: <http://www.w3.org/2001/**XMLSchema#<http://www.w3.org/2001/XMLSchema#>
>> >
>>
>> INSERT {
>>
>>    :ev1 a [
>>      a rdfs:Datatype ;
>>      owl:onDatatype xsd:integer ;
>>      owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive
>> 2013])
>>    ];
>>    a :my .
>>
>> } WHERE {}
>>
>> ... than only first select finds :ev1, though I expect both should.
>>
>> The first select:
>>
>> prefix rdf:     <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>> >
>> prefix rdfs:   <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>
>> >
>> PREFIX owl: <http://www.w3.org/2002/07/**owl#<http://www.w3.org/2002/07/owl#>
>> >
>> PREFIX : <http://example.org/>
>> PREFIX xsd: <http://www.w3.org/2001/**XMLSchema#<http://www.w3.org/2001/XMLSchema#>
>> >
>>
>> SELECT DISTINCT ?s WHERE { ?s a :my .
>>    ?s a [
>>      a rdfs:Datatype ;
>>      owl:onDatatype xsd:integer ;
>>      owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive
>> 2013])
>>    ] .
>> }
>>
>> The second select:
>>
>> prefix rdf:     <http://www.w3.org/1999/02/22-**rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>> >
>> prefix rdfs:   <http://www.w3.org/2000/01/**rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>
>> >
>> PREFIX owl: <http://www.w3.org/2002/07/**owl#<http://www.w3.org/2002/07/owl#>
>> >
>> PREFIX : <http://example.org/>
>> PREFIX xsd: <http://www.w3.org/2001/**XMLSchema#<http://www.w3.org/2001/XMLSchema#>
>> >
>>
>> SELECT DISTINCT ?s WHERE { ?s a :my .
>>    ?s a [
>>      a rdfs:Datatype ;
>>      owl:onDatatype xsd:integer ;
>>      owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive
>> 2014])
>>    ] .
>> }
>>
>> I am running jena-fuseki-1.0.0 with config config-inf-tdb.ttl.
>>
>>
>

Re: Datatype restrictions.

Posted by Dave Reynolds <da...@gmail.com>.
Datatype facets are OWL 2 and Jena only supports OWL 1.

It may be possible to use third party reasoners like Pellet to provide 
some OWL 2 capability.

Dave

On 01/10/13 13:57, Alexei Golovko wrote:
> Can fuseki infer subclassing between faceted datatypes?
>
> E.g., if I run update
>
> PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
> PREFIX : <http://example.org/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>
> INSERT {
>
>    :ev1 a [
>      a rdfs:Datatype ;
>      owl:onDatatype xsd:integer ;
>      owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive 2013])
>    ];
>    a :my .
>
> } WHERE {}
>
> ... than only first select finds :ev1, though I expect both should.
>
> The first select:
>
> prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
> PREFIX : <http://example.org/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>
> SELECT DISTINCT ?s WHERE { ?s a :my .
>    ?s a [
>      a rdfs:Datatype ;
>      owl:onDatatype xsd:integer ;
>      owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive 2013])
>    ] .
> }
>
> The second select:
>
> prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#>
> PREFIX owl: <http://www.w3.org/2002/07/owl#>
> PREFIX : <http://example.org/>
> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>
> SELECT DISTINCT ?s WHERE { ?s a :my .
>    ?s a [
>      a rdfs:Datatype ;
>      owl:onDatatype xsd:integer ;
>      owl:withRestrictions ([xsd:minInclusive 2011] [xsd:maxInclusive 2014])
>    ] .
> }
>
> I am running jena-fuseki-1.0.0 with config config-inf-tdb.ttl.
>