RESTXQ and Website-Building
Thursday, 7 April 2016 · 15 messages · last reply 12 Apr 2016
GD
Günter Dunz-Wolff7 Apr 2016 17:08 #
Hi,
I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now.
I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have:
1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ?
2. Is there any site-structure preferred?
3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)?
Thanks for any advice and help.
Günter
CG
Christian Grün7 Apr 2016 17:55 #
Hi Günter,
This is just a quick reply, but you could have a look at the DBA XQuery code embedded with BaseX. Here, similar problems have been resolved: All pages have the same layout, static files are served as well, etc.
Feel free to ask if you need some more help with the code. It’s definitely not perfect; for example, the function-based generation of buttons, tables, etc. is just one of many options, and I am convinced there should be better alternatives.
Christian
Quoted text · Günter Dunz-Wolff · 17 lines
On Thu, Apr 7, 2016 at 5:08 PM, Günter Dunz-Wolff <kleist at mail.dunzwolff.de> wrote: > Hi, > > I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. > > I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: > > 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? > > 2. Is there any site-structure preferred? > > 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? > > Thanks for any advice and help. > > Günter
ML
Hi Günter,
we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content.
One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules.
The modules are called through the xquery:invoke function in order to "explode" their output into the main page.
In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach.
Ciao,
Marco.
Quoted text · Günter Dunz-Wolff · 16 lines
On 07/04/2016 17:08, Günter Dunz-Wolff wrote: > Hi, > > I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. > > I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: > > 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? > > 2. Is there any site-structure preferred? > > 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? > > Thanks for any advice and help. > > Günter
GD
Günter Dunz-Wolff8 Apr 2016 11:50 #
Hi Marco,
your approach sounds great. It would be a very, very great help, to see some snippets :-) so the picture becomes more clear for me.
Ciao,
Günter
P.S.: Sorry for the second email, I didn't send it to the mailing-list
Quoted text · Marco Lettere · 33 lines
> >> Am 08.04.2016 um 09:13 schrieb Marco Lettere <m.lettere at gmail.com>: >> >> Hi Günter, >> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >> >> Ciao, >> Marco. >> >> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>> Hi, >>> >>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>> >>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>> >>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>> >>> 2. Is there any site-structure preferred? >>> >>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>> >>> Thanks for any advice and help. >>> >>> Günter >> >> >
GD
Günter Dunz-Wolff8 Apr 2016 11:53 #
Hi Christian,
thanks for the tipp. I haven't noticed the files so far at all. I will have a closer look and I think a lot of questions :)
Günter
P.S.: Sorry for the second email, I didn't send it to the list.
Quoted text · Günter Dunz-Wolff · 39 lines
> > > >> Am 07.04.2016 um 17:55 schrieb Christian Grün <christian.gruen at gmail.com>: >> >> Hi Günter, >> >> This is just a quick reply, but you could have a look at the DBA >> XQuery code embedded with BaseX. Here, similar problems have been >> resolved: All pages have the same layout, static files are served as >> well, etc. >> >> Feel free to ask if you need some more help with the code. It’s >> definitely not perfect; for example, the function-based generation of >> buttons, tables, etc. is just one of many options, and I am convinced >> there should be better alternatives. >> >> Christian >> >> >> On Thu, Apr 7, 2016 at 5:08 PM, Günter Dunz-Wolff >> <kleist at mail.dunzwolff.de> wrote: >>> Hi, >>> >>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>> >>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>> >>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>> >>> 2. Is there any site-structure preferred? >>> >>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>> >>> Thanks for any advice and help. >>> >>> Günter >> >
K
Hi Marco,
it’s me again. Just to be more specific, I’m especially interested in your approach
- to pass parametric values into the „exploded“ modules
- to map requests to module invocations by exploiting REST path segments
It would be really helpful, to get some snippets of your code. Tanks a lot.
Ciao, Günter
Quoted text · Marco Lettere · 31 lines
> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: > > Hi Günter, > we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. > One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. > The modules are called through the xquery:invoke function in order to "explode" their output into the main page. > In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. > Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. > I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. > > Ciao, > Marco. > > On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >> Hi, >> >> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >> >> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >> >> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >> >> 2. Is there any site-structure preferred? >> >> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >> >> Thanks for any advice and help. >> >> Günter > >
ML
Marco Lettere10 Apr 2016 21:36 #
Hi Günter,
sorry for the delay but here you go with a very small example that should show off what I told.
You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. Then invoke the "entrypoint" RestXQ from within your browser with an url similar to
http://localhost:8984/myapp/page1?user=Marco
As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not.
Then a common header markup is generated and finally a dynamic part that depends on the page element of the path.
It's really not anything special but nevertheless it should be useful in clarifying the approach.
Hoffe es gefaellt dir.
Herzliche Gruesse,
Marco.
Quoted text · Günter Dunz-Wolff · 41 lines
On 10/04/2016 17:36, Günter Dunz-Wolff wrote: > Hi Marco, > > it’s me again. Just to be more specific, I’m especially interested in your approach > - to pass parametric values into the „exploded“ modules > - to map requests to module invocations by exploiting REST path segments > > It would be really helpful, to get some snippets of your code. Tanks a lot. > > Ciao, Günter > >> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >> >> Hi Günter, >> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >> >> Ciao, >> Marco. >> >> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>> Hi, >>> >>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>> >>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>> >>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>> >>> 2. Is there any site-structure preferred? >>> >>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>> >>> Thanks for any advice and help. >>> >>> Günter >>
K
kleist-digital11 Apr 2016 10:08 #
Hi Marco,
thanks a lot for the snippets. They are in deed clarifying your approach. I’m running some first tests and everything goes fine. Thanks again.
Günter
Quoted text · Marco Lettere · 61 lines
> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: > > Hi Günter, > sorry for the delay but here you go with a very small example that should show off what I told. > You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. > Then invoke the "entrypoint" RestXQ from within your browser with an url similar to > > http://localhost:8984/myapp/page1?user=Marco > > As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. > Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. > > It's really not anything special but nevertheless it should be useful in clarifying the approach. > > Hoffe es gefaellt dir. > Herzliche Gruesse, > Marco. > > On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >> Hi Marco, >> >> it’s me again. Just to be more specific, I’m especially interested in your approach >> - to pass parametric values into the „exploded“ modules >> - to map requests to module invocations by exploiting REST path segments >> >> It would be really helpful, to get some snippets of your code. Tanks a lot. >> >> Ciao, Günter >> >>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>> >>> Hi Günter, >>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>> >>> Ciao, >>> Marco. >>> >>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>> Hi, >>>> >>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>> >>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>> >>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>> >>>> 2. Is there any site-structure preferred? >>>> >>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>> >>>> Thanks for any advice and help. >>>> >>>> Günter >>> > > <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm>
K
Hi Marco,
one problem I achieved: how to handle a simple search-form with your approach or with RESTXQ in generell?
I have to modules: search.xqm and results.xqm.
- How do I have to handle the RESTXQ-Annotations in index.xqm and or searchxqm, so that the query-params are transferred to results.xqm?
- What kind if form-action is necessary to get from /search to /results?
I tried different things, but didn’t succeed. Perhaps you have an advice? Thanks in advance.
Herzlich gegruesst,
Günter
Quoted text · Marco Lettere · 61 lines
> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: > > Hi Günter, > sorry for the delay but here you go with a very small example that should show off what I told. > You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. > Then invoke the "entrypoint" RestXQ from within your browser with an url similar to > > http://localhost:8984/myapp/page1?user=Marco > > As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. > Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. > > It's really not anything special but nevertheless it should be useful in clarifying the approach. > > Hoffe es gefaellt dir. > Herzliche Gruesse, > Marco. > > On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >> Hi Marco, >> >> it’s me again. Just to be more specific, I’m especially interested in your approach >> - to pass parametric values into the „exploded“ modules >> - to map requests to module invocations by exploiting REST path segments >> >> It would be really helpful, to get some snippets of your code. Tanks a lot. >> >> Ciao, Günter >> >>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>> >>> Hi Günter, >>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>> >>> Ciao, >>> Marco. >>> >>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>> Hi, >>>> >>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>> >>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>> >>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>> >>>> 2. Is there any site-structure preferred? >>>> >>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>> >>>> Thanks for any advice and help. >>>> >>>> Günter >>> > > <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm>
ML
Marco Lettere11 Apr 2016 17:45 #
Hi Günter,
to me these feel like really general questions about using XQuery/RestXQ so I'd definitely hook up Christian's advice to have a look at the docs and at the examples you can find in the webapp/dba folder of your BaseX installation.
Regards,
Marco.
Quoted text · kleist-digital · 74 lines
On 11/04/2016 15:50, kleist-digital wrote: > Hi Marco, > > one problem I achieved: how to handle a simple search-form with your approach or with RESTXQ in generell? > > I have to modules: search.xqm and results.xqm. > - How do I have to handle the RESTXQ-Annotations in index.xqm and or searchxqm, so that the query-params are transferred to results.xqm? > - What kind if form-action is necessary to get from /search to /results? > > I tried different things, but didn’t succeed. Perhaps you have an advice? Thanks in advance. > > Herzlich gegruesst, > Günter > >> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: >> >> Hi Günter, >> sorry for the delay but here you go with a very small example that should show off what I told. >> You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. >> Then invoke the "entrypoint" RestXQ from within your browser with an url similar to >> >> http://localhost:8984/myapp/page1?user=Marco >> >> As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. >> Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. >> >> It's really not anything special but nevertheless it should be useful in clarifying the approach. >> >> Hoffe es gefaellt dir. >> Herzliche Gruesse, >> Marco. >> >> On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >>> Hi Marco, >>> >>> it’s me again. Just to be more specific, I’m especially interested in your approach >>> - to pass parametric values into the „exploded“ modules >>> - to map requests to module invocations by exploiting REST path segments >>> >>> It would be really helpful, to get some snippets of your code. Tanks a lot. >>> >>> Ciao, Günter >>> >>>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>>> >>>> Hi Günter, >>>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>>> >>>> Ciao, >>>> Marco. >>>> >>>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>>> Hi, >>>>> >>>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>>> >>>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>>> >>>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>>> >>>>> 2. Is there any site-structure preferred? >>>>> >>>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>>> >>>>> Thanks for any advice and help. >>>>> >>>>> Günter >> <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm> >
CG
Hi Günter,
I recommend you to check out our RESTXQ documentation [1], and the example you get displayed after starting basexhttp and visiting http://localhost:8984/. In the next step, the DBA code should give you many helpful hints (but it may be too advanced to start off with).
Hope this helps
Christian
[1] http://docs.basex.org/wiki/RESTXQ
Quoted text · kleist-digital · 78 lines
On Mon, Apr 11, 2016 at 3:50 PM, kleist-digital <kleist at mail.dunzwolff.de> wrote: > Hi Marco, > > one problem I achieved: how to handle a simple search-form with your approach or with RESTXQ in generell? > > I have to modules: search.xqm and results.xqm. > - How do I have to handle the RESTXQ-Annotations in index.xqm and or searchxqm, so that the query-params are transferred to results.xqm? > - What kind if form-action is necessary to get from /search to /results? > > I tried different things, but didn’t succeed. Perhaps you have an advice? Thanks in advance. > > Herzlich gegruesst, > Günter > >> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: >> >> Hi Günter, >> sorry for the delay but here you go with a very small example that should show off what I told. >> You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. >> Then invoke the "entrypoint" RestXQ from within your browser with an url similar to >> >> http://localhost:8984/myapp/page1?user=Marco >> >> As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. >> Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. >> >> It's really not anything special but nevertheless it should be useful in clarifying the approach. >> >> Hoffe es gefaellt dir. >> Herzliche Gruesse, >> Marco. >> >> On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >>> Hi Marco, >>> >>> it’s me again. Just to be more specific, I’m especially interested in your approach >>> - to pass parametric values into the „exploded“ modules >>> - to map requests to module invocations by exploiting REST path segments >>> >>> It would be really helpful, to get some snippets of your code. Tanks a lot. >>> >>> Ciao, Günter >>> >>>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>>> >>>> Hi Günter, >>>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>>> >>>> Ciao, >>>> Marco. >>>> >>>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>>> Hi, >>>>> >>>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>>> >>>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>>> >>>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>>> >>>>> 2. Is there any site-structure preferred? >>>>> >>>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>>> >>>>> Thanks for any advice and help. >>>>> >>>>> Günter >>>> >> >> <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm> > >
K
kleist-digital12 Apr 2016 07:51 #
Hi Christian, hi Marco,
I checked the docs and I managed a solution, but it’s combined with the more classical assemble-page approach. [1]
In Marco’s approach using xquery:invoke there is an index.xqm, which handles all XQuery annotations for RESTXQ. They are all based an %rest:GET, but for handling forms, I need a %rest:PUT annotation. I can’t figure out, where to put it. Or in generell: is the index.xqm the only place, where all annotations are handled?
Comparing the two approaches with the functions assemble-page and xquery:invoke for me the last one is more intuitive, so it would be nice, to get it run.
Thanks for help,
Günter
[1] https://en.wikibooks.org/wiki/XQuery/Creating_XQuery_Functions
Quoted text · Christian Grün · 95 lines
> Am 11.04.2016 um 19:57 schrieb Christian Grün <christian.gruen at gmail.com>: > > Hi Günter, > > I recommend you to check out our RESTXQ documentation [1], and the > example you get displayed after starting basexhttp and visiting > http://localhost:8984/. In the next step, the DBA code should give you > many helpful hints (but it may be too advanced to start off with). > > Hope this helps > Christian > > [1] http://docs.basex.org/wiki/RESTXQ > > > > On Mon, Apr 11, 2016 at 3:50 PM, kleist-digital > <kleist at mail.dunzwolff.de> wrote: >> Hi Marco, >> >> one problem I achieved: how to handle a simple search-form with your approach or with RESTXQ in generell? >> >> I have to modules: search.xqm and results.xqm. >> - How do I have to handle the RESTXQ-Annotations in index.xqm and or searchxqm, so that the query-params are transferred to results.xqm? >> - What kind if form-action is necessary to get from /search to /results? >> >> I tried different things, but didn’t succeed. Perhaps you have an advice? Thanks in advance. >> >> Herzlich gegruesst, >> Günter >> >>> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: >>> >>> Hi Günter, >>> sorry for the delay but here you go with a very small example that should show off what I told. >>> You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. >>> Then invoke the "entrypoint" RestXQ from within your browser with an url similar to >>> >>> http://localhost:8984/myapp/page1?user=Marco >>> >>> As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. >>> Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. >>> >>> It's really not anything special but nevertheless it should be useful in clarifying the approach. >>> >>> Hoffe es gefaellt dir. >>> Herzliche Gruesse, >>> Marco. >>> >>> On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >>>> Hi Marco, >>>> >>>> it’s me again. Just to be more specific, I’m especially interested in your approach >>>> - to pass parametric values into the „exploded“ modules >>>> - to map requests to module invocations by exploiting REST path segments >>>> >>>> It would be really helpful, to get some snippets of your code. Tanks a lot. >>>> >>>> Ciao, Günter >>>> >>>>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>>>> >>>>> Hi Günter, >>>>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>>>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>>>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>>>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>>>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>>>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>>>> >>>>> Ciao, >>>>> Marco. >>>>> >>>>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>>>> Hi, >>>>>> >>>>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>>>> >>>>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>>>> >>>>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>>>> >>>>>> 2. Is there any site-structure preferred? >>>>>> >>>>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>>>> >>>>>> Thanks for any advice and help. >>>>>> >>>>>> Günter >>>>> >>> >>> <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm> >> >> >
ML
Marco Lettere12 Apr 2016 08:50 #
Hi Günter,
just replace the GET annotation with a POST and the query-param annotations with form-param as described in [1].
BR,
M.
[1] http://docs.basex.org/wiki/RESTXQ#HTML_Form_Fields
Quoted text · kleist-digital · 106 lines
On 12/04/2016 07:51, kleist-digital wrote: > Hi Christian, hi Marco, > > I checked the docs and I managed a solution, but it’s combined with the more classical assemble-page approach. [1] > > In Marco’s approach using xquery:invoke there is an index.xqm, which handles all XQuery annotations for RESTXQ. They are all based an %rest:GET, but for handling forms, I need a %rest:PUT annotation. I can’t figure out, where to put it. Or in generell: is the index.xqm the only place, where all annotations are handled? > > Comparing the two approaches with the functions assemble-page and xquery:invoke for me the last one is more intuitive, so it would be nice, to get it run. > > Thanks for help, > Günter > > [1] https://en.wikibooks.org/wiki/XQuery/Creating_XQuery_Functions > >> Am 11.04.2016 um 19:57 schrieb Christian Grün <christian.gruen at gmail.com>: >> >> Hi Günter, >> >> I recommend you to check out our RESTXQ documentation [1], and the >> example you get displayed after starting basexhttp and visiting >> http://localhost:8984/. In the next step, the DBA code should give you >> many helpful hints (but it may be too advanced to start off with). >> >> Hope this helps >> Christian >> >> [1] http://docs.basex.org/wiki/RESTXQ >> >> >> >> On Mon, Apr 11, 2016 at 3:50 PM, kleist-digital >> <kleist at mail.dunzwolff.de> wrote: >>> Hi Marco, >>> >>> one problem I achieved: how to handle a simple search-form with your approach or with RESTXQ in generell? >>> >>> I have to modules: search.xqm and results.xqm. >>> - How do I have to handle the RESTXQ-Annotations in index.xqm and or searchxqm, so that the query-params are transferred to results.xqm? >>> - What kind if form-action is necessary to get from /search to /results? >>> >>> I tried different things, but didn’t succeed. Perhaps you have an advice? Thanks in advance. >>> >>> Herzlich gegruesst, >>> Günter >>> >>>> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: >>>> >>>> Hi Günter, >>>> sorry for the delay but here you go with a very small example that should show off what I told. >>>> You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. >>>> Then invoke the "entrypoint" RestXQ from within your browser with an url similar to >>>> >>>> http://localhost:8984/myapp/page1?user=Marco >>>> >>>> As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. >>>> Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. >>>> >>>> It's really not anything special but nevertheless it should be useful in clarifying the approach. >>>> >>>> Hoffe es gefaellt dir. >>>> Herzliche Gruesse, >>>> Marco. >>>> >>>> On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >>>>> Hi Marco, >>>>> >>>>> it’s me again. Just to be more specific, I’m especially interested in your approach >>>>> - to pass parametric values into the „exploded“ modules >>>>> - to map requests to module invocations by exploiting REST path segments >>>>> >>>>> It would be really helpful, to get some snippets of your code. Tanks a lot. >>>>> >>>>> Ciao, Günter >>>>> >>>>>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>>>>> >>>>>> Hi Günter, >>>>>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>>>>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>>>>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>>>>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>>>>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>>>>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>>>>> >>>>>> Ciao, >>>>>> Marco. >>>>>> >>>>>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>>>>> Hi, >>>>>>> >>>>>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>>>>> >>>>>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>>>>> >>>>>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>>>>> >>>>>>> 2. Is there any site-structure preferred? >>>>>>> >>>>>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>>>>> >>>>>>> Thanks for any advice and help. >>>>>>> >>>>>>> Günter >>>> <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm> >>> >
ML
BTW, in BaseX every xqm module containing RestXQ annotated functions and stored inside the webapp folder will be handled as RestXQ entrypoint thus you can write your functions where ever you prefer.
Ciao,
M.
Quoted text · kleist-digital · 106 lines
On 12/04/2016 07:51, kleist-digital wrote: > Hi Christian, hi Marco, > > I checked the docs and I managed a solution, but it’s combined with the more classical assemble-page approach. [1] > > In Marco’s approach using xquery:invoke there is an index.xqm, which handles all XQuery annotations for RESTXQ. They are all based an %rest:GET, but for handling forms, I need a %rest:PUT annotation. I can’t figure out, where to put it. Or in generell: is the index.xqm the only place, where all annotations are handled? > > Comparing the two approaches with the functions assemble-page and xquery:invoke for me the last one is more intuitive, so it would be nice, to get it run. > > Thanks for help, > Günter > > [1] https://en.wikibooks.org/wiki/XQuery/Creating_XQuery_Functions > >> Am 11.04.2016 um 19:57 schrieb Christian Grün <christian.gruen at gmail.com>: >> >> Hi Günter, >> >> I recommend you to check out our RESTXQ documentation [1], and the >> example you get displayed after starting basexhttp and visiting >> http://localhost:8984/. In the next step, the DBA code should give you >> many helpful hints (but it may be too advanced to start off with). >> >> Hope this helps >> Christian >> >> [1] http://docs.basex.org/wiki/RESTXQ >> >> >> >> On Mon, Apr 11, 2016 at 3:50 PM, kleist-digital >> <kleist at mail.dunzwolff.de> wrote: >>> Hi Marco, >>> >>> one problem I achieved: how to handle a simple search-form with your approach or with RESTXQ in generell? >>> >>> I have to modules: search.xqm and results.xqm. >>> - How do I have to handle the RESTXQ-Annotations in index.xqm and or searchxqm, so that the query-params are transferred to results.xqm? >>> - What kind if form-action is necessary to get from /search to /results? >>> >>> I tried different things, but didn’t succeed. Perhaps you have an advice? Thanks in advance. >>> >>> Herzlich gegruesst, >>> Günter >>> >>>> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: >>>> >>>> Hi Günter, >>>> sorry for the delay but here you go with a very small example that should show off what I told. >>>> You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. >>>> Then invoke the "entrypoint" RestXQ from within your browser with an url similar to >>>> >>>> http://localhost:8984/myapp/page1?user=Marco >>>> >>>> As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. >>>> Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. >>>> >>>> It's really not anything special but nevertheless it should be useful in clarifying the approach. >>>> >>>> Hoffe es gefaellt dir. >>>> Herzliche Gruesse, >>>> Marco. >>>> >>>> On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >>>>> Hi Marco, >>>>> >>>>> it’s me again. Just to be more specific, I’m especially interested in your approach >>>>> - to pass parametric values into the „exploded“ modules >>>>> - to map requests to module invocations by exploiting REST path segments >>>>> >>>>> It would be really helpful, to get some snippets of your code. Tanks a lot. >>>>> >>>>> Ciao, Günter >>>>> >>>>>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>>>>> >>>>>> Hi Günter, >>>>>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>>>>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>>>>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>>>>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>>>>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>>>>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>>>>> >>>>>> Ciao, >>>>>> Marco. >>>>>> >>>>>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>>>>> Hi, >>>>>>> >>>>>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>>>>> >>>>>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>>>>> >>>>>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>>>>> >>>>>>> 2. Is there any site-structure preferred? >>>>>>> >>>>>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>>>>> >>>>>>> Thanks for any advice and help. >>>>>>> >>>>>>> Günter >>>> <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm> >>> >
K
kleist-digital12 Apr 2016 17:31 #
Hi Marco,
thanks for the tipps. I’ll try them.
Ciao,
Günter
Quoted text · Marco Lettere · 114 lines
> Am 12.04.2016 um 09:52 schrieb Marco Lettere <m.lettere at gmail.com>: > > BTW, in BaseX every xqm module containing RestXQ annotated functions and stored inside the webapp folder will be handled as RestXQ entrypoint thus you can write your functions where ever you prefer. > Ciao, > M. > > On 12/04/2016 07:51, kleist-digital wrote: >> Hi Christian, hi Marco, >> >> I checked the docs and I managed a solution, but it’s combined with the more classical assemble-page approach. [1] >> >> In Marco’s approach using xquery:invoke there is an index.xqm, which handles all XQuery annotations for RESTXQ. They are all based an %rest:GET, but for handling forms, I need a %rest:PUT annotation. I can’t figure out, where to put it. Or in generell: is the index.xqm the only place, where all annotations are handled? >> >> Comparing the two approaches with the functions assemble-page and xquery:invoke for me the last one is more intuitive, so it would be nice, to get it run. >> >> Thanks for help, >> Günter >> >> [1] https://en.wikibooks.org/wiki/XQuery/Creating_XQuery_Functions >> >>> Am 11.04.2016 um 19:57 schrieb Christian Grün <christian.gruen at gmail.com>: >>> >>> Hi Günter, >>> >>> I recommend you to check out our RESTXQ documentation [1], and the >>> example you get displayed after starting basexhttp and visiting >>> http://localhost:8984/. In the next step, the DBA code should give you >>> many helpful hints (but it may be too advanced to start off with). >>> >>> Hope this helps >>> Christian >>> >>> [1] http://docs.basex.org/wiki/RESTXQ >>> >>> >>> >>> On Mon, Apr 11, 2016 at 3:50 PM, kleist-digital >>> <kleist at mail.dunzwolff.de> wrote: >>>> Hi Marco, >>>> >>>> one problem I achieved: how to handle a simple search-form with your approach or with RESTXQ in generell? >>>> >>>> I have to modules: search.xqm and results.xqm. >>>> - How do I have to handle the RESTXQ-Annotations in index.xqm and or searchxqm, so that the query-params are transferred to results.xqm? >>>> - What kind if form-action is necessary to get from /search to /results? >>>> >>>> I tried different things, but didn’t succeed. Perhaps you have an advice? Thanks in advance. >>>> >>>> Herzlich gegruesst, >>>> Günter >>>> >>>>> Am 10.04.2016 um 22:36 schrieb Marco Lettere <m.lettere at gmail.com>: >>>>> >>>>> Hi Günter, >>>>> sorry for the delay but here you go with a very small example that should show off what I told. >>>>> You can copy the .xqm files into the webapp dir of a basex installation and and the .css files into the corresponding static folder. >>>>> Then invoke the "entrypoint" RestXQ from within your browser with an url similar to >>>>> >>>>> http://localhost:8984/myapp/page1?user=Marco >>>>> >>>>> As you can see the HTML page built from the entrypoint is composed of three parts. One that selects the styles to apply according to the user being anonymous or not. >>>>> Then a common header markup is generated and finally a dynamic part that depends on the page element of the path. >>>>> >>>>> It's really not anything special but nevertheless it should be useful in clarifying the approach. >>>>> >>>>> Hoffe es gefaellt dir. >>>>> Herzliche Gruesse, >>>>> Marco. >>>>> >>>>> On 10/04/2016 17:36, Günter Dunz-Wolff wrote: >>>>>> Hi Marco, >>>>>> >>>>>> it’s me again. Just to be more specific, I’m especially interested in your approach >>>>>> - to pass parametric values into the „exploded“ modules >>>>>> - to map requests to module invocations by exploiting REST path segments >>>>>> >>>>>> It would be really helpful, to get some snippets of your code. Tanks a lot. >>>>>> >>>>>> Ciao, Günter >>>>>> >>>>>>> Am 08.04.2016 um 10:13 schrieb Marco Lettere <m.lettere at gmail.com>: >>>>>>> >>>>>>> Hi Günter, >>>>>>> we have worked on several web applications that include a frontend and we are very happy with using basex for serving both static (scripts, css, images) and dynamic (markup) content. >>>>>>> One pattern that we've used often and that we find very productive is to split markup content into different .xqm modules. >>>>>>> The modules are called through the xquery:invoke function in order to "explode" their output into the main page. >>>>>>> In our opinion this is a good approach because it is applicable recursively to sub-modules. Content of modules may be dynamic as well and parametric values are passed into the module through external variables. >>>>>>> Finally, it is possible to set up an automatic way of mapping requests to module invocations by exploiting REST path segments for example. >>>>>>> I hope I have been able to explain it well enough otherwise, just let me know and as soon as possible I'll provide an example code snippet that demonstrates the approach. >>>>>>> >>>>>>> Ciao, >>>>>>> Marco. >>>>>>> >>>>>>> On 07/04/2016 17:08, Günter Dunz-Wolff wrote: >>>>>>>> Hi, >>>>>>>> >>>>>>>> I'm planning to relaunch my website (kleist-digital.de) with OpenShift as BaseX-Server. After some difficulties and a lot of help from Christian and Andy the server is running now. >>>>>>>> >>>>>>>> I took a look at RESTXQ and it seems quite interesting to build the whole frontend for my app with it. Some questions I have: >>>>>>>> >>>>>>>> 1. I'm working with a basic layout for all pages. This basic layout-file includes header, footer and changing content. What is the best approach with RESTXQ. How to build a modular concept with RESTXQ? >>>>>>>> >>>>>>>> 2. Is there any site-structure preferred? >>>>>>>> >>>>>>>> 3. Most of the site is dynamic. But I need also static files like images, css, javascript. Where to put them best (so that the Openshift-Server can handle them)? >>>>>>>> >>>>>>>> Thanks for any advice and help. >>>>>>>> >>>>>>>> Günter >>>>> <styles.xqm><page1.xqm><style2.css><style1.css><commonheader.xqm><index.xqm> >>>> >> > >
Written for BaseX 8.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery