You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Lewis John Mcgibbney <le...@gmail.com> on 2013/08/02 01:58:56 UTC

Re: Backing code for Fuseki *.html

Hi Andy,
On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne <an...@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

Re: Backing code for Fuseki *.html

Posted by Andy Seaborne <an...@apache.org>.
On 02/08/13 00:58, Lewis John Mcgibbney wrote:
> Hi Andy,
> On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne <an...@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

Posted by Lewis John Mcgibbney <le...@gmail.com>.
Stepping through this was very very helpful.
Thanks Claude.
Lewis


On Thu, Aug 1, 2013 at 11:37 PM, Claude Warren <cl...@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 ;
>             Map<String, Object> data = new HashMap<String, 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.mcgibbney@gmail.com> wrote:
>
> > Hi Andy,
> > On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne <an...@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?claude@xenei.com
> LinkedIn: http://www.linkedin.com/in/claudewarren
>



-- 
*Lewis*

Re: Backing code for Fuseki *.html

Posted by Lewis John Mcgibbney <le...@gmail.com>.
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 <cl...@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 ;
>             Map<String, Object> data = new HashMap<String, 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.mcgibbney@gmail.com> wrote:
>
>> Hi Andy,
>> On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne <an...@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?claude@xenei.com
> LinkedIn: http://www.linkedin.com/in/claudewarren
>

-- 
*Lewis*

Re: Backing code for Fuseki *.html

Posted by Claude Warren <cl...@xenei.com>.
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 ;
            Map<String, Object> data = new HashMap<String, 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.mcgibbney@gmail.com> wrote:

> Hi Andy,
> On Wed, Jul 24, 2013 at 12:32 AM, Andy Seaborne <an...@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?claude@xenei.com
LinkedIn: http://www.linkedin.com/in/claudewarren