persistent inference on named graphs in Fuseki

2017-03-30 Thread Élie Roux

Hello,

I am currently setting up a Fuseki server with the following specs in mind:
 - everything persistent in TDB (it works)
 - many different named graph, with the default graph being the union of
them (it works, but without inference)
 - very simple inferencing (works but not with named graphs)
 - inferenced triples stored in TDB

 The first question is the following: is it realistic?

 See attached for my current configuration file. This configuration
doesn't work:
 - /testrw works fine and has no inferencing (which is normal)
 - /testro does not work: I cannot access any triple, even asking them
in their named graph

 Is this kind of configuration supposed to work? If yes, how can we
modify our file to make it work?

 Final question: it is possible to define a prefixMapping in the fuseki
assembler configuration, but I was not able to find any use for it. Does
it do anything from the user or programmer point of view? Does it
improve/degrade the performances?

 Thank you,
--
Elie Roux
@prefix fuseki:   .
@prefix rdf:  .
@prefix rdfs: .
@prefix tdb:  .
@prefix ja:   .
@prefix : .

[] rdf:type fuseki:Server ;
   fuseki:services (
 :testrw
 :testro
   ) .

:testrw rdf:type fuseki:Service ;
fuseki:name   "testrw" ; # name of the dataset in the url
fuseki:serviceQuery   "query" ;# SPARQL query service
fuseki:serviceUpload  "upload" ;   # Non-SPARQL upload service
fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
fuseki:dataset:tdbDataset_test ;
.

:testro rdf:type fuseki:Service ;
fuseki:name "testro" ;
fuseki:serviceQuery "query" ;
fuseki:serviceReadGraphStore"data" ;
fuseki:dataset  :dataset_test ;
.

:dataset_test rdf:type   ja:RDFDataset ;
ja:defaultGraph  :model_inf_test ;
tdb:unionDefaultGraph true ;
.

:model_inf_test a ja:OntModel ;
 ja:baseModel :tdbGraph_test ;
 tdb:unionDefaultGraph true ;
 ja:reasoner [
# This url looks outdated, but it works...
ja:reasonerURL 
 ] .

:tdbGraph_test rdf:type tdb:GraphTDB ;
tdb:dataset :tdbDataset_test ;
tdb:unionDefaultGraph true ;
.

:tdbDataset_test rdf:type tdb:DatasetTDB ;
tdb:location "/etc/fuseki/databases/test" ;
# If the unionDefaultGraph is used, then the "update" service should be removed.
tdb:unionDefaultGraph true ;
.


Re: Jena Rules

2017-03-30 Thread Lorenz B.
If you have the URI of inst2, just write it, e.g.

-> (  'Some Text'), 
( rdf:type )



> Thank you Lorenz Bühmann for answering my email.
> But what do you mean by using the URI I have in mind?
>
> I want to create an instance to a class already in the ontology. For example, 
> If I have these triples in my data:
> inst1 type class1
> inst1 hasPrice price
> inst1 hasValue value
> class2 type Class
> I would like the rule to be something like:
> if (price>value) then create inst2 of type class2 and add text value to inst2
> Thanks
> Abdul
>
>
>
>
>   From: Lorenz B. 
>  To: users@jena.apache.org 
>  Sent: Thursday, March 30, 2017 7:43 AM
>  Subject: Re: Jena Rules
>
>
>> Hello,I am trying to excute this rule in Jena:
>>
>> [r1:  (?c http://somewhere#rel1 ?price) 
>> (?c http://somewhere#rel2 ?value)  lessThan(?price, ?value) ->   
>>(?y http://somewhere#AnyRelation 'Some Text')]
>> I have two questions:1- I would like ?y to be a specific instance of a 
>> specific class and created during the excution of the rule. How to create 
>> that instance in the rule? if it can be, is there a way that instance to be 
>> not blank node?
>> I found this in the Jena documentations: 
>>
>> makeInstance(?x, ?p, ?v)makeInstance(?x, ?p, ?t, ?v)
>> but I do not know how to use it because ?v is the blank node so what is ?x?
> That built-in only creates blank nodes used as a value for a known
> resource ?x and property ?p. If you want to create an instance, why
> don't you use the URI you have in mind?
>> 2- How to add prefixes in rules?
> You can add this to the file containing the rules:
>
> @prefix pre: .
>
> >From the Jena documentation [1]: "Defines a prefix pre which can be used
> in the rules. The prefix is local to the rule file."
>
>
> [1] https://jena.apache.org/documentation/inference/#rules
>> ThanksAbdul
>>
>>
>>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center



Re: Jena Rules

2017-03-30 Thread Abduladem Eljamel
Thank you Lorenz Bühmann for answering my email.
But what do you mean by using the URI I have in mind?

I want to create an instance to a class already in the ontology. For example, 
If I have these triples in my data:
inst1 type class1
inst1 hasPrice price
inst1 hasValue value
class2 type Class
I would like the rule to be something like:
if (price>value) then create inst2 of type class2 and add text value to inst2
Thanks
Abdul




  From: Lorenz B. 
 To: users@jena.apache.org 
 Sent: Thursday, March 30, 2017 7:43 AM
 Subject: Re: Jena Rules
   

> Hello,I am trying to excute this rule in Jena:
>
> [r1:  (?c http://somewhere#rel1 ?price) 
>        (?c http://somewhere#rel2 ?value)      lessThan(?price, ?value) ->     
> (?y http://somewhere#AnyRelation 'Some Text')]
> I have two questions:1- I would like ?y to be a specific instance of a 
> specific class and created during the excution of the rule. How to create 
> that instance in the rule? if it can be, is there a way that instance to be 
> not blank node?
> I found this in the Jena documentations: 
>
> makeInstance(?x, ?p, ?v)makeInstance(?x, ?p, ?t, ?v)
> but I do not know how to use it because ?v is the blank node so what is ?x?
That built-in only creates blank nodes used as a value for a known
resource ?x and property ?p. If you want to create an instance, why
don't you use the URI you have in mind?
>
> 2- How to add prefixes in rules?
You can add this to the file containing the rules:

@prefix pre: .

>From the Jena documentation [1]: "Defines a prefix pre which can be used
in the rules. The prefix is local to the rule file."


[1] https://jena.apache.org/documentation/inference/#rules
> ThanksAbdul
>
>
>
-- 
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center



   

Re: Ontology Imports

2017-03-30 Thread Dave Reynolds

On 29/03/17 20:54, Donald Smith wrote:


Given I have an ontology that imports one or more other ontologies, when I read 
that ontology:

model.read("http://example.com/ExampleOntology.owl;, "TURTLE");


That should be "Turtle" or, better, RDFLanguages.strLangTurtle or better 
still use RDFDataMgr and let it work out the language.


Dave