Re: Backing code for Fuseki *.html
Stepping through this was very very helpful. Thanks Claude. Lewis On Thu, Aug 1, 2013 at 11:37 PM, Claude Warren cla...@xenei.com wrote: Lewis, It has been awhile since I was in this part of the code base but in the tpl you will find: [snip] #set( $ds = $mgt.dataset($request, ) ) #set( $srvQuery = $mgt.serviceQuery($ds) ) [snip] form action=${ds}/${srvQuery} method=GET accept-charset=UTF-8 [snip] so when the form is submitted it will call whatever the dataset serviceQuery url is. The SPARQLServer.java contains the code that configures the server. Without knowing what changes you have made to your configuration the rest of this gets a bit difficult, but I will attempt to follow the standard flow. in org.apache.jena.fuseki.server.SPARQLServer.builderServer() at approx line 238 (I'm looking at v 2.10.2-SNAPSHOT) [snip] if ( installManager || installServices ) { // TODO Respect port. if ( serverConfig.pagesPort != serverConfig.port ) serverLog.warn(Not supported yet - pages on a different port to services) ; String base = serverConfig.pages ; MapString, Object data = new HashMapString, Object() ; data.put(mgt, new MgtFunctions()) ; SimpleVelocityServlet templateEngine = new SimpleVelocityServlet(base, data) ; addServlet(context, templateEngine, *.tpl, false) ; } [snip] This codes provides the mgt variable ($mgt above) in the tpl file. All *.tpl flow through the templateEngine servlet. At line approx line 320 you will find [snip] HttpServlet sparqlQuery = new SPARQL_QueryDataset() ; HttpServlet sparqlUpdate = new SPARQL_Update() ; HttpServlet sparqlUpload = new SPARQL_Upload() ; HttpServlet sparqlHttpR = new SPARQL_REST_R() ; HttpServlet sparqlHttpRW = new SPARQL_REST_RW() ; HttpServlet sparqlDataset = new SPARQL_UberServlet.AccessByConfig() ; if ( !überServlet ) { // If uberserver, these are unnecessary but can be used. // If just means the überservlet isn't handling these operations. addServlet(context, datasetPath, sparqlQuery, dsDesc.query, enableCompression) ; addServlet(context, datasetPath, sparqlUpdate, dsDesc.update, false) ; addServlet(context, datasetPath, sparqlUpload, dsDesc.upload, false) ; // No point - no results of any size. addServlet(context, datasetPath, sparqlHttpR, dsDesc.readGraphStore, enableCompression) ; addServlet(context, datasetPath, sparqlHttpRW, dsDesc.readWriteGraphStore, enableCompression) ; // This adds direct operations on the dataset itself. // addServlet(context, datasetPath, sparqlDataset, // ListOfEmptyString, enableCompression) ; } else { [snip] This is where the sparqlQuery servlet is registered to handle the general /{dataset}/sparql endpoint. in org.apache.jena.fuseki.servlets.SPARQL_QueryDataset at approx line 44 is the method decideDataset(). That method should be called when fuseki attempts to match the query with the dataset you want to query. A breakpoint in that method should get you into the code that is executing. Hope this helps, Claude On Fri, Aug 2, 2013 at 12:58 AM, Lewis John Mcgibbney lewis.mcgibb...@gmail.com wrote: Hi Andy, On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne a...@apache.org wrote: Also I've never worked with .tpl files before... they look similar but I am not familiar... .tpl files are Velocity files. I decided to hide the technology used by calling them tpl not vm in case it changes. I have the feeling that I need to edit the velocity file (.tpl) as well as the .html if I want to add modify the query form. Can you confirm if this is the case. I am trying to follow my query through from form submission to execution of the Java code within the Fuseki servlets... right now this is not happening for me. Any guidance on how I can get dug in here would be great. It would also make my life that little bit easier... oh and my upcoming weekend (what weekend!!!) that little bit easier :0) Thank you v much. Lewis -- I like: Like Like - The likeliest place on the web http://like-like.xenei.com Identity: https://www.identify.nu/user.php?cla...@xenei.com LinkedIn: http://www.linkedin.com/in/claudewarren -- *Lewis*
Re: Backing code for Fuseki *.html
Lewis, It has been awhile since I was in this part of the code base but in the tpl you will find: [snip] #set( $ds = $mgt.dataset($request, ) ) #set( $srvQuery = $mgt.serviceQuery($ds) ) [snip] form action=${ds}/${srvQuery} method=GET accept-charset=UTF-8 [snip] so when the form is submitted it will call whatever the dataset serviceQuery url is. The SPARQLServer.java contains the code that configures the server. Without knowing what changes you have made to your configuration the rest of this gets a bit difficult, but I will attempt to follow the standard flow. in org.apache.jena.fuseki.server.SPARQLServer.builderServer() at approx line 238 (I'm looking at v 2.10.2-SNAPSHOT) [snip] if ( installManager || installServices ) { // TODO Respect port. if ( serverConfig.pagesPort != serverConfig.port ) serverLog.warn(Not supported yet - pages on a different port to services) ; String base = serverConfig.pages ; MapString, Object data = new HashMapString, Object() ; data.put(mgt, new MgtFunctions()) ; SimpleVelocityServlet templateEngine = new SimpleVelocityServlet(base, data) ; addServlet(context, templateEngine, *.tpl, false) ; } [snip] This codes provides the mgt variable ($mgt above) in the tpl file. All *.tpl flow through the templateEngine servlet. At line approx line 320 you will find [snip] HttpServlet sparqlQuery = new SPARQL_QueryDataset() ; HttpServlet sparqlUpdate = new SPARQL_Update() ; HttpServlet sparqlUpload = new SPARQL_Upload() ; HttpServlet sparqlHttpR = new SPARQL_REST_R() ; HttpServlet sparqlHttpRW = new SPARQL_REST_RW() ; HttpServlet sparqlDataset = new SPARQL_UberServlet.AccessByConfig() ; if ( !überServlet ) { // If uberserver, these are unnecessary but can be used. // If just means the überservlet isn't handling these operations. addServlet(context, datasetPath, sparqlQuery, dsDesc.query, enableCompression) ; addServlet(context, datasetPath, sparqlUpdate, dsDesc.update, false) ; addServlet(context, datasetPath, sparqlUpload, dsDesc.upload, false) ; // No point - no results of any size. addServlet(context, datasetPath, sparqlHttpR, dsDesc.readGraphStore, enableCompression) ; addServlet(context, datasetPath, sparqlHttpRW, dsDesc.readWriteGraphStore, enableCompression) ; // This adds direct operations on the dataset itself. // addServlet(context, datasetPath, sparqlDataset, // ListOfEmptyString, enableCompression) ; } else { [snip] This is where the sparqlQuery servlet is registered to handle the general /{dataset}/sparql endpoint. in org.apache.jena.fuseki.servlets.SPARQL_QueryDataset at approx line 44 is the method decideDataset(). That method should be called when fuseki attempts to match the query with the dataset you want to query. A breakpoint in that method should get you into the code that is executing. Hope this helps, Claude On Fri, Aug 2, 2013 at 12:58 AM, Lewis John Mcgibbney lewis.mcgibb...@gmail.com wrote: Hi Andy, On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne a...@apache.org wrote: Also I've never worked with .tpl files before... they look similar but I am not familiar... .tpl files are Velocity files. I decided to hide the technology used by calling them tpl not vm in case it changes. I have the feeling that I need to edit the velocity file (.tpl) as well as the .html if I want to add modify the query form. Can you confirm if this is the case. I am trying to follow my query through from form submission to execution of the Java code within the Fuseki servlets... right now this is not happening for me. Any guidance on how I can get dug in here would be great. It would also make my life that little bit easier... oh and my upcoming weekend (what weekend!!!) that little bit easier :0) Thank you v much. Lewis -- I like: Like Like - The likeliest place on the webhttp://like-like.xenei.com Identity: https://www.identify.nu/user.php?cla...@xenei.com LinkedIn: http://www.linkedin.com/in/claudewarren
Re: Backing code for Fuseki *.html
Hi Claude, Thank you v much for taking time to source and explain this through to me. It is pretty late and I am going to pick it up tomorrow. I'll most likely post back then. Thanks Lewis On Thursday, August 1, 2013, Claude Warren cla...@xenei.com wrote: Lewis, It has been awhile since I was in this part of the code base but in the tpl you will find: [snip] #set( $ds = $mgt.dataset($request, ) ) #set( $srvQuery = $mgt.serviceQuery($ds) ) [snip] form action=${ds}/${srvQuery} method=GET accept-charset=UTF-8 [snip] so when the form is submitted it will call whatever the dataset serviceQuery url is. The SPARQLServer.java contains the code that configures the server. Without knowing what changes you have made to your configuration the rest of this gets a bit difficult, but I will attempt to follow the standard flow. in org.apache.jena.fuseki.server.SPARQLServer.builderServer() at approx line 238 (I'm looking at v 2.10.2-SNAPSHOT) [snip] if ( installManager || installServices ) { // TODO Respect port. if ( serverConfig.pagesPort != serverConfig.port ) serverLog.warn(Not supported yet - pages on a different port to services) ; String base = serverConfig.pages ; MapString, Object data = new HashMapString, Object() ; data.put(mgt, new MgtFunctions()) ; SimpleVelocityServlet templateEngine = new SimpleVelocityServlet(base, data) ; addServlet(context, templateEngine, *.tpl, false) ; } [snip] This codes provides the mgt variable ($mgt above) in the tpl file. All *.tpl flow through the templateEngine servlet. At line approx line 320 you will find [snip] HttpServlet sparqlQuery = new SPARQL_QueryDataset() ; HttpServlet sparqlUpdate = new SPARQL_Update() ; HttpServlet sparqlUpload = new SPARQL_Upload() ; HttpServlet sparqlHttpR = new SPARQL_REST_R() ; HttpServlet sparqlHttpRW = new SPARQL_REST_RW() ; HttpServlet sparqlDataset = new SPARQL_UberServlet.AccessByConfig() ; if ( !überServlet ) { // If uberserver, these are unnecessary but can be used. // If just means the überservlet isn't handling these operations. addServlet(context, datasetPath, sparqlQuery, dsDesc.query, enableCompression) ; addServlet(context, datasetPath, sparqlUpdate, dsDesc.update, false) ; addServlet(context, datasetPath, sparqlUpload, dsDesc.upload, false) ; // No point - no results of any size. addServlet(context, datasetPath, sparqlHttpR, dsDesc.readGraphStore, enableCompression) ; addServlet(context, datasetPath, sparqlHttpRW, dsDesc.readWriteGraphStore, enableCompression) ; // This adds direct operations on the dataset itself. // addServlet(context, datasetPath, sparqlDataset, // ListOfEmptyString, enableCompression) ; } else { [snip] This is where the sparqlQuery servlet is registered to handle the general /{dataset}/sparql endpoint. in org.apache.jena.fuseki.servlets.SPARQL_QueryDataset at approx line 44 is the method decideDataset(). That method should be called when fuseki attempts to match the query with the dataset you want to query. A breakpoint in that method should get you into the code that is executing. Hope this helps, Claude On Fri, Aug 2, 2013 at 12:58 AM, Lewis John Mcgibbney lewis.mcgibb...@gmail.com wrote: Hi Andy, On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne a...@apache.org wrote: Also I've never worked with .tpl files before... they look similar but I am not familiar... .tpl files are Velocity files. I decided to hide the technology used by calling them tpl not vm in case it changes. I have the feeling that I need to edit the velocity file (.tpl) as well as the .html if I want to add modify the query form. Can you confirm if this is the case. I am trying to follow my query through from form submission to execution of the Java code within the Fuseki servlets... right now this is not happening for me. Any guidance on how I can get dug in here would be great. It would also make my life that little bit easier... oh and my upcoming weekend (what weekend!!!) that little bit easier :0) Thank you v much. Lewis -- I like: Like Like - The likeliest place on the web http://like-like.xenei.com Identity: https://www.identify.nu/user.php?cla...@xenei.com LinkedIn: http://www.linkedin.com/in/claudewarren -- *Lewis*
Re: Backing code for Fuseki *.html
On 02/08/13 00:58, Lewis John Mcgibbney wrote: Hi Andy, On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne a...@apache.org wrote: Also I've never worked with .tpl files before... they look similar but I am not familiar... .tpl files are Velocity files. I decided to hide the technology used by calling them tpl not vm in case it changes. I have the feeling that I need to edit the velocity file (.tpl) as well as the .html if I want to add modify the query form. Can you confirm if this is the case. I am trying to follow my query through from form submission to execution of the Java code within the Fuseki servlets... right now this is not happening for me. Any guidance on how I can get dug in here would be great. It would also make my life that little bit easier... oh and my upcoming weekend (what weekend!!!) that little bit easier :0) Thank you v much. Lewis sparql.html is the general purpose (you gave to give it the data via FROM etc or via the protocol) sparql.tpl is a SPARQL query over the current dataset. Different entry points. I debug by running under Eclipse and break pointing the perform() method of the servlet. I just run the server by calling main() from java: FusekiCmd.main(...) ; Andy
Re: Backing code for Fuseki *.html
On 24/07/13 02:36, Lewis John Mcgibbney wrote: Hi All, I'm utilizing the Fuseki source [0] to build an application enabling access to my triples data. Can someone please explain to me how queries are sent to the server please? SPARQL protocol. http://www.w3.org/TR/sparql11-protocol/ which can be driven from an HTML form. GET /yourendpoint?query=encodedQuery Looking at the source in sparql.html [1] I am struggling to see what code is called to initiative queries? form action=sparql method=get ... textarea name=query cols=70 rows=20/textarea ... form causes GET /sparql?query=... to be sent. See also SOH: http://jena.apache.org/documentation/serving_data/index.html#sparql-over-http and jeva library code in ARQ. Can someone please explain this to me please? Also I've never worked with .tpl files before... they look similar but I am not familiar... .tpl files are Velocity files. I decided to hide the technology used by calling them tpl not vm in case it changes. Andy Thank you very much in advance. Best Lewis [0] http://svn.apache.org/repos/asf/jena/trunk/jena-fuseki/ [1] http://svn.apache.org/repos/asf/jena/trunk/jena-fuseki/pages/sparql.html
Re: Backing code for Fuseki *.html
Thank you very much Andy. As always, thank you. Best Lewis On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne a...@apache.org wrote: On 24/07/13 02:36, Lewis John Mcgibbney wrote: Hi All, I'm utilizing the Fuseki source [0] to build an application enabling access to my triples data. Can someone please explain to me how queries are sent to the server please? SPARQL protocol. http://www.w3.org/TR/sparql11-**protocol/http://www.w3.org/TR/sparql11-protocol/ which can be driven from an HTML form. GET /yourendpoint?query=**encodedQuery Looking at the source in sparql.html [1] I am struggling to see what code is called to initiative queries? form action=sparql method=get ... textarea name=query cols=70 rows=20/textarea ... form causes GET /sparql?query=... to be sent. See also SOH: http://jena.apache.org/**documentation/serving_data/** index.html#sparql-over-httphttp://jena.apache.org/documentation/serving_data/index.html#sparql-over-http and jeva library code in ARQ. Can someone please explain this to me please? Also I've never worked with .tpl files before... they look similar but I am not familiar... .tpl files are Velocity files. I decided to hide the technology used by calling them tpl not vm in case it changes. Andy Thank you very much in advance. Best Lewis [0] http://svn.apache.org/repos/**asf/jena/trunk/jena-fuseki/http://svn.apache.org/repos/asf/jena/trunk/jena-fuseki/ [1] http://svn.apache.org/repos/**asf/jena/trunk/jena-fuseki/** pages/sparql.htmlhttp://svn.apache.org/repos/asf/jena/trunk/jena-fuseki/pages/sparql.html -- *Lewis*