RE: RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-07 Thread Pierre Grenon
As indicated by Andy, not with that library but just using requests work -- see 
follow up email

Best, 
P

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


> -Original Message-
> From: Laura Morales [mailto:laure...@mail.com]
> Sent: 07 August 2019 12:19
> To: users@jena.apache.org
> Cc: users@jena.apache.org
> Subject: Re: RE: Sensible size limit for SPARQL update payload to Fuseki2?
> 
> > from SPARQLWrapper import SPARQLWrapper
> >
> > # a lot longer
> > myString = "INSERT DATA {}"
> >
> > def insertFromString(url, sparql):
> > endpoint = SPARQLWrapper(url)
> > endpoint.setQuery(sparql)
> > endpoint.method = 'POST'
> > endpoint.query()
> >
> > insertFromString('http://localhost:3030/myDS/update', myString)
> 
> 
> can you change the html headers and see if it works? Something like this:
> 
> endpoint.addCustomHttpHeader("Content-Type", "application/sparql-
> update")


RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-07 Thread Pierre Grenon
Following Andy's suggestion works perfectly indeed --- many thanks again!

Best, 
Pierre

import requests

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


def insertFromString(url, sparql):
req_ = requests.post(url, headers = 
{"Content-Type":"application/sparql-update"}, data = sparql)
resp_ = req_.content 
return(resp_)

insertFromString('http://localhost:3030/myDS/update', myString)

Then 

queryFn(qls2, "select (Count(?x) as ?noot) where {?x  ?y ?z}")

  noot.value
0 899401

> -Original Message-
> From: Pierre Grenon
> Sent: 07 August 2019 12:10
> To: 'users@jena.apache.org'
> Subject: RE: Sensible size limit for SPARQL update payload to Fuseki2?
> 
> 
> FYC I basically do this
> 
> from SPARQLWrapper import SPARQLWrapper
> 
> # a lot longer
> myString = "INSERT DATA {}"
> 
> def insertFromString(url, sparql):
> endpoint = SPARQLWrapper(url)
> endpoint.setQuery(sparql)
> endpoint.method = 'POST'
> endpoint.query()
> 
> insertFromString('http://localhost:3030/myDS/update', myString)
> 
> 
> From: Laura Morales [mailto:laure...@mail.com]
> Sent: 07 August 2019 10:29
> To: users@jena.apache.org
> Cc: users@jena.apache.org
> Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?
> 
> Basically, this request should work?
> 
> POST /database HTTP/1.1
> Host: example.com
> Content-Type: application/sparql-update
> 
> INSERT DATA { < 100 MB of triples > }
> 
> 
> 
> 
> > Sent: Wednesday, August 07, 2019 at 10:44 AM
> > From: "Andy Seaborne" 
> > To: users@jena.apache.org
> > Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?
> >
> > Pierre,
> >
> > RDFLib/SPARQLWrapper is using an HTML form upload.
> >
> > The scalable way is to POST with "Content-type:
> > application/sparql-update" and the INSERT in the body, then it will
> > stream - directly reading the update from the HTTP input stream with no
> > HTML Form (Request.extractFormParameters) on the execution path.
> >
> > Fro an HTML form, the entire requests ends up in memory - its the way
> > that HTML forms have to handled to see all the name=value pairs in the
> > form. Incidentally, the same is true in the client.
> >
> > The default form size is already bumped up to 10M from the Jetty default
> > of 200K.
> >
> > If the server is running in verbose mode, the entire SPARQL update is
> > read in for logging/debugging purposes.
> >
> > The default jetty configuration is in code. For the form size, that is
> > JettyFusekiWebapp.createWebApp which is 10M - we can make that
> default
> > bigger but not 101M which is the request.
> >
> > Otherwise, break the request into parts and send multiple requests.
> >
> > Andy
> >
> > On 07/08/2019 08:49, Pierre Grenon wrote:
> > > Thank you, Lorenz.
> > >
> > > I did as you suggest and made the changes indicated.
> > >
> > > Fuseki started and seems to have accepted the jetty config. But then
> when trying to send the update the same error occurs and the limit seems
> unmodified (I used 2).
> > >
> > > Caused by: java.lang.IllegalStateException: Form too large: 100948991 >
> 1000
> > > at
> org.eclipse.jetty.server.Request.extractFormParameters(Request.java:545)
> > > at
> org.eclipse.jetty.server.Request.extractContentParameters(Request.java:475)
> > > at org.eclipse.jetty.server.Request.getParameters(Request.java:386)
> > > ... 50 more
> > >
> > > Can it be that the config does not override some default set elsewhere in
> Fuseki?
> > >
> > > I’ll try to figure if I’m not doing something else wrong…
> > >
> > > Many thanks,
> > > Pierre
> > >
> > > For reference:
> > > https://www.eclipse.org/jetty/documentation/current/configuring-form-
> size.html
> >


RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-07 Thread Pierre Grenon
FYC I basically do this 

from SPARQLWrapper import SPARQLWrapper

# a lot longer
myString = "INSERT DATA {}"

def insertFromString(url, sparql): 
endpoint = SPARQLWrapper(url)
endpoint.setQuery(sparql)
endpoint.method = 'POST'
endpoint.query()

insertFromString('http://localhost:3030/myDS/update', myString)

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.



From: Laura Morales [mailto:laure...@mail.com] 
Sent: 07 August 2019 10:29
To: users@jena.apache.org
Cc: users@jena.apache.org
Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?

Basically, this request should work?

POST /database HTTP/1.1
Host: example.com
Content-Type: application/sparql-update

INSERT DATA { < 100 MB of triples > }




> Sent: Wednesday, August 07, 2019 at 10:44 AM
> From: "Andy Seaborne" 
> To: users@jena.apache.org
> Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?
>
> Pierre,
> 
> RDFLib/SPARQLWrapper is using an HTML form upload.
> 
> The scalable way is to POST with "Content-type: 
> application/sparql-update" and the INSERT in the body, then it will 
> stream - directly reading the update from the HTTP input stream with no 
> HTML Form (Request.extractFormParameters) on the execution path.
> 
> Fro an HTML form, the entire requests ends up in memory - its the way 
> that HTML forms have to handled to see all the name=value pairs in the 
> form. Incidentally, the same is true in the client.
> 
> The default form size is already bumped up to 10M from the Jetty default 
> of 200K.
> 
> If the server is running in verbose mode, the entire SPARQL update is 
> read in for logging/debugging purposes.
> 
> The default jetty configuration is in code. For the form size, that is 
> JettyFusekiWebapp.createWebApp which is 10M - we can make that default 
> bigger but not 101M which is the request.
> 
> Otherwise, break the request into parts and send multiple requests.
> 
> Andy
> 
> On 07/08/2019 08:49, Pierre Grenon wrote:
> > Thank you, Lorenz.
> > 
> > I did as you suggest and made the changes indicated.
> > 
> > Fuseki started and seems to have accepted the jetty config. But then when 
> > trying to send the update the same error occurs and the limit seems 
> > unmodified (I used 2).
> > 
> > Caused by: java.lang.IllegalStateException: Form too large: 100948991 > 
> > 1000
> > at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:545)
> > at 
> > org.eclipse.jetty.server.Request.extractContentParameters(Request.java:475)
> > at org.eclipse.jetty.server.Request.getParameters(Request.java:386)
> > ... 50 more
> > 
> > Can it be that the config does not override some default set elsewhere in 
> > Fuseki?
> > 
> > I’ll try to figure if I’m not doing something else wrong…
> > 
> > Many thanks,
> > Pierre
> > 
> > For reference:
> > https://www.eclipse.org/jetty/documentation/current/configuring-form-size.html
>


RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-07 Thread Pierre Grenon
Thanks, Andy. 

I'll drop the jetty config attempt. (I surmise that the concern with bumping 
very high the form size would cause 'performance' issues.) I can somewhat toy 
with the jetty locally for testing but in any event it becomes tedious when 
working with remote servers deployed in varied ways. So, I'll keep the strategy 
client side. 

With many thanks, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Andy Seaborne [mailto:a...@apache.org] 
Sent: 07 August 2019 09:45
To: users@jena.apache.org
Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?

Pierre,

RDFLib/SPARQLWrapper is using an HTML form upload.

The scalable way is to POST with "Content-type: 
application/sparql-update" and the INSERT in the body, then it will 
stream - directly reading the update from the HTTP input stream with no 
HTML Form (Request.extractFormParameters) on the execution path.

Fro an HTML form, the entire requests ends up in memory - its the way 
that HTML forms have to handled to see all the name=value pairs in the 
form. Incidentally, the same is true in the client.

The default form size is already bumped up to 10M from the Jetty default 
of 200K.

If the server is running in verbose mode, the entire SPARQL update is 
read in for logging/debugging purposes.

The default jetty configuration is in code. For the form size, that is 
JettyFusekiWebapp.createWebApp which is 10M - we can make that default 
bigger but not 101M which is the request.

Otherwise, break the request into parts and send multiple requests.

Andy

On 07/08/2019 08:49, Pierre Grenon wrote:
> Thank you, Lorenz.
> 
> I did as you suggest and made the changes indicated.
> 
> Fuseki started and seems to have accepted the jetty config. But then when 
> trying to send the update the same error occurs and the limit seems 
> unmodified (I used 2).
> 
> Caused by: java.lang.IllegalStateException: Form too large: 100948991 > 
> 1000
> at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:545)
> at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:475)
> at org.eclipse.jetty.server.Request.getParameters(Request.java:386)
> ... 50 more
> 
> Can it be that the config does not override some default set elsewhere in 
> Fuseki?
> 
> I’ll try to figure if I’m not doing something else wrong…
> 
> Many thanks,
> Pierre
> 
> For reference:
> https://www.eclipse.org/jetty/documentation/current/configuring-form-size.html


RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-07 Thread Pierre Grenon
Thank you, Lorenz.

I did as you suggest and made the changes indicated.

Fuseki started and seems to have accepted the jetty config. But then when 
trying to send the update the same error occurs and the limit seems unmodified 
(I used2).

Caused by: java.lang.IllegalStateException: Form too large: 100948991 > 1000
at 
org.eclipse.jetty.server.Request.extractFormParameters(Request.java:545)
at 
org.eclipse.jetty.server.Request.extractContentParameters(Request.java:475)
at org.eclipse.jetty.server.Request.getParameters(Request.java:386)
... 50 more

Can it be that the config does not override some default set elsewhere in 
Fuseki?

I’ll try to figure if I’m not doing something else wrong…

Many thanks,
Pierre

For reference:
https://www.eclipse.org/jetty/documentation/current/configuring-form-size.html



From: Lorenz Buehmann [mailto:buehm...@informatik.uni-leipzig.de]
Sent: 07 August 2019 08:08
To: users@jena.apache.org
Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?



> 
>  "http://www.eclipse.org/jetty/configure_9_3.dtd">
>
> 
> 
> org.eclipse.jetty.server.Request.maxFormContentSize
> 
> 
>
> [2019-08-06 17:07:48] Server ERROR SPARQLServer: Failed to configure server: 0
> java.lang.ArrayIndexOutOfBoundsException: 0
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.configServer(JettyFusekiWebapp.java:297)
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.buildServerWebapp(JettyFusekiWebapp.java:243)
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.(http://JettyFusekiWebapp.java:99)
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.initializeServer(JettyFusekiWebapp.java:94)
> at org.apache.jena.fuseki.cmd.FusekiCmd.runFuseki(FusekiCmd.java:371)
> at 
> org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:356)
> at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
> at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
> at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
> at 
> org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:104)
> at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:67)
>
> So I suppose I need a complete jetty config file rather than a snippet 
> (unless the above is erroneous anyway). I wasn't able to find the default 
> jetty configuration file in the jars.
>
> I found this 
> https://github.com/apache/jena/blob/master/jena-fuseki2/examples/fuseki-jetty-https.xml
> But it mentions needing configuring further things and I have no clue how to 
> adapt it.

if you don't need HTTPS resp. SSL, you can just remove everything that
configures the SSL stuff:
https://github.com/apache/jena/blob/master/jena-fuseki2/examples/fuseki-jetty-https.xml#L179-L285


And then add


org.eclipse.jetty.server.Request.maxFormContentSize
200
  

with whatever size you need.

And don't forget to change the port, in the file it's configured with
8082 compared to default 3030.

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.




RE: RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-07 Thread Pierre Grenon
Thank you, Laura, that’s a good point too.

Meanwhile, I guess the answer to the original question, judging from the error 
indicating the default jetty form size in fuseki is that the limit is 10Mb.

I’ll chunk away or maybe work around with the LOAD requirements, although I 
might open a new thread specifically on jetty if I get very frustrated.

With many thanks and best regards,
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Laura Morales [mailto:laure...@mail.com]
Sent: 06 August 2019 18:29
To: users@jena.apache.org
Cc: 'users@jena.apache.org'
Subject: Re: RE: Sensible size limit for SPARQL update payload to Fuseki2?

I don't know myself how to configure jetty, even less with Fuseki. I hope for 
you somebody else on the list does.
Regarding LOAD however, you should be able to use HTTP URIs.


> Sent: Tuesday, August 06, 2019 at 7:01 PM
> From: "Pierre Grenon" 
> To: "'users@jena.apache.org'" 
> Subject: RE: Sensible size limit for SPARQL update payload to Fuseki2?
>
> Ok, so apologies for kinda spamming the list with this.
>
> 1. Laura, I agree with the options you listed below. Although:
> - LOAD, in my experience, requires access to the file system where fuseki is 
> running and I do not have that
> - SOH has that same requirement and also requires me to ssh into the machine, 
> which I don't want to have to do programmatically
> - chunking is my likely work around although it is suboptimal (I serialize an 
> RDFLib in memory graph)
>
> 2. After looking around and doing a bit of archaeology,
>
> https://jena.markmail.org/message/nmtny6wlnvzltws7?q=maxFormContentSize<https://jena.markmail.org/message/nmtny6wlnvzltws7?q=maxFormContentSize>
> (At first seeing this I thought it used to be called 'Fuseky'! I can only 
> recall Joseki)
>
> it seems that the principled approach is to run fuseki with a customised 
> jetty configuration.
>
> http://jena.apache.org/documentation/fuseki2/data-access-control#jetty-configuration<http://jena.apache.org/documentation/fuseki2/data-access-control#jetty-configuration>
> " Server command line: --jetty=jetty.xml."
> -> is wrong
>
> This:
> > fuseki-server --jetty-config=jetty.xml
> Worked for me.
>
> However, I do not know what to put in jetty.xml
>
> https://www.eclipse.org/jetty/documentation/current/setting-form-size.html<https://www.eclipse.org/jetty/documentation/current/setting-form-size.html>
>
> I tried the following snippet but it broke
>
> 
>  "http://www.eclipse.org/jetty/configure_9_3.dtd<http://www.eclipse.org/jetty/configure_9_3.dtd>">
>
> 
> 
> org.eclipse.jetty.server.Request.maxFormContentSize
> 
> 
>
> [2019-08-06 17:07:48] Server ERROR SPARQLServer: Failed to configure server: 0
> java.lang.ArrayIndexOutOfBoundsException: 0
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.configServer(JettyFusekiWebapp.java:297)
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.buildServerWebapp(JettyFusekiWebapp.java:243)
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.(http://JettyFusekiWebapp.java:99<http://JettyFusekiWebapp.java:99>)
> at 
> org.apache.jena.fuseki.cmd.JettyFusekiWebapp.initializeServer(JettyFusekiWebapp.java:94)
> at org.apache.jena.fuseki.cmd.FusekiCmd.runFuseki(FusekiCmd.java:371)
> at 
> org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:356)
> at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
> at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
> at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
> at 
> org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:104)
> at org.apache.jena.f

RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-06 Thread Pierre Grenon
Ok, so apologies for kinda spamming the list with this. 

1. Laura, I agree with the options you listed below. Although: 
- LOAD, in my experience, requires access to the file system where fuseki is 
running and I do not have that 
- SOH has that same requirement and also requires me to ssh into the machine, 
which I don't want to have to do programmatically 
- chunking is my likely work around although it is suboptimal (I serialize an 
RDFLib in memory graph) 

2. After looking around and doing a bit of archaeology, 

https://jena.markmail.org/message/nmtny6wlnvzltws7?q=maxFormContentSize
(At first seeing this I thought it used to be called 'Fuseky'! I can only 
recall Joseki)

it seems that the principled approach is to run fuseki with a customised jetty 
configuration.

http://jena.apache.org/documentation/fuseki2/data-access-control#jetty-configuration
" Server command line: --jetty=jetty.xml."
-> is wrong

This:
> fuseki-server --jetty-config=jetty.xml
Worked for me. 

However, I do not know what to put in jetty.xml 

https://www.eclipse.org/jetty/documentation/current/setting-form-size.html

I tried the following snippet but it broke


http://www.eclipse.org/jetty/configure_9_3.dtd;>


  
org.eclipse.jetty.server.Request.maxFormContentSize

  

[2019-08-06 17:07:48] Server ERROR SPARQLServer: Failed to configure 
server: 0
java.lang.ArrayIndexOutOfBoundsException: 0
at 
org.apache.jena.fuseki.cmd.JettyFusekiWebapp.configServer(JettyFusekiWebapp.java:297)
at 
org.apache.jena.fuseki.cmd.JettyFusekiWebapp.buildServerWebapp(JettyFusekiWebapp.java:243)
at 
org.apache.jena.fuseki.cmd.JettyFusekiWebapp.(JettyFusekiWebapp.java:99)
at 
org.apache.jena.fuseki.cmd.JettyFusekiWebapp.initializeServer(JettyFusekiWebapp.java:94)
at org.apache.jena.fuseki.cmd.FusekiCmd.runFuseki(FusekiCmd.java:371)
at 
org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:356)
at jena.cmd.CmdMain.mainMethod(CmdMain.java:93)
at jena.cmd.CmdMain.mainRun(CmdMain.java:58)
at jena.cmd.CmdMain.mainRun(CmdMain.java:45)
at 
org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:104)
at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:67)

So I suppose I need a complete jetty config file rather than a snippet (unless 
the above is erroneous anyway). I wasn't able to find the default jetty 
configuration file in the jars. 

I found this 
https://github.com/apache/jena/blob/master/jena-fuseki2/examples/fuseki-jetty-https.xml
But it mentions needing configuring further things and I have no clue how to 
adapt it. 

Any pointer, walkthrough or further help most appreciated. 

With many thanks and kind regards, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Laura Morales [mailto:laure...@mail.com] 
Sent: 06 August 2019 12:25
To: users@jena.apache.org
Cc: 'users@jena.apache.org'
Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?

Your best option is to look at the Fuseki logs for the exact error. I've 
personally never POSTed so much data to Fuseki, but I feel like it should not 
be be a problem unless something is timing out the connection, or truncating 
the POST data, or your triples contain syntax errors. Another option is to try 
the LOAD operation (https://www.w3.org/TR/sparql11-update/#load), or the SOH 
command line tools (https://jena.apache.org/documentation/fuseki2/soh.html). 
What I would do, personally speaking, is find a way to chunk your data and send 
multiple requests (even if, as I said, 85MB should work. It's not a huge file 
after all).


> Sent: Tuesday, August 06, 2019 at 12:39 PM
> From: "Pierre Grenon" 
> To: "'users@jena.apache.org'" 
> Subject: RE: RE: Sensib

RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-06 Thread Pierre Grenon
ask(EatWhatYouKill.java:333)
at 
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at 
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at 
org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at 
org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Form too large: 100948991 > 1000
at 
org.eclipse.jetty.server.Request.extractFormParameters(Request.java:545)
at 
org.eclipse.jetty.server.Request.extractContentParameters(Request.java:475)
at org.eclipse.jetty.server.Request.getParameters(Request.java:386)
... 55 more
[2019-08-06 13:33:15] Fuseki INFO  [40796] 500 400: Unable to parse form 
content (1 ms)

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Laura Morales [mailto:laure...@mail.com] 
Sent: 06 August 2019 08:19
To: users@jena.apache.org
Cc: users@jena.apache.org
Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?

How long is your query?? Personally I'm not aware of any such limitations, 
especially when POSTing, but other people here definitely know better than me 
if there is one or not. If there is a limit, let's say even just 1MB, you need 
a *very* long query to break it. 500 is a general "internal error" code, it's 
not specific to query length. It could be something else (look at the logs). 
Did you try to run the query from the Fuseki web interface, or even with 
another database entirely? It could help you debug it.



> Sent: Tuesday, August 06, 2019 at 8:15 AM
> From: "Pierre Grenon" 
> To: "users@jena.apache.org" 
> Subject: Sensible size limit for SPARQL update payload to Fuseki2?
>
> Hi,
>
> Maybe a long shot but thought I'd ask.
>
> I'm sending updates to a Fuseki2 from an RDFLib/SPARQLWrapper based client. 
> This POSTs an INSERT string to an update endpoint. I get back an error 500 
> for strings over a certain large size which (the limit) I haven't tried to 
> figure out.
>
> Is there a theoretical, or other, reason why the limit exists and a strategy 
> to adopt besides fine tuning the string size?
>
> Many thanks and best regards,
> Pierre
>
> THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION.
> IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL
> IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS
> E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE
> MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN.
>
> IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES
> MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS
> "THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT
> MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE
> FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION
> (AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014).
> (https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
> COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION
> AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION
> ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS,
> PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/.
>
> HORIZON ASSET LLP IS AUTHORISED AND REGULATED
> BY THE FINANCIAL CONDUCT AUTHORITY.
>
>
>


RE: RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-06 Thread Pierre Grenon
> Can you share your query? 

Afraid I can't 

It looks like :



INSERT DATA {

<9000K triples>

}

> I don't understand if you're trying to insert a single literal string that is 
> 85MB in size, or if you're trying to load 900K triples that are 85MB in total.

Second one. I'm not trying to load a single triple with a 85Mb object literal 
but I am trying to perform a single INSERT operation of 900k triples.

Many thanks, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.



From: Laura Morales [mailto:laure...@mail.com] 
Sent: 06 August 2019 09:12
To: users@jena.apache.org
Cc: users@jena.apache.org
Subject: Re: RE: Sensible size limit for SPARQL update payload to Fuseki2?

Can you share your query? I don't understand if you're trying to insert a 
single literal string that is 85MB in size, or if you're trying to load 900K 
triples that are 85MB in total.



> Sent: Tuesday, August 06, 2019 at 9:52 AM
> From: "Pierre Grenon" 
> To: "users@jena.apache.org" 
> Subject: RE: Sensible size limit for SPARQL update payload to Fuseki2?
>
> Quick follow up --
>
> The web fuseki interface is happy loading the turtle equivalent. Takes more 
> time (~10-15 sec) than it takes for the programmatic way to return an error 
> (<2 sec), it's about 900k triples.
>
> So I was thinking of splitting my INSERT and was wondering if there is a 
> reasonable chunk size.
>
> As said, will try to look at the logs anyway.
>
> Best,
> Pierre
>
> THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION.
> IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL
> IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS
> E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE
> MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN.
>
> IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES
> MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS
> "THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT
> MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE
> FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION
> (AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014).
> (https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
> COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION
> AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION
> ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS,
> PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/.
>
> HORIZON ASSET LLP IS AUTHORISED AND REGULATED
> BY THE FINANCIAL CONDUCT AUTHORITY.
>
>
> > -Original Message-
> > From: Pierre Grenon
> > Sent: 06 August 2019 08:47
> > To: 'users@jena.apache.org'
> > Subject: RE: Sensible size limit for SPARQL update payload to Fuseki2?
> >
> > Hi,
> >
> > Thanks for your answer.
> >
> > I'll look into the server's logs if I can. I am using this approach because 
> > the
> > server is in fact remote. So I read into a string that I then pass to POST. 
> > The
> > query when saved to file is ~ 85Mb.
> >
> > I guess I was lazy and hoping for an easy answer if this clogged up Fuseki 
> > in
> > known ways and whether that might be addressed through config (memory,
> > thread, whatnots).
> >
> > Will double check a few things and report then.
> >
> > With many thanks and best regards,
> > Pierre
> >
> >
> > From: Laura Morales [mailto:laure...@mail.com]
> > Sent: 06 August 201

RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-06 Thread Pierre Grenon
Quick follow up -- 

The web fuseki interface is happy loading the turtle equivalent. Takes more 
time (~10-15 sec) than it takes for the programmatic way to return an error (<2 
sec), it's about 900k triples. 

So I was thinking of splitting my INSERT and was wondering if there is a 
reasonable chunk size. 

As said, will try to look at the logs anyway. 

Best, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


> -Original Message-
> From: Pierre Grenon
> Sent: 06 August 2019 08:47
> To: 'users@jena.apache.org'
> Subject: RE: Sensible size limit for SPARQL update payload to Fuseki2?
> 
> Hi,
> 
> Thanks for your answer.
> 
> I'll look into the server's logs if I can. I am using this approach because 
> the
> server is in fact remote. So I read into a string that I then pass to POST. 
> The
> query when saved to file is ~ 85Mb.
> 
> I guess I was lazy and hoping for an easy answer if this clogged up Fuseki in
> known ways and whether that might be addressed through config (memory,
> thread, whatnots).
> 
> Will double check a few things and report then.
> 
> With many thanks and best regards,
> Pierre
> 
> 
> From: Laura Morales [mailto:laure...@mail.com]
> Sent: 06 August 2019 08:19
> To: users@jena.apache.org
> Cc: users@jena.apache.org
> Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?
> 
> How long is your query?? Personally I'm not aware of any such limitations,
> especially when POSTing, but other people here definitely know better than
> me if there is one or not. If there is a limit, let's say even just 1MB, you 
> need
> a *very* long query to break it. 500 is a general "internal error" code, it's 
> not
> specific to query length. It could be something else (look at the logs). Did 
> you
> try to run the query from the Fuseki web interface, or even with another
> database entirely? It could help you debug it.
> 
> 
> 
> > Sent: Tuesday, August 06, 2019 at 8:15 AM
> > From: "Pierre Grenon" 
> > To: "users@jena.apache.org" 
> > Subject: Sensible size limit for SPARQL update payload to Fuseki2?
> >
> > Hi,
> >
> > Maybe a long shot but thought I'd ask.
> >
> > I'm sending updates to a Fuseki2 from an RDFLib/SPARQLWrapper based
> client. This POSTs an INSERT string to an update endpoint. I get back an error
> 500 for strings over a certain large size which (the limit) I haven't tried to
> figure out.
> >
> > Is there a theoretical, or other, reason why the limit exists and a strategy
> to adopt besides fine tuning the string size?
> >
> > Many thanks and best regards,
> > Pierre
> >
> > THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED
> INFORMATION.
> > IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL
> > IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS
> > E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF
> THE
> > MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN.
> >
> > IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S
> EMPLOYEES
> > MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA
> HANDBOOK AS
> > "THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN
> AN INVESTMENT
> > MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH
> MEETINGS, THE
> > FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE
> INFORMATION
> > (AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO
> 596/2014).
> > (https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
> > COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF
> REGULATION
> > AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR
> INFORMATION
> > ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET
> SOUNDINGS,
> > PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/.
> >
> > HORIZON ASSET LLP IS AUTHORISED AND REGULATED
> > BY THE FINANCIAL CONDUCT AUTHORITY.
> >
> >
> >


RE: Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-06 Thread Pierre Grenon
Hi,

Thanks for your answer. 

I'll look into the server's logs if I can. I am using this approach because the 
server is in fact remote. So I read into a string that I then pass to POST. The 
query when saved to file is ~ 85Mb.

I guess I was lazy and hoping for an easy answer if this clogged up Fuseki in 
known ways and whether that might be addressed through config (memory, thread, 
whatnots). 

Will double check a few things and report then. 

With many thanks and best regards, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Laura Morales [mailto:laure...@mail.com] 
Sent: 06 August 2019 08:19
To: users@jena.apache.org
Cc: users@jena.apache.org
Subject: Re: Sensible size limit for SPARQL update payload to Fuseki2?

How long is your query?? Personally I'm not aware of any such limitations, 
especially when POSTing, but other people here definitely know better than me 
if there is one or not. If there is a limit, let's say even just 1MB, you need 
a *very* long query to break it. 500 is a general "internal error" code, it's 
not specific to query length. It could be something else (look at the logs). 
Did you try to run the query from the Fuseki web interface, or even with 
another database entirely? It could help you debug it.



> Sent: Tuesday, August 06, 2019 at 8:15 AM
> From: "Pierre Grenon" 
> To: "users@jena.apache.org" 
> Subject: Sensible size limit for SPARQL update payload to Fuseki2?
>
> Hi,
>
> Maybe a long shot but thought I'd ask.
>
> I'm sending updates to a Fuseki2 from an RDFLib/SPARQLWrapper based client. 
> This POSTs an INSERT string to an update endpoint. I get back an error 500 
> for strings over a certain large size which (the limit) I haven't tried to 
> figure out.
>
> Is there a theoretical, or other, reason why the limit exists and a strategy 
> to adopt besides fine tuning the string size?
>
> Many thanks and best regards,
> Pierre
>
> THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION.
> IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL
> IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS
> E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE
> MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN.
>
> IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES
> MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS
> "THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT
> MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE
> FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION
> (AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014).
> (https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
> COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION
> AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION
> ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS,
> PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/.
>
> HORIZON ASSET LLP IS AUTHORISED AND REGULATED
> BY THE FINANCIAL CONDUCT AUTHORITY.
>
>
>


Sensible size limit for SPARQL update payload to Fuseki2?

2019-08-06 Thread Pierre Grenon
Hi, 

Maybe a long shot but thought I'd ask. 

I'm sending updates to a Fuseki2 from an RDFLib/SPARQLWrapper based client. 
This POSTs an INSERT string to an update endpoint. I get back an error 500 for 
strings over a certain large size which (the limit) I haven't tried to figure 
out. 

Is there a theoretical, or other, reason why the limit exists and a strategy to 
adopt besides fine tuning the string size?

Many thanks and best regards, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.




RE: Rules and 'on the fly' aggregate values

2019-07-25 Thread Pierre Grenon
Hey,

I think so --- unless I don’t understand the ‘CONSTRUCT query on an inference 
model’ suggestion. This is after all what I understand spin rules would do in 
say Virtuoso. But this is the essence of the dilemma.

Suppose I’m interested in higher level queries where these aggregations have 
been turned to facts. I may want to use rules to derive aggregated values 
instead of having to run preliminary queries. If the computed values need to be 
stored in named graphs for non-monotonicity reasons, then, in effect, I’m not 
sure where the edge is. Also, it brings about the question of how to keep track 
of these graphs.

If queries need to be run to do this population, I suppose it still remains an 
external engine that does the querying and insert then (not going to do this by 
hand). It just sounds like a lot of machinery. (For the records, I don’t 
believe that the value in SPAQRL is to do numerical aggregation, but in 
practice the request arises…)

A bit non-conclusive on my end but thanks for the input.

With many thanks and best regards,
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Lorenz Buehmann [mailto:buehm...@informatik.uni-leipzig.de]
Sent: 25 July 2019 10:44
To: users@jena.apache.org
Subject: Re: Rules and 'on the fly' aggregate values

Can't you simply use any any CONSTRUCT query on an inference model? Or
use an INSERT query to write it to a graph? Indeed bot only if you're
producing proper RDF triples.

On 25.07.19 10:36, Pierre Grenon wrote:
> Hi,
>
> Quick search for 'rule aggregate' in mail archives returns 3 thread results. 
> The only decisive statement seems to be Dave's 3 yo:
>
> """
> Short answer on rules is don't use them for this. Something like "sum of
> all invoice items present" is a non-monotonic operation and JenaRules
> are really not suited to this. [...]
> """
>
> https://lists.apache.org/thread.html/40ed40686d6244d3ebc0dfe5163e052b3dba2d41358b5f78f1c81347@<https://lists.apache.org/thread.html/40ed40686d6244d3ebc0dfe5163e052b3dba2d41358b5f78f1c81347@>
>
> Is this still the valid answer? If so, what is the recommendation to perform 
> and persist aggregation for data maintained using Jena?
>
> To pull non aggregate query results and do aggregation within an external 
> application? Write back transitory results to named graphs?
>
> I am not sure whether there may be documentation on this since that I may 
> have missed, if so apologies and thanks for the pointer.
>
> With many thanks and kind regards,
> Pierre
>
> THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION.
> IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL
> IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS
> E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE
> MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN.
>
> IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES
> MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS
> "THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT
> MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE
> FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION
> (AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014).
> (https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html<https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html>)
> COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION
> AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION
> ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS,
> PLEASE SEE 
> https://www.horizon-asset.co.uk/market-soundings/<https://www.horizon-asset.co.uk/market-soundings/>.
>
> HORIZON ASSET LLP IS AUTHORISED AND REGULATED
> BY THE FINANCIAL CONDUCT AUTHORITY.
>
>
>


Rules and 'on the fly' aggregate values

2019-07-25 Thread Pierre Grenon
Hi, 

Quick search for 'rule aggregate' in mail archives returns 3 thread results. 
The only decisive statement seems to be Dave's 3 yo: 

"""
Short answer on rules is don't use them for this. Something like "sum of 
all invoice items present" is a non-monotonic operation and JenaRules 
are really not suited to this. [...]
"""

https://lists.apache.org/thread.html/40ed40686d6244d3ebc0dfe5163e052b3dba2d41358b5f78f1c81347@%3Cusers.jena.apache.org%3E

Is this still the valid answer? If so, what is the recommendation to perform 
and persist aggregation for data maintained using Jena? 

To pull non aggregate query results and do aggregation within an external 
application? Write back transitory results to named graphs? 

I am not sure whether there may be documentation on this since that I may have 
missed, if so apologies and thanks for the pointer. 

With many thanks and kind regards, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.




RE: Combining inferences from GRR and RDFS or OWL reasoner

2019-07-24 Thread Pierre Grenon
in an era of in memory stores and
less clear transaction management) so there may be other manifestations
of the problem with haven't been caught.

Regards,
Dave

On 22/07/2019 17:55, Pierre Grenon wrote:
> Hi Dave,
>
> Thanks so much for your detailed reply, it helped.
>
> I’ve looked into 1 so far (using @include) and I seem to have some good 
> results whether using  or some file with the rule set. (In fact I tried 
> different variants of the rdfs rule set and it seemed to be doing about the 
> same.) Yes, indeed, it has to be all config based I’m afraid as java isn’t 
> the way to go in the context.
>
> However, I haven’t ironed out yet my config and I ran into a few crippling 
> inconveniences with Fuseki 3.12 (some apparently non terminating queries – 
> you need to hit ‘enter’ in the fuseki-server prompt to get a response, some 
> annoying white space issues in the file names -- %20 doesn’t help – and I had 
> some ‘in transaction’ message erratically at some point – no clue and I’m 
> sorry that I can’t reproduce this now.)
>
> I need to look more into 
> https://jena.apache.org/documentation/inference/#rules<https://jena.apache.org/documentation/inference/#rules>
>  I suppose as this is all a bit too much shooting in the dark.
>
> I’m trying again from scratch with a clean example, sticking with Fuseki 
> 3.10. I’ll post my config file if I manage.
>
> I have not looked at 2 yet.
>
> With many thanks and kind regards,
> Pierre
>
> THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION.
> IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL
> IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS
> E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE
> MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN.
>
> IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES
> MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS
> "THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT
> MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE
> FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION
> (AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014).
> (https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html<https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html>)
> COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION
> AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION
> ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS,
> PLEASE SEE 
> https://www.horizon-asset.co.uk/market-soundings/<https://www.horizon-asset.co.uk/market-soundings/>.
>
> HORIZON ASSET LLP IS AUTHORISED AND REGULATED
> BY THE FINANCIAL CONDUCT AUTHORITY.
>
>
> From: Dave Reynolds [mailto:dave.e.reyno...@gmail.com]
> Sent: 21 July 2019 09:54
> To: users@jena.apache.org
> Subject: Re: Combining inferences from GRR and RDFS or OWL reasoner
>
> Hi Pierre,
>
> You've two options for combining a GRR rule set and RDFS inference
> either combine the rules into a single rule set and use a GRR
> configuration or, as you say, layer the GRR reasoner over the top of an
> RDFS reasoner.
>
> 1. To combine the rules then in your GRR rule set use the directive:
>
> @include .
>
> to include the rules for RDFS inference before your own rules. There are
> some restrictions here though. Firstly, the default RDFS rules which are
> included by this method need the transitive reasoner enabled.
> Programmatically that's easy:
>
> reasoner.setTransitiveClosureCaching(true);
>
> However, I'm not sure if the assembler notation supports that. I'm not
> really familiar with the assembler machinery but a quick glance through
> the documentation and schema didn't turn up any obvious way to set this.
>
> If there really is no way to set this flag in assemblers, and if you are
> restricted to using assemblers, then a workaround (other than option 2,
> below) would be to use an RDFS rule set which doesn't need the
> transitive reasoner. Jena includes such a rule set:
>
> https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/rdfs-fb.rules<https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/rdfs-fb.rules><https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/rdfs-fb.rules<https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/rdfs-fb.rules>>
>
> You could copy those somewhere visible to your application and @include
> them from there.
>
> The other limitation of the single ruleset approach is that, because the
> RDFS rules using a mix of forward and 

RE: Combining inferences from GRR and RDFS or OWL reasoner

2019-07-22 Thread Pierre Grenon
Hi Dave,

Thanks so much for your detailed reply, it helped.

I’ve looked into 1 so far (using @include) and I seem to have some good results 
whether using  or some file with the rule set. (In fact I tried different 
variants of the rdfs rule set and it seemed to be doing about the same.) Yes, 
indeed, it has to be all config based I’m afraid as java isn’t the way to go in 
the context.

However, I haven’t ironed out yet my config and I ran into a few crippling 
inconveniences with Fuseki 3.12 (some apparently non terminating queries – you 
need to hit ‘enter’ in the fuseki-server prompt to get a response, some 
annoying white space issues in the file names -- %20 doesn’t help – and I had 
some ‘in transaction’ message erratically at some point – no clue and I’m sorry 
that I can’t reproduce this now.)

I need to look more into https://jena.apache.org/documentation/inference/#rules 
I suppose as this is all a bit too much shooting in the dark.

I’m trying again from scratch with a clean example, sticking with Fuseki 3.10. 
I’ll post my config file if I manage.

I have not looked at 2 yet.

With many thanks and kind regards,
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Dave Reynolds [mailto:dave.e.reyno...@gmail.com]
Sent: 21 July 2019 09:54
To: users@jena.apache.org
Subject: Re: Combining inferences from GRR and RDFS or OWL reasoner

Hi Pierre,

You've two options for combining a GRR rule set and RDFS inference
either combine the rules into a single rule set and use a GRR
configuration or, as you say, layer the GRR reasoner over the top of an
RDFS reasoner.

1. To combine the rules then in your GRR rule set use the directive:

@include .

to include the rules for RDFS inference before your own rules. There are
some restrictions here though. Firstly, the default RDFS rules which are
included by this method need the transitive reasoner enabled.
Programmatically that's easy:

reasoner.setTransitiveClosureCaching(true);

However, I'm not sure if the assembler notation supports that. I'm not
really familiar with the assembler machinery but a quick glance through
the documentation and schema didn't turn up any obvious way to set this.

If there really is no way to set this flag in assemblers, and if you are
restricted to using assemblers, then a workaround (other than option 2,
below) would be to use an RDFS rule set which doesn't need the
transitive reasoner. Jena includes such a rule set:

https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/rdfs-fb.rules<https://github.com/apache/jena/blob/master/jena-core/src/main/resources/etc/rdfs-fb.rules>

You could copy those somewhere visible to your application and @include
them from there.

The other limitation of the single ruleset approach is that, because the
RDFS rules using a mix of forward and backward chaning, the rules you
add on top all[*] need to be written as backward chaining rules.
Otherwise they won't "see" the results of the RDFS backward chaining rules.

2. The alternative is, as you say, to configure an RDFS reasoner, then
configure a GRR instances whose base model is your RDFS reasoner. You
wouldn't then need a union as well - all the triples visible in the RDFS
InfGraph would be visible through the GRR InfGraph.

Dave

[*] Well, at least those that might be affected by the results of RDFS
inference.

On 19/07/2019 22:36, Pierre Grenon wrote:
> apologies for piecemeal post -- didn't copy the whole file at first, so the 
> RDFS reasoner, in particular, wasn't there.
>
> I'm wondering if I need to have an inf model with the GRR reasoner with an 
> RDFS reasoner submodel and also the reverse and then union these... sounds a 
> bit weird.
>
> With many thanks,
> Pierre
>
> *Rest of config file*
>
> THIS E-MAIL

RE: Combining inferences from GRR and RDFS or OWL reasoner

2019-07-19 Thread Pierre Grenon
apologies for piecemeal post -- didn't copy the whole file at first, so the 
RDFS reasoner, in particular, wasn't there. 

I'm wondering if I need to have an inf model with the GRR reasoner with an RDFS 
reasoner submodel and also the reverse and then union these... sounds a bit 
weird.

With many thanks, 
Pierre

*Rest of config file*

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


<#theModel_RDFS> a ja:InfModel ;
ja:baseModel <#theGraph> ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> 
] ;
.

<#theGraph> rdf:type tdb2:GraphTDB ;
   tdb2:dataset :theTDB2Dataset .

:theTDB2Dataset
a  tdb2:DatasetTDB2 ;
tdb2:location  
"C:\\dev\\apache-jena-fuseki-3.10.0\\run/databases/Conference1" ;
tdb2:unionDefaultGraph true.

> -Original Message-
> From: Pierre Grenon
> Sent: 19 July 2019 17:48
> To: 'users@jena.apache.org'
> Subject: Combining inferences from GRR and RDFS or OWL reasoner
> 
> Hello,
> 
> (I apologise for I am not sure if this has been addressed before and I have
> not found the right thread or documentation.)
> 
> The configuration file below seems to allow reasoning with either a GRR or
> an out of the box reasoner on the same dataset.
> 
> However, I don't think it allows combining inferences from both reasoners at
> the same time. I am not sure how to achieve this through configuration.
> 
> (Happy to provide an example of data and rule for the GRR. I've noticed this
> when adding a rule to classify undeclared individuals, i.e., individuals
> appearing in the subject position of a triple. The rule to the effect that if
> they do, they are instances of a class A. It is possible to derive the
> instantiation. However, it is not possible to combine it with type inheritance
> from a reasoner. If class A is a subclass of class B, there is no inference 
> to the
> effect that the individual is also an instance of class B.)
> 
> With many thanks and kind regards,
> Pierre
> 
> 
> 
> 
> -
> 
> 
> @prefix :  <http://base/#> .
> @prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix tdb2:  <http://jena.apache.org/2016/tdb#> .
> @prefix ja:<http://jena.hpl.hp.com/2005/11/Assembler#> .
> @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix fuseki: <http://jena.apache.org/fuseki#> .
> 
> :theService a   fuseki:Service ;
> rdfs:label"Service with update and query to test 
> minimal
> dataset with inference using an instance of generic rule reasoner and
> RDFSExptRuleReasoner" ;
> fuseki:dataset:theDataset ;
>   #:tdb_dataset_readwrite ;
> fuseki:name   "Conference2" ;
> fuseki:serviceQuery   "query" , "sparql" ;
> fuseki:serviceReadGraphStore  "get" ;
> fuseki:serviceReadWriteGraphStore
> "data" ;
> fuseki:serviceUpdate  "update" ;
> fuseki:serviceUpload  "upload" .
> 
> :theDataset a ja:RDFDataset ;
> ja:defaultGraph <#theUnionModel>
>   .
> 
> <#theUnionModel> a ja:UnionModel ;
>   ja:rootModel <#theRootModel> ;
>   ja:subModel <#theModel_GRR> , <#theModel_RDFS> .
> 
> <#theRootModel> a ja:Model ;
> ja:baseModel <#theGraph> ;
> .
> 
> 
> <#theModel_GRR> a ja:InfModel ;
> ja:baseModel <#theGraph> ;
>   ja:reasoner [
>   ja:reasonerURL
> <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ;
>   ja:rulesFrom  3.10.0/data/conference/conference1.rules>
>   ] ;
> .


Combining inferences from GRR and RDFS or OWL reasoner

2019-07-19 Thread Pierre Grenon
Hello, 

(I apologise for I am not sure if this has been addressed before and I have not 
found the right thread or documentation.) 

The configuration file below seems to allow reasoning with either a GRR or an 
out of the box reasoner on the same dataset. 

However, I don't think it allows combining inferences from both reasoners at 
the same time. I am not sure how to achieve this through configuration. 

(Happy to provide an example of data and rule for the GRR. I've noticed this 
when adding a rule to classify undeclared individuals, i.e., individuals 
appearing in the subject position of a triple. The rule to the effect that if 
they do, they are instances of a class A. It is possible to derive the 
instantiation. However, it is not possible to combine it with type inheritance 
from a reasoner. If class A is a subclass of class B, there is no inference to 
the effect that the individual is also an instance of class B.)

With many thanks and kind regards, 
Pierre




-


@prefix :   .
@prefix rdf:    .
@prefix tdb2:   .
@prefix ja: .
@prefix rdfs:   .
@prefix fuseki:  .

:theService a   fuseki:Service ;
rdfs:label"Service with update and query to test 
minimal dataset with inference using an instance of generic rule reasoner and 
RDFSExptRuleReasoner" ;
fuseki:dataset:theDataset ;
#:tdb_dataset_readwrite ;
fuseki:name   "Conference2" ;
fuseki:serviceQuery   "query" , "sparql" ;
fuseki:serviceReadGraphStore  "get" ;
fuseki:serviceReadWriteGraphStore
"data" ;
fuseki:serviceUpdate  "update" ;
fuseki:serviceUpload  "upload" .

:theDataset a ja:RDFDataset ; 
ja:defaultGraph <#theUnionModel>
.

<#theUnionModel> a ja:UnionModel ;
ja:rootModel <#theRootModel> ;
ja:subModel <#theModel_GRR> , <#theModel_RDFS> .

<#theRootModel> a ja:Model ;
ja:baseModel <#theGraph> ;
.


<#theModel_GRR> a ja:InfModel ;
ja:baseModel <#theGraph> ;
ja:reasoner [
ja:reasonerURL 
 ;
ja:rulesFrom 
 
] ;
.

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.




RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-06-03 Thread Pierre Grenon
So can I just edit 

\jena-core\src\main\java\org\apache\jena\reasoner\rulesys\ BuiltinRegistry.java

?

Or is that too hackish?

Thanks , 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Dave Reynolds [mailto:dave.e.reyno...@gmail.com] 
Sent: 03 June 2019 11:17
To: users@jena.apache.org
Subject: Re: Documentation/tutorial on using dates in Jena rules with 
GenericRuleReasoner

Hi Pierre,

I'm afraid I've lost track of what you are tying to do. Originally it 
seemed to be a problem running comparisons on date time values but 
Lorenz has already answered that.

In terms on writing your own new Builtins, then before you can use a new 
rule Builtin it needs to be registered. That's what the line:

BuiltinRegistry.theRegistry.register( new StringEqualIgnoreCase() )

was doing in my (non-fuseki) example.

If you need your new builtin to run within fuseki then you would need 
some way to trigger such registration code. No doubt that's possible but 
not something I've any first hand knowledge of.

By the way, for simply getting code loaded into fuseki you don't need to 
repack the jar. Just add your new jar to the classpath and use the 
ja:loadClass function to get your class loaded when fuseki starts up. 
See last example in:

https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html

Dave

On 03/06/2019 07:01, Pierre Grenon wrote:
> Hi Dave,
> 
> Executive summary:
> 
> I'm not a java coder. I did what I could to try to do this using fuseki.
> 
> I get this:
> [2019-05-31 18:47:30] Functor WARN Invoking undefined functor testBuilt in r1
> 
> I understand this may be related to RuleContext. I don't understand any 
> further.
> Details below.
> 
> With many thanks,
> Pierre
> 
> Details ---
> 
> 1. I unzipped my fuseki-server.jar
> 
> 2. I placed the code below into a ..\rulesys\testBuilt.java as
> 
> 
> package org.apache.jena.reasoner.rulesys.builtins;
> 
> 
> import org.apache.jena.graph.* ;
> import org.apache.jena.reasoner.rulesys.* ;
> 
> /**
> * Tests if the first argument is less than the second.
> */
> 
> class testBuilt extends BaseBuiltin implements Builtin {
> public String getName() {
> return "testBuilt";
> }
> 
> @Override
> public int getArgLength() {
> return 2;
> }
> 
> @Override
> public boolean bodyCall(Node[] args, int length, RuleContext context) {
> checkArgs(length, context);
> Node n1 = getArg(0, args, context);
> Node n2 = getArg(1, args, context);
> if (n1.isLiteral() && n1.isLiteral()) {
> return n1.getLiteralLexicalForm().equalsIgnoreCase(
> n2.getLiteralLexicalForm() );
> } else {
> return false;
> }
> }
> }
> 
>  
> 
> 3. Compiled that:
> 
> C:\dev\apache-jena-fuseki-3.10.0\woot>javac 
> org\apache\jena\reasoner\rulesys\builtins\testBuilt.java
> 
> 4. Jar-ed the whole thing back
> 
> C:\dev\apache-jena-fuseki-3.10.0\woot>jar cmvf 
> fuseki-server\META-INF\MANIFEST.MF fuseki-server.jar -C fuseki-server/ .
> 
> 5. Replaced my fuseki-server.jar
> 
> 6. Created a rule file
> 
> 
> @prefix ns: <http://test.org#> .
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> 
> [r1:
> (?x ns:p ?pl)
> (?x ns:q ?ql)
> testBuilt(?pl, ?ql)
> ->
> (?x ns:r 'equal')
> ]
> 
> 
> 7. Created a dataset file
> 
> 
> @prefix ns: <http://test.org#> .
> @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix xml: <http://www.w3.org/XML/1998/namespace> .
> @prefix xsd: <http:/

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-06-03 Thread Pierre Grenon
Thanks, Dave.

 PREAMBLE 

For memory and context -- I am on a quest... it was two-pronged

- Lorenz helped me work out the rule and config using an existing built in. 
That bit is closed.

- I'm pursuing 

"a. Anybody is a taker to hold me by the hand and use this thread to come 
up with a complete cycle for making a new built in and adding it to my fuseki? 
If somebody has the time to do this---and I’m happy that it takes what it 
takes, I can’t on my end make it a high priority--, we could reuse the thread 
for the purpose of a detailed how-to for noobs like me."

I know you said you didn't have time to do this. I've followed this path using 
the old example of a built in you gave. So now my roadmap is: 

- get a custom built in to work in fuseki (on now)
- work out built in with dates (cherry on the cake) 



So I have to figure: 

- How to register new built in in fuseki (but how does fuseki registers them at 
all then?). I thought that if I packed the class in the jar it was enough to 
ensure the registration. I'll start a new thread for this I suppose.

Thank you for the ja:loadClass, I will try this, it should allow making the 
registration . 

Thank you very much, 
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Dave Reynolds [mailto:dave.e.reyno...@gmail.com] 
Sent: 03 June 2019 11:17
To: users@jena.apache.org
Subject: Re: Documentation/tutorial on using dates in Jena rules with 
GenericRuleReasoner

Hi Pierre,

I'm afraid I've lost track of what you are tying to do. Originally it 
seemed to be a problem running comparisons on date time values but 
Lorenz has already answered that.

In terms on writing your own new Builtins, then before you can use a new 
rule Builtin it needs to be registered. That's what the line:

BuiltinRegistry.theRegistry.register( new StringEqualIgnoreCase() )

was doing in my (non-fuseki) example.

If you need your new builtin to run within fuseki then you would need 
some way to trigger such registration code. No doubt that's possible but 
not something I've any first hand knowledge of.

By the way, for simply getting code loaded into fuseki you don't need to 
repack the jar. Just add your new jar to the classpath and use the 
ja:loadClass function to get your class loaded when fuseki starts up. 
See last example in:

https://jena.apache.org/documentation/fuseki2/fuseki-configuration.html

Dave

On 03/06/2019 07:01, Pierre Grenon wrote:
> Hi Dave,
> 
> Executive summary:
> 
> I'm not a java coder. I did what I could to try to do this using fuseki.
> 
> I get this:
> [2019-05-31 18:47:30] Functor WARN Invoking undefined functor testBuilt in r1
> 
> I understand this may be related to RuleContext. I don't understand any 
> further.
> Details below.
> 
> With many thanks,
> Pierre
> 
> Details ---
> 
> 1. I unzipped my fuseki-server.jar
> 
> 2. I placed the code below into a ..\rulesys\testBuilt.java as
> 
> 
> package org.apache.jena.reasoner.rulesys.builtins;
> 
> 
> import org.apache.jena.graph.* ;
> import org.apache.jena.reasoner.rulesys.* ;
> 
> /**
> * Tests if the first argument is less than the second.
> */
> 
> class testBuilt extends BaseBuiltin implements Builtin {
> public String getName() {
> return "testBuilt";
> }
> 
> @Override
> public int getArgLength() {
> return 2;
> }
> 
> @Override
> public boolean bodyCall(Node[] args, int length, RuleContext context) {
> checkArgs(length, context);
> Node n1 = getArg(0, args, context);
> Node n2 = getArg(1, args, context);
> if (n1.isLiteral() && n1.isLiteral()) {
> return n1.getLiteralLexicalForm().equalsIgnoreCase(
> n2.getLiteralLexicalForm() );
> } else {
> return false;
&

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-06-03 Thread Pierre Grenon
 tdb2:dataset :theTDB2DatasetBI .

:theTDB2DatasetBI
a  tdb2:DatasetTDB2 ;
tdb2:location  
"C:\\dev\\apache-jena-fuseki-3.10.0\\run/databases/ConferenceBuiltIn" ;
tdb2:unionDefaultGraph true.



This is my query: 
---

prefix ns: <http://test.org#>
select *
where 
{?x ns:r ?z}
limit 5

This is Fuskei's log: 
--

[2019-05-31 18:47:22] Server INFO  Started 2019/05/31 18:47:22 BST on port 
3030
[2019-05-31 18:47:30] Fuseki INFO  [1] POST 
http://localhost:3030/ConferenceBuiltIn/sparql
[2019-05-31 18:47:30] Fuseki INFO  [1] Query = prefix ns: 
<http://test.org#> select * where  {?x ns:r ?z} limit 5
[2019-05-31 18:47:30] FunctorWARN  Invoking undefined functor testBuilt in 
r1
[2019-05-31 18:47:30] FunctorWARN  Invoking undefined functor testBuilt in 
r1
[2019-05-31 18:47:30] FunctorWARN  Invoking undefined functor testBuilt in 
r1
[2019-05-31 18:47:30] FunctorWARN  Invoking undefined functor testBuilt in 
r1
[2019-05-31 18:47:30] FunctorWARN  Invoking undefined functor testBuilt in 
r1
[2019-05-31 18:47:30] Fuseki INFO  [1] 200 OK (78 ms)

## END OF MESSAGE

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Dave Reynolds [mailto:dave.e.reyno...@gmail.com] 
Sent: 17 May 2019 09:01
To: users@jena.apache.org
Subject: Re: Documentation/tutorial on using dates in Jena rules with 
GenericRuleReasoner

Hi Pierre,

I can't offer to hold you by the hand I'm afraid, snowed under with 
work. But a minimal example might help. Here's an example of a minimal 
extension builtin:

class StringEqualIgnoreCase extends BaseBuiltin implements Builtin {

public String getName() {
return "stringEqualIgnoreCase";
}

@Override
public int getArgLength() {
return 2;
}

@Override
public boolean bodyCall(Node[] args, int length, RuleContext context) {
checkArgs(length, context);
Node n1 = getArg(0, args, context);
Node n2 = getArg(1, args, context);
if (n1.isLiteral() && n1.isLiteral()) {
return n1.getLiteralLexicalForm().equalsIgnoreCase( 
n2.getLiteralLexicalForm() );
} else {
return false;
}
}

}

and an example driver class for demonstrating it operating:

/**
* Rule test.
*/
public void testRuleSet2() {
String NS = "http://ont.com/;;
BuiltinRegistry.theRegistry.register( new 
StringEqualIgnoreCase() );
String rules = "[r1: (?x ns:p ?pl) (?x ns:q ?ql) 
stringEqualIgnoreCase(?pl, ?ql) -> (?x ns:r 'equal') ]";
Model m = ModelFactory.createDefaultModel();
Resource a = m.createResource(NS + "a");
Resource b = m.createResource(NS + "b");
Property p = m.createProperty(NS + "p");
Property q = m.createProperty(NS + "q");
m.add(a, p, "FOO");
m.add(a, q, "foo");
m.add(b, p, "FOO");
m.add(b, q, "foobar");
GenericRuleReasoner reasoner = new GenericRuleReasoner(Rule
.parseRules(rules));
InfModel infModel = ModelFactory.createInfModel(reasoner, m);
infModel.write(System.out, "Turtle");
}

These are cut/paste from some very ancient examples but hopefully should 
work, if not let us know I can see about assembling it into a self 
contained working example.

As it says in the documentation, for examples of how to write particular 
sorts of builtin then the best place is to look is the source code for 
the current builtins.

Dave

On 17/05/2019 07:53, Pierre Grenon wrote:
> Hi
> 
> Thanks again.
> 
> Hear you.
> 
> I think this is becoming a bit too meta perhaps. Maybe there’s a couple of 
> ways to go forward.
> 
> 
> a. Anybody is a taker to hold me by the hand and use this thread to come up 
> with a complete cycle for making a new built in and adding it to my fuseki? 
> If somebody has the time to do this---and I’m ha

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-05-23 Thread Pierre Grenon
Further to the below. 

I am now pasting a config file in which I use both the Generic Rule Reasoner 
for the rule and RDFS for class subsumption.

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


CAVEAT: This may appear trivial yet it was not straightforward to me how this 
works so any comment on this type of config is obviously most welcome 
independently of the dates aspect. 

On my end this concludes this part of the thread. I will use this config and 
the data as an extensible basis to figure out new built ins, although I have no 
clue when that might be -- all current conferences might have their deadlines 
passed by the time I get to this...

With many thanks and kind regards, 
Pierre 

For reference: 

/Conference1 allows deriving the expected facts from the rules but did not 
support RDFS 
/Conference2 allows returning bindings for the following query:
select * where 
{?x a <http://test.org#OrganisedEvent> . ?x <http://test.org#hasStatus> ?e} 


### START CONFIG 2: Conference_GRR_RDFS.ttl ###

@prefix :  <http://base/#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix tdb2:  <http://jena.apache.org/2016/tdb#> .
@prefix ja:<http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

:theService a   fuseki:Service ;
rdfs:label"Service with update and query to test 
minimal dataset with inference using an instance of generic rule reasoner and 
RDFSExptRuleReasoner" ;
fuseki:dataset:theDataset ;
#:tdb_dataset_readwrite ;
fuseki:name   "Conference2" ;
fuseki:serviceQuery   "query" , "sparql" ;
fuseki:serviceReadGraphStore  "get" ;
fuseki:serviceReadWriteGraphStore
"data" ;
fuseki:serviceUpdate  "update" ;
fuseki:serviceUpload  "upload" .

:theDataset a ja:RDFDataset ; 
ja:defaultGraph <#theUnionModel>
.

<#theUnionModel> a ja:UnionModel ;
ja:rootModel <#theRootModel> ;
ja:subModel <#theModel_GRR> , <#theModel_RDFS> .

<#theRootModel> a ja:Model ;
ja:baseModel <#theGraph> ;
.


<#theModel_GRR> a ja:InfModel ;
ja:baseModel <#theGraph> ;
ja:reasoner [
ja:reasonerURL 
<http://jena.hpl.hp.com/2003/GenericRuleReasoner> ;
ja:rulesFrom 
 
] ;
.

<#theModel_RDFS> a ja:InfModel ;
ja:baseModel <#theGraph> ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/RDFSExptRuleReasoner> 
] ;
.

<#theGraph> rdf:type tdb2:GraphTDB ;
   tdb2:dataset :theTDB2Dataset .

:theTDB2Dataset
a  tdb2:DatasetTDB2 ;
tdb2:location  
"C:\\dev\\apache-jena-fuseki-3.10.0\\run/databases/Conference1" ;
tdb2:unionDefaultGraph true.

### END CONFIG 2: Conference_GRR_RDFS.ttl ###   


> -Original Message-
> From: Pierre Grenon
> Sent: 23 May 2019 06:23
> To: 'users@jena.apache.org'
> Subject: RE: Documentation/tutorial on using dates in Jena rules with
> GenericRuleReasoner
> 
> Apologies for repost -- it *feels* like attaching stuff to emails is not the 
> right
> thing to do. So, for all it's worth, as I would find it useful myself, files 
> copied
> below.
> 
> Many thanks,
> Pierre
> 
> 
> 
> - Conference_GRR_onerule.ttl --- fuseki config with TDB2 and generic rule
> reasoner
> 

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-05-22 Thread Pierre Grenon
Apologies for repost -- it *feels* like attaching stuff to emails is not the 
right thing to do. So, for all it's worth, as I would find it useful myself, 
files copied below. 

Many thanks, 
Pierre



- Conference_GRR_onerule.ttl --- fuseki config with TDB2 and generic rule 
reasoner
### START CONFIG ###

@prefix :  <http://base/#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix tdb2:  <http://jena.apache.org/2016/tdb#> .
@prefix ja:<http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

:theService a   fuseki:Service ;
rdfs:label"Service with update and query to test 
minimal dataset with inference using an instance of generic rule reasoner" ;
fuseki:dataset:theDataset ;
#:tdb_dataset_readwrite ;
fuseki:name   "Conference1" ;
fuseki:serviceQuery   "query" , "sparql" ;
fuseki:serviceReadGraphStore  "get" ;
fuseki:serviceReadWriteGraphStore
"data" ;
fuseki:serviceUpdate  "update" ;
fuseki:serviceUpload  "upload" .

:theDataset a ja:RDFDataset ; 
ja:defaultGraph <#theModel_GRR> .

<#theModel_GRR> a ja:InfModel ;
ja:baseModel <#theGraph> ;
ja:reasoner [
ja:reasonerURL 
<http://jena.hpl.hp.com/2003/GenericRuleReasoner> ;
ja:rulesFrom 
 
] ;
.

<#theGraph> rdf:type tdb2:GraphTDB ;
   tdb2:dataset :theTDB2Dataset .

:theTDB2Dataset
a  tdb2:DatasetTDB2 ;
tdb2:location  
"C:\\dev\\apache-jena-fuseki-3.10.0\\run/databases/Conference1" ;
tdb2:unionDefaultGraph true.

### END CONFIG ###

- conference1.ttl 
### START DATA ###

@prefix : <http://test.org#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

### OE
<http://test.org#OrganisedEvent> rdf:type owl:Class ;
rdfs:label "organised event" .

<http://test.org#Conference> rdf:type owl:Class ;
rdfs:subClassOf <http://test.org#OrganisedEvent> ;
rdfs:label "conference" .

<http://test.org#Workshop> rdf:type owl:Class ; 
rdfs:subClassOf <http://test.org#OrganisedEvent> ;
rdfs:label "workshop" .

<http://test.org#hasDeadline> rdf:type owl:DatatypeProperty ;
rdfs:domain <http://test.org#OrganisedEvent> ;
rdfs:range xsd:dateTime ;
rdfs:label "deadline passed" .

<http://test.org#Status> rdf:type owl:Class ; 
rdfs:label "Status" .

<http://test.org#hasStatus> 
rdf:type owl:ObjectProperty ;
rdfs:domain <http://test.org#OrganisedEvent> ;
rdfs:range <http://test.org#Status> ;
rdfs:label "has status" .

<http://test.org#Status_DeadlinePassed> 
rdf:type owl:NamedIndividual , <http://test.org#Status> ;
rdfs:label "deadline passed" .

<http://test.org#Status_DeadlineActive> 
rdf:type owl:NamedIndividual , <http://test.org#Status> ;
rdfs:label "deadline active" .


### KB
<http://test.org#Conference1> rdf:type owl:NamedIndividual , 
<http://test.org#Conference> ;
<http://test.org#hasDeadline>"2019-01-01T00:00:00Z"^^xsd:dateTime ;
rdfs:label "1st Intl Conf of the Penguin Appreciation Society" .

<http://test.org#Conference2> rdf:type owl:NamedIndividual , 
<http://test.org#Conference> ;
<http://test.org#hasDeadline>"3019-01-01T00:00:00Z"^^xsd:dateTime ;
rdfs:label "101st Conf of the Penguin Appreciation Society" .

<http://test.org#Workshop1> rdf:type owl:NamedIndividual , 
<http://test.org#Workshop> ;
<http://test.org#hasDeadline>"2018-07-01T00:00:00Z"^^xsd:dateTime ;
rdfs:label "How to walk like a penguin" .

<http://test.org#Workshop2> rdf:type owl:NamedIndividual , 
<http://test.org#Workshop> ;
    <http://test.org#hasDeadline>"2030-07-01T00:00:00Z"^^xsd:dateTime ;
rdfs:label "Do penguins walk?" .

### END DATA ###

- conference1.rules 
### START RULE###
@prefix ns: <http://test.org#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-05-22 Thread Pierre Grenon
Thank you, Dave – I am yet to struggle with this. Hope to be in a position to 
follow up

Best
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. FOR INFORMATION 
ON THE FIRM'S POLICY IN RELATION TO ITS PARTICIPATION IN MARKET SOUNDINGS, 
PLEASE SEE https://www.horizon-asset.co.uk/market-soundings/. 

HORIZON ASSET LLP IS AUTHORISED AND REGULATED 
BY THE FINANCIAL CONDUCT AUTHORITY.


From: Dave Reynolds [mailto:dave.e.reyno...@gmail.com]
Sent: 17 May 2019 09:01
To: users@jena.apache.org
Subject: Re: Documentation/tutorial on using dates in Jena rules with 
GenericRuleReasoner

Hi Pierre,

I can't offer to hold you by the hand I'm afraid, snowed under with
work. But a minimal example might help. Here's an example of a minimal
extension builtin:

class StringEqualIgnoreCase extends BaseBuiltin implements Builtin {

public String getName() {
return "stringEqualIgnoreCase";
}

@Override
public int getArgLength() {
return 2;
}

@Override
public boolean bodyCall(Node[] args, int length, RuleContext context) {
checkArgs(length, context);
Node n1 = getArg(0, args, context);
Node n2 = getArg(1, args, context);
if (n1.isLiteral() && n1.isLiteral()) {
return n1.getLiteralLexicalForm().equalsIgnoreCase(
n2.getLiteralLexicalForm() );
} else {
return false;
}
}

}

and an example driver class for demonstrating it operating:

/**
* Rule test.
*/
public void testRuleSet2() {
String NS = "http://ont.com/<http://ont.com/>";
BuiltinRegistry.theRegistry.register( new
StringEqualIgnoreCase() );
String rules = "[r1: (?x ns:p ?pl) (?x ns:q ?ql)
stringEqualIgnoreCase(?pl, ?ql) -> (?x ns:r 'equal') ]";
Model m = ModelFactory.createDefaultModel();
Resource a = m.createResource(NS + "a");
Resource b = m.createResource(NS + "b");
Property p = m.createProperty(NS + "p");
Property q = m.createProperty(NS + "q");
m.add(a, p, "FOO");
m.add(a, q, "foo");
m.add(b, p, "FOO");
m.add(b, q, "foobar");
GenericRuleReasoner reasoner = new GenericRuleReasoner(Rule
.parseRules(rules));
InfModel infModel = ModelFactory.createInfModel(reasoner, m);
infModel.write(System.out, "Turtle");
}

These are cut/paste from some very ancient examples but hopefully should
work, if not let us know I can see about assembling it into a self
contained working example.

As it says in the documentation, for examples of how to write particular
sorts of builtin then the best place is to look is the source code for
the current builtins.

Dave

On 17/05/2019 07:53, Pierre Grenon wrote:
> Hi
>
> Thanks again.
>
> Hear you.
>
> I think this is becoming a bit too meta perhaps. Maybe there’s a couple of 
> ways to go forward.
>
>
> a. Anybody is a taker to hold me by the hand and use this thread to come up 
> with a complete cycle for making a new built in and adding it to my fuseki? 
> If somebody has the time to do this---and I’m happy that it takes what it 
> takes, I can’t on my end make it a high priority--, we could reuse the thread 
> for the purpose of a detailed how-to for noobs like me.
>
> b. I think I actually tried the rule below and I didn’t get any inference 
> result. Don’t know if it’s my config, my rule or my data. I could start a. by 
> trying to provide a dataset and config file as well. Again, anybody willing 
> to hold my hand?
>
> Give a shout.
>
> Thanks,
> Pierre
>
> From: Lorenz B. [mailto:buehm...@informatik.uni-leipzig.de]
> Sent: 17 May 2019 07:24
> To: users@jena.apache.org
> Subject: Re: Documentation/tutorial on using dates in Jena rules with 
> GenericRuleReasoner
>
> Hi,
>
>> Hi Lorenz,
>>
>> Thank you for your answer.
>>
>> Quick follow up.
>>
>> I think the issue for me is the documentation of the built-ins is too 
>> abstract or relies on understanding the source code. So I suppose, 
>> documentation / tutorial seems somewhat superfluous when you

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-05-22 Thread Pierre Grenon
Hi – yes, it works for me using fuseki as well. Apologies, I think my config 
file was bad or the data somehow.

For reference, similar to your test:


-Conference_GRR_onerule.ttl --- fuseki config with TDB2 and generic 
rule reasoner

-conference1.ttl --- small test set, with more than minimal data

-conference1.rules --- single (same) rule

Query: select * where {?x  ?z}


From: Lorenz B. [mailto:buehm...@informatik.uni-leipzig.de]
Sent: 18 May 2019 19:12
To: users@jena.apache.org
Subject: Re: Documentation/tutorial on using dates in Jena rules with 
GenericRuleReasoner


> b. I think I actually tried the rule below and I didn’t get any inference 
> result. Don’t know if it’s my config, my rule or my data. I could start a. by 
> trying to provide a dataset and config file as well. Again, anybody willing 
> to hold my hand?

Works for me as expected:

|Model m = ModelFactory.createDefaultModel();||
||String s = "@prefix ns: > .\n" +||
||   "@prefix xsd: 
> .\n" +||
||   " ns:hasDeadline
\"2002-05-30T09:00:00\"^^xsd:dateTime .";
||m.read(new StringReader(s), null, "Turtle");||
||
||String rule =||
||" [ruleMissedDeadline2: (?conference
> ?date) now(?now) 
greaterThan(?now, ?date)
" +||
||"-> (?conference 
>
>)]";||
||
||List rules = Rule.parseRules(rule);||
||Reasoner reasoner = new GenericRuleReasoner(rules);||
||Model infModel = ModelFactory.createInfModel(reasoner, m);||
||infModel.write(System.out, "N-Triples");|



> Give a shout.
>
> Thanks,
> Pierre
>
> From: Lorenz B. [mailto:buehm...@informatik.uni-leipzig.de]
> Sent: 17 May 2019 07:24
> To: users@jena.apache.org
> Subject: Re: Documentation/tutorial on using dates in Jena rules with 
> GenericRuleReasoner
>
> Hi,
>
>> Hi Lorenz,
>>
>> Thank you for your answer.
>>
>> Quick follow up.
>>
>> I think the issue for me is the documentation of the built-ins is too 
>> abstract or relies on understanding the source code. So I suppose, 
>> documentation / tutorial seems somewhat superfluous when you can do that – 
>> only I can’t understand what’s there and the source at the moment.
> I can see that it might be too abstract for people coming from different
> areas, sure. But, the question is who is able to provide such a tutorial
> and also who has the time. It's always a trade-off in Open Source
> projects like Jena - I guess most of the devs or other project related
> people here are not getting payed, and clearly such a tutorial for most
> if not all of the built-ins definitely needs some effort. Ideally, the
> community could take over those things, but looks like nobody ever wrote
> blog posts or tutorials about the Jena rule system and its built-ins.
>>
>>
>> 1. Yes, I seem to understand difference is a no go but I was wondering if 
>> there might be some work around coercing the dateTime to something else. I’m 
>> not sure I understood that very well but it looks like I can’t use functions 
>> in arguments of built-ins (so no xsd:year(?date) or whatever).
> I don't think you can use functions or expressions from the SPARQL
> engine resp. its XPath constructors. Both are totally different
> implementations I guess - but again, I'm not a developer, so I can't
> make a valid statement, except for looking into the code and the docs.
> From my point of view, only the mentioned built-ins from the docs are
> valid so far.
>>
>>
>> But then, on greaterThan, something should be workable if I have 
>> xsd:dateTime, no?
>>
>> What’s wrong with :
>>
>>
>>
>> [ruleMissedDeadline2:
>>
>> (?conference ns:hasDeadline ?date)
>>
>> now(?now)
>>
>> greaterThan(?now, ?date)
>>
>> ->
>>
>> (?conference ns:status ns:DeadlinePassed)
>>
>> ]
> Well I was clearly thinking too complicated, so yes, your rule should
> work given that the docs say
>
>> lessThan(?x, ?y), greaterThan(?x, ?y)
>> le(?x, ?y), ge(?x, ?y)
>>
>> Test if x is <, >, <= or >= y. Only passes if both x and y are numbers
>> or time instants (can be integer or floating point or XSDDateTime).
> I was more thinking about things like inferring the age of a person
> isn't possible right now, but would clearly be some nice to have feature
> such that you could have it as implicit fact in your KB without the need
> to change the asserted data every year.
>
>> 2. When you say extend the rule system, you mean adding a class using as a 
>> starting point something is in ..rulesys.builtins and adapting it and then 
>> rebuild all the jars. I’m using Fuseki, so I’d have to rebuild that too, 
>> yeah? Aside from the fact I’m not coding in java, this isn’t the easiest 
>> path for me at the moment.
> That's also 

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-05-17 Thread Pierre Grenon
Hi

Thanks again.

Hear you.

I think this is becoming a bit too meta perhaps. Maybe there’s a couple of ways 
to go forward.


a.  Anybody is a taker to hold me by the hand and use this thread to come 
up with a complete cycle for making a new built in and adding it to my fuseki? 
If somebody has the time to do this---and I’m happy that it takes what it 
takes, I can’t on my end make it a high priority--, we could reuse the thread 
for the purpose of a detailed how-to for noobs like me.

b.  I think I actually tried the rule below and I didn’t get any inference 
result. Don’t know if it’s my config, my rule or my data. I could start a. by 
trying to provide a dataset and config file as well. Again, anybody willing to 
hold my hand?

Give a shout.

Thanks,
Pierre

From: Lorenz B. [mailto:buehm...@informatik.uni-leipzig.de]
Sent: 17 May 2019 07:24
To: users@jena.apache.org
Subject: Re: Documentation/tutorial on using dates in Jena rules with 
GenericRuleReasoner

Hi,

> Hi Lorenz,
>
> Thank you for your answer.
>
> Quick follow up.
>
> I think the issue for me is the documentation of the built-ins is too 
> abstract or relies on understanding the source code. So I suppose, 
> documentation / tutorial seems somewhat superfluous when you can do that – 
> only I can’t understand what’s there and the source at the moment.
I can see that it might be too abstract for people coming from different
areas, sure. But, the question is who is able to provide such a tutorial
and also who has the time. It's always a trade-off in Open Source
projects like Jena - I guess most of the devs or other project related
people here are not getting payed, and clearly such a tutorial for most
if not all of the built-ins definitely needs some effort. Ideally, the
community could take over those things, but looks like nobody ever wrote
blog posts or tutorials about the Jena rule system and its built-ins.
>
>
>
> 1. Yes, I seem to understand difference is a no go but I was wondering if 
> there might be some work around coercing the dateTime to something else. I’m 
> not sure I understood that very well but it looks like I can’t use functions 
> in arguments of built-ins (so no xsd:year(?date) or whatever).
I don't think you can use functions or expressions from the SPARQL
engine resp. its XPath constructors. Both are totally different
implementations I guess - but again, I'm not a developer, so I can't
make a valid statement, except for looking into the code and the docs.
From my point of view, only the mentioned built-ins from the docs are
valid so far.
>
>
>
> But then, on greaterThan, something should be workable if I have 
> xsd:dateTime, no?
>
> What’s wrong with :
>
>
>
> [ruleMissedDeadline2:
>
> (?conference ns:hasDeadline ?date)
>
> now(?now)
>
> greaterThan(?now, ?date)
>
> ->
>
> (?conference ns:status ns:DeadlinePassed)
>
> ]

Well I was clearly thinking too complicated, so yes, your rule should
work given that the docs say

> lessThan(?x, ?y), greaterThan(?x, ?y)
> le(?x, ?y), ge(?x, ?y)
>
> Test if x is <, >, <= or >= y. Only passes if both x and y are numbers
> or time instants (can be integer or floating point or XSDDateTime).
I was more thinking about things like inferring the age of a person
isn't possible right now, but would clearly be some nice to have feature
such that you could have it as implicit fact in your KB without the need
to change the asserted data every year.

>
> 2. When you say extend the rule system, you mean adding a class using as a 
> starting point something is in ..rulesys.builtins and adapting it and then 
> rebuild all the jars. I’m using Fuseki, so I’d have to rebuild that too, 
> yeah? Aside from the fact I’m not coding in java, this isn’t the easiest path 
> for me at the moment.

That's also something I can't answer properly. I mean, yes, you can
create custom built-ins and register those or maybe create an overriding
registry [1] ? But not sure, it looks like at least the overriding
registry would have to be used by the rule parser, so I don't know how
you would have to combine it with Fuseki. And in the end, yes, you have
to repackage Fuseki I think as long as you modify the existing
BuiltinRegistry.

Maybe there is also some other kind of plugin system here, but that can
only be answered by Andy, Dave, Adam, etc.


[1] 
https://issues.apache.org/jira/browse/JENA-1204

>
> Many thanks,
> Pierre
>
>
> From: Lorenz B. [mailto:buehm...@informatik.uni-leipzig.de]
> Sent: 16 May 2019 08:33
> To: users@jena.apache.org
> Subject: Re: Documentation/tutorial on using dates in Jena rules with 
> GenericRuleReasoner
>
> I'm not aware of any tutorial, but afaik you can't do what you did here
> with SPARQL in Jena rules without writing custom built-ins or by
> extending the existing ones because:
>
> * the "difference" built-in does only work for numbers right now [1]
>
> * there is no support for duration type at all it looks like
>
>
> So, 

RE: Documentation/tutorial on using dates in Jena rules with GenericRuleReasoner

2019-05-16 Thread Pierre Grenon
Hi Lorenz,

Thank you for your answer.

Quick follow up.

I think the issue for me is the documentation of the built-ins is too abstract 
or relies on understanding the source code. So I suppose, documentation / 
tutorial seems somewhat superfluous when you can do that – only I can’t 
understand what’s there and the source at the moment.



1.  Yes, I seem to understand difference is a no go but I was wondering if 
there might be some work around coercing the dateTime to something else. I’m 
not sure I understood that very well but it looks like I can’t use functions in 
arguments of built-ins (so no xsd:year(?date) or whatever).



But then, on greaterThan, something should be workable if I have xsd:dateTime, 
no?

What’s wrong with :



[ruleMissedDeadline2:

(?conference ns:hasDeadline ?date)

now(?now)

greaterThan(?now, ?date)

->

(?conference ns:status ns:DeadlinePassed)

]

2. When you say extend the rule system, you mean adding a class using as a 
starting point something is in ..rulesys.builtins and adapting it and then 
rebuild all the jars. I’m using Fuseki, so I’d have to rebuild that too, yeah? 
Aside from the fact I’m not coding in java, this isn’t the easiest path for me 
at the moment.

Many thanks,
Pierre


From: Lorenz B. [mailto:buehm...@informatik.uni-leipzig.de]
Sent: 16 May 2019 08:33
To: users@jena.apache.org
Subject: Re: Documentation/tutorial on using dates in Jena rules with 
GenericRuleReasoner

I'm not aware of any tutorial, but afaik you can't do what you did here
with SPARQL in Jena rules without writing custom built-ins or by
extending the existing ones because:

* the "difference" built-in does only work for numbers right now [1]

* there is no support for duration type at all it looks like


So, so far you could only compare datetime values via lessThan, le,
greaterThan, ge but there is no other built-in with support for date
values so far. Others might indeed correct me if I'm wrong of.


It looks like, you have to extend the rule system by custom built-ins -
it's not that difficult though [2]

[1]
https://github.com/apache/jena/blob/master/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins/Difference.java#L68
[2] 
https://jena.apache.org/documentation/inference/#builtins

> Could people recommend a good reference/tutorial on how to use built-ins 
> (greaterThan, difference, now etc) with dates (e.g., datetime, duration and 
> so on) in rules for the GenericRuleReasoner?
>
> Example:
>
> Assume a KB of conferences with their deadlines as xsd:dateTime.
>
> Here are examples of SPARQL queries to find conferences whose deadlines are 
> passed:
>
> SELECT * WHERE {
> ?subject here:hasDeadline ?date .
> BIND((xsd:dateTime(?date) - now()) AS ?Span)
> FILTER(?Span < "P0D"^^xsd:duration)
> }
>
> SELECT * WHERE {
> ?subject here:hasDeadline ?date .
> FILTER(now() > xsd:dateTime(?date))
> }
>
> Suppose instead I wanted to infer some attribute of the conference, e.g:
>
> ?subject here:hasStatus here:DeadlinePassed
>
> I don't really get how to do that in a rule and I can't quite figure if I'm 
> misusing the built-ins or just mixing SPARQL and rule syntax (e.g., when 
> trying to coerce variables to datatypes).
>
> There's a bunch of recurring questions around that sort of rules but I can't 
> quite find any answer that's giving clear examples.
>
> Thus I would find it useful if anybody could point at a resource that goes 
> through some sort of how to do date comparison and use that in rules as the 
> Jena doc on built-in is not self-contained in that respect.
>
> https://jena.apache.org/documentation/inference/#rules
>
>
> With many thanks and kind regards,
> Pierre
>

--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEETINGS, THE 
FIRM'S EMPLOYEES MAY ON NO ACCOUNT BE IN RECEIPT OF INSIDE INFORMATION 
(AS DESCRIBED IN ARTICLE 7 OF THE MARKET ABUSE REGULATION (EU) NO 596/2014). 
(https://www.handbook.fca.org.uk/handbook/glossary/G3532m.html)
COMPANIES WHO DISCLOSE INSIDE INFORMATION ARE IN BREACH OF REGULATION 
AND MUST IMMEDIATELY AND CLEARLY NOTIFY ALL ATTENDEES. 

RE: Fuskei2 configuration, TDB2 data, Inferencing with ontologies, Persisting named graphs upon server restart

2019-02-19 Thread Pierre Grenon
Hey Andy,

Sorry I don’t mean to be agonisingly thick but I’m not sure I follow the 
conclusion and I don’t get how to modify the config file that I had attached 
for a TDB config.

I didn’t modify the data on disc model. I added a sparql update method to the 
inference model and I removed the explicit link to the union graph. I loaded in 
both data and inference models. I lost the ability to query without named 
graphs (so I have to use GRAPH) and the inference model wasn’t loaded with disc 
saved data when restarting.

To the question:

>> What is the prescribed way of keeping disc data and inference datasets in 
>> synch?

Your answer is two parts:

> Update via the inference model.

This means I keep two separate models, right? One in memory where I inference. 
One on disk where I just store data. But then they remain disconnected and I 
can’t initialise the inference model with the disk data in any case. Sorry I am 
a bit confused.

> Don't wire it to the union graph.

What does this mean? Will the default graph give me access to the union of 
graphs?

In the config file, do I entirely get rid of this or just the last clause?

>> # Intermediate graph referencing the default union graph
>> :g rdf:type tdb:GraphTDB ;
>> tdb:dataset :tdbDataset ;
>> tdb:graphName  ;
>> .

Thank you,
Pierre



From: Andy Seaborne [mailto:a...@apache.org]
Sent: 09 February 2019 17:53
To: users@jena.apache.org
Subject: Re: Fuskei2 configuration, TDB2 data, Inferencing with ontologies, 
Persisting named graphs upon server restart



On 04/02/2019 12:31, Pierre Grenon wrote:
> Hi,
>
> following up after going through my attempts more systematically again. I'm 
> trying to be as specific and clear as I can. Any feedback most appreciated.
>
> Many thanks,
> Pierre
>
> 1. It is possible to have a configuration file in which data is loaded into a 
> TDB and inferences are ran over this data. In this case:
>
> 1.a Data in named graphs created using SPARQL Update into a TDB dataset 
> persists upon restart.

Data must be loaded through the inference graph for the inferencer to
notice the change.

So the SPARQL updates can't create a new graph. Assemblers have a fixed
configuration.

(You could have one graph per database and upload new assemblers while
Fuseki is running..)

>
> 1.b Assertional data in these named graphs is immediately available to the 
> reasoning endpoint without server restart.
>
> 1.c Inference on data loaded using SPARQL Update requires restart of the 
> server after upload.
>
> 1.d CLEAR ALL in the TDB dataset endpoint requires server restart to have the 
> inference dataset emptied. (Queries to the reasoning endpoint for either 
> assertional or inferred data both return the same results as prior to 
> clearing the TDB dataset.)

Same general point - if you manipulate the database directly, the
inference code doesn't know a change has happened or what has changed.

> 2. TDB2 does not allow this --- or is it, at the moment only? As per OP in 
> this thread, the configuration adapted to TDB2 breaks. Based on Andy's 
> response, this may be caused by Bug Jena-1633. Would fixing the bug be enough 
> to allow for the configuration using TDB2?

JENA-1663.

> 3. Inference datasets do not synch with the underlying TDB(2) datasets (1.b 
> and 1.c in virtue of the in memory nature of inference models and the way 
> configuration files are handled as per Andy's and ajs6f 's responses).
>
> In view of this, however, 1.b is really weird.
>
> 4. Adding a service update method to the reasoning service does not seem to 
> allow updating the inference dataset. Sending SPARQL Update to the inference 
> endpoint does not result in either additional assertional or inferred data. 
> (Although, per 1.b, asserted data is returned when the SPARQL Update is sent 
> to the TDB endpoint.)

The base graph of the inference model is updated.

But you have that set to .

That applies to SPARQL query - the updates will have gone to the real
default graph but that is hidden by your setup.

>
>
> Question:
>
> What is the prescribed way of keeping disc data and inference datasets in 
> synch?

Update via the inference model.
Don't wire it to the union graph.

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN ACCORDANCE WITH MIFID II RULES ON INDUCEMENTS, THE FIRM'S EMPLOYEES 
MAY ATTEND CORPORATE ACCESS EVENTS (DEFINED IN THE FCA HANDBOOK AS 
"THE SERVICE OF ARRANGING OR BRINGING ABOUT CONTACT BETWEEN AN INVESTMENT 
MANAGER AND AN ISSUER OR POTENTIAL ISSUER"). DURING SUCH MEET

RE: Fuskei2 configuration, TDB2 data, Inferencing with ontologies, Persisting named graphs upon server restart

2019-02-04 Thread Pierre Grenon
Hi,

following up after going through my attempts more systematically again. I'm 
trying to be as specific and clear as I can. Any feedback most appreciated.

Many thanks,
Pierre

1. It is possible to have a configuration file in which data is loaded into a 
TDB and inferences are ran over this data. In this case:

1.a Data in named graphs created using SPARQL Update into a TDB dataset 
persists upon restart.

1.b Assertional data in these named graphs is immediately available to the 
reasoning endpoint without server restart.

1.c Inference on data loaded using SPARQL Update requires restart of the server 
after upload.

1.d CLEAR ALL in the TDB dataset endpoint requires server restart to have the 
inference dataset emptied. (Queries to the reasoning endpoint for either 
assertional or inferred data both return the same results as prior to clearing 
the TDB dataset.)

2. TDB2 does not allow this --- or is it, at the moment only? As per OP in this 
thread, the configuration adapted to TDB2 breaks. Based on Andy's response, 
this may be caused by Bug Jena-1633. Would fixing the bug be enough to allow 
for the configuration using TDB2?

3. Inference datasets do not synch with the underlying TDB(2) datasets (1.b and 
1.c in virtue of the in memory nature of inference models and the way 
configuration files are handled as per Andy's and ajs6f 's responses).

In view of this, however, 1.b is really weird.

4. Adding a service update method to the reasoning service does not seem to 
allow updating the inference dataset. Sending SPARQL Update to the inference 
endpoint does not result in either additional assertional or inferred data. 
(Although, per 1.b, asserted data is returned when the SPARQL Update is sent to 
the TDB endpoint.)


Question:

What is the prescribed way of keeping disc data and inference datasets in synch?

Is it:

P1 - upon SPARQL Update to disc data, restart server (and reinitialise 
inference dataset)?
This makes it difficult to manage successive updates, especially when there may 
be dependencies between states them, e.g., in in order to make update 2 I need 
to have done update 1, I need to restart after update 1.

Given that TDB only works at the moment, what is the 'transactional' meaning of 
having to do this?

P2 - upon SPARQL Update to disc data, SPARQL Update inference dataset. Is it 
possible to update the inference dataset? In that case, is it possible to 
guarantee that the two datasets are in synch? Does TDB versus TDB2 matter?

5. Not for self that property chains are not supported by the OWLFBReasoner.


# TDB Configuration
# From:

https://stackoverflow.com/questions/47568703/named-graphs-v-default-graph-behaviour-in-apache-jena-fuseki
@prefix :  <http://base/#> .
@prefix tdb:   <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ja:<http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

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


# Service 1: Dataset endpoint (no reasoning)
:dataService a fuseki:Service ;
  fuseki:name   "tdbEnpointTDBB" ;
  fuseki:serviceQuery   "sparql", "query" ;
  fuseki:serviceUpdate  "update" ;
  fuseki:dataset:tdbDataset ;
.

# Service 2: Reasoning endpoint
:reasoningService a fuseki:Service ;
  fuseki:dataset :infDataset ;
  fuseki:name"reasoningEndpointTDBB" ;
  fuseki:serviceQuery"query", "sparql" ;
  fuseki:serviceReadGraphStore   "get" ;
.

# Inference dataset
:infDataset rdf:type ja:RDFDataset ;
ja:defaultGraph :infModel ;
.

# Inference model
:infModel a ja:InfModel ;
   ja:baseModel :g ;

   ja:reasoner [
  ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner> ;
   ] ;
.

# Intermediate graph referencing the default union graph
:g rdf:type tdb:GraphTDB ;
   tdb:dataset :tdbDataset ;
   tdb:graphName  ;
.

# The location of the TDB dataset
:tdbDataset rdf:type tdb:DatasetTDB ;
tdb:location  "C:\\dev\\apache-jena-fuseki-3.8.0\\run/databases/tdbB" ;
tdb:unionDefaultGraph true ;
.

From: Pierre Grenon
Sent: 01 February 2019 15:07
To: 'users@jena.apache.org'
Subject: RE: Fuskei2 configuration, TDB2 data, Inferencing with ontologies, 
Persisting named graphs upon server restart


I'll address you two, fine gentlemen, at once if that's OK.

> On 31/01/2019 17:57, ajs6f wrote:
>>> 2/ It is not possible in an assembler/Fuseki configuration file, to create 
>>> a new named graph and have a another inference graph put around that new 
>>> graph at runtime.
>>
>> Just to pull on one of these threads, my understand

RE: Fuskei2 configuration, TDB2 data, Inferencing with ontologies, Persisting named graphs upon server restart

2019-02-01 Thread Pierre Grenon
Hi Andy,

picking up the prefatory questions first, in line below.

> Hi Pierre,
>
> A few points to start with:
>
> 1/ For my general understanding of how we might take the inferene
> provision further in jena, what inferences are you particularly
> interested in?

I noticed you like to ask :) I'm not sure what level of details is useful so 
it'd probably be more informative to have some sort of sticky thread about that 
or a poll if you know how to categorise what would be useful to know.

In the present context, ANY inference is good over writing specific SPARQL look 
up queries.

The present context is:
- a few small OWL ontologies where the most complicated axioms are various 
class restrictions and property chains
- some amount of rather qualitative data (pizzas and toppings kind of things) 
with a lot of n-ary relations reification and where basic ontology traversal 
combining predicate composition and transitivity is useful
- some large amount of quantitative data for which the main problems are i) 
navigating reified relations and ii) aggregating quantities but I'm not sure 
that second use case is inferencing rather than some form of computation
- some pervasive reliance on labels with queries where some variables are labels
- a lot of the data is temporal too (one of the reasons for reification and for 
named graphs)

So as a first answer, in this context, at this stage, transitivity and RDFS 
type of inference are a very minimum. (Although, rdfs:domain type of inference 
is not really desired because these are better interpreted as constraints and 
SHACL might be preferred for handling this.) This bare minimum is just to be 
able to query with a hierarchy of predicates, for example. Another typical use 
case is class instantiation and subsumption (so again, rdfs:subPropertyOf and 
rdfs:subClassOf being transitive...) This is usually not enough and OWL 
property chains are useful.

At another stage, backward and/or forward rules but I don't have clear use 
cases in mind at this point in this context.


> 2/ It is not possible in an assembler/Fuseki configuration file, to
> create a new named graph and have a another inference graph put around
> that new graph at runtime.

I will follow up on this further down the threads.

> 3/ The union graph can't be updated. It's a read-only union.

I'm not sure what this means. It can't add new graphs to the union?
Also more below re. Attempt 1 question.

> 4/ "ERROR Exception in initialization: caught: Not in tramsaction"
> Do you have the stacktrace for this?

I saw you found it -- yes, typo, sorry, I typed the error message before 
pasting the whole trace.

Noted the bug. Not sure that would make the config do it's intended job though.


> Inline questions about attempt 1.
>
> Andy

<...>

> > Outcome: This allows me to load data into named graphs and to perform 
> > inferemce. However, it does not persist upon restarting the server.
>
> Did you enable tdb:unionDefaultGraph as well, load the named graph and
the access the union?

Here I might be confused. Documentation says to either use union graph or 
update but not both, is that because of the static character of the union 
graph? I haven't realised that there is any issue having both, i.e., have an 
update service where the TDB2 dataset is defaultUnionGraph true.

I *think* I tried both. I'm not sure it changed anything to the behaviour I was 
trying to check (i.e., persistence of named graphs created with SPARQL update).

My basic process is:

1. Terminal$ fuseki-server
2. Run bunch of: LOAD  INTO 
3. Query triples in union graph or {GRAPH  {?i ?like ?trains}}.
4. Terminal$ CTRL+C CTRL+C Y
5. Terminal$ fuseki-server
6. Query triples in union graph or {GRAPH  {?i ?like ?trains}}.


> What isn't persisted? Inferences or base data?

This is about the data stored in the named graph during 2.

When I have a single TDB2 dataset with no inference engine in my configuration 
file:
3 succeeds and 6 succeeds

The data is persisted, including in named graphs.

When I also have a set up for an inference engine in my configuration file,
3 succeeds and 6 fails.

I'm not entirely sure I managed to explain myself very clearly. But hope this 
helps.

Also, I will probably try to redo everything I have done to better address your 
questions. I will follow up down the thread on 2/ as I think some clarity is 
needed on the named graphs. I have tried naming graphs in the configuration 
file but this didn't seem to help, however, I think I wasn't linking to the 
inference model. SO I'll follow up on this and try to provide clear config 
examples for that.

With many thanks and kind regards,
Pierre

THIS E-MAIL MAY CONTAIN CONFIDENTIAL AND/OR PRIVILEGED INFORMATION. 
IF YOU ARE NOT THE INTENDED RECIPIENT (OR HAVE RECEIVED THIS E-MAIL 
IN ERROR) PLEASE NOTIFY THE SENDER IMMEDIATELY AND DESTROY THIS 
E-MAIL. ANY UNAUTHORISED COPYING, DISCLOSURE OR DISTRIBUTION OF THE 
MATERIAL IN THIS E-MAIL IS STRICTLY FORBIDDEN. 

IN 

Fuskei2 configuration, TDB2 data, Inferencing with ontologies, Persisting named graphs upon server restart

2019-01-31 Thread Pierre Grenon
Hello,

I am trying to:

Set up Fuseki2 with inference and a TDB2 dataset in which can be persisted 
named graphs created with SPARQL Update.

This is in order to:
- maintain a set of ontologies in a named graph
- maintain datasets in a number of named graphs
- perform reasoning in the union graphs
The assumption is that all data is persisted in a given TDB2 database.

The higher purpose is to use reasoning over ontologies when querying over 
instance data located in named graphs. I think this is conceptually what is 
discussed here:
Subject Re: Ontologies and model data
Date  Mon, 03 Jun 2013 20:26:18 GMT
http://mail-archives.apache.org/mod_mbox/jena-users/201306.mbox/%3c51acfbea.2010...@apache.org%3E

The set up above is what comes across as a way of achieving this higher goal 
but I am not sure either that it is the best set up. Everything I have tried to 
do allows me to either perform inferences in  or to 
persist triples in named graphs in a TDB2 database, but not both.


My problem is:

I cannot find a correct configuration that allows me to persist named graphs 
added to a TDB2 dataset and have inference at the same time.

Some attempts are documented below.

I have done most of my test in apache-jena-fuseki-3.8.0, my last tries were in 
apache-jena-fuseki-3.10.0.
Would somebody be in a position to advise or provide a minimal working example?

With many thanks and best regards,
Pierre


###
Attempt 1:

# Example of a data service with SPARQL query abnd update on an
# inference model.  Data is taken from TDB.
https://github.com/apache/jena/blob/master/jena-fuseki2/examples/service-inference-2.ttl
which I have adapted to use TDB2 (which basically meant updating the namespace 
and the references to classes).

Outcome: This allows me to load data into named graphs and to perform 
inferemce. However, it does not persist upon restarting the server.


###
Attempt 2:

Define two services pointing to different graphs as advised in
Subject Re: Persisting named graphs in TDB with jena-fuseki
Date  Thu, 10 Mar 2016 14:47:10 GMT
http://mail-archives.apache.org/mod_mbox/jena-users/201603.mbox/%3cd30738c0.64a6f%25rve...@dotnetrdf.org%3E

Outcome: I could only manage de3fining two independent services on two 
independent datasets and couldn't figure out how to link the TDB2 and the 
Inference graphs.

A reference to https://issues.apache.org/jira/browse/JENA-1122
is made in
http://mail-archives.apache.org/mod_mbox/jena-users/201603.mbox/%3c56ec23e3.9010...@apache.org%3E
But I do not understand what is said here.


###
Attempt 3:

I have found a config that seemed t make the link that was needed between 
graphs in Attempt 2 in:
https://stackoverflow.com/questions/47568703/named-graphs-v-default-graph-behaviour-in-apache-jena-fuseki
which I have adapted to TDB2.

However, this gives me:
ERROR Exception in initialization: caught: Not in tramsaction

This also seems to have been a cut off point in the thread mentioned above
Subject Re: Configuring fuseki with TDB2 and OWL reasoning
Date  Tue, 20 Feb 2018 10:55:13 GMT
http://mail-archives.apache.org/mod_mbox/jena-users/201802.mbox/%3C6d37a8c7-aca1-4c1c-0cd3-fa041ecc07eb%40apache.org%3E

This message refers to https://issues.apache.org/jira/browse/JENA-1492
which I do not understand but that comes across as having been resolved. 
Indeed, I tested the config attached to it (probably as minimal example for 
that issue) and it worked, but I don't think this is the config I need.



 ATTEMPT 3 Config

@prefix :   .
@prefix tdb2:   .
@prefix rdf:    .
@prefix ja: .
@prefix rdfs:   .
@prefix fuseki:  .

# TDB2
#tdb2:DatasetTDB2 rdfs:subClassOf  ja:RDFDataset .
#tdb2:GraphTDBrdfs:subClassOf  ja:Model .

# Service 1: Dataset endpoint (no reasoning)
:dataService a fuseki:Service ;
  fuseki:name   "tdbEnpoint" ;
  fuseki:serviceQuery   "sparql", "query" ;
  fuseki:serviceUpdate  "update" ;
  fuseki:dataset:tdbDataset ;
.

# Service 2: Reasoning endpoint
:reasoningService a fuseki:Service ;
  fuseki:dataset :infDataset ;
  fuseki:name"reasoningEndpoint" ;
  fuseki:serviceQuery"query", "sparql" ;
  fuseki:serviceReadGraphStore   "get" ;
.

# Inference dataset
:infDataset rdf:type ja:RDFDataset ;
ja:defaultGraph :infModel ;
.

# Inference model
:infModel a ja:InfModel ;
   ja:baseModel :g ;

   ja:reasoner [
  ja:reasonerURL  ;
   ] ;
.

# Intermediate graph referencing the default union graph
:g rdf:type tdb2:GraphTDB ;
   tdb2:dataset :tdbDataset ;
   tdb2:graphName  ;
.

# The location of the TDB dataset
:tdbDataset rdf:type tdb2:DatasetTDB2 ;
   tdb2:location