RestXQ parameter matching
Tuesday, 26 February 2013 · 10 messages · last reply 27 Feb 2013
CG
Dear Wendell,
Quoted text · Wendell Piez · 1 line
> declare %restxq:path("test/{$id}.html")
the RESTXQ spec. requires path segments to be either a string (such as "test") or a template (such as {$id}) [1]. If you require the .html suffix, you’ll have to remove it from the assigned variable within your XQuery code:
declare %restxq:path("test/{$id}") ... {
replace($id, '\.html$', '')
}Hope this helps,
Christian
[1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf
Quoted text · Wendell Piez · 33 lines
> %output:method("xhtml") > %output:omit-xml-declaration("no") > %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN") > %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") > function me:testing($id as xs:string) { > > let $db := db:open("myDB") > return > <html> > <body> > <h1>{$id }</h1> > </body> > </html> > > Hitting http://localhost:8984/restxq/test/testing.html, I expect to > see "testing" big and bold. > > But I see "testing.html". > > Any clue as to what I'm doing wrong? > > Thanks, > Wendell > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^ > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
WP
Wendell Piez26 Feb 2013 19:25 #
Hi,
I have this bit of RestXQ:
declare %restxq:path("test/{$id}.html")
%output:method("xhtml")
%output:omit-xml-declaration("no")
%output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN") %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") function me:testing($id as xs:string) {
let $db := db:open("myDB")
return
<html>
<body>
<h1>{$id }</h1>
</body>
</html>Hitting http://localhost:8984/restxq/test/testing.html, I expect to see "testing" big and bold.
But I see "testing.html".
Any clue as to what I'm doing wrong?
Thanks,
Wendell
--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
CG
Hi Wendell,
in our use case, we never work with file extensions in the URI, so we didn’t actually felt that this could be a restriction. Still, I agree that a more powerful path matcher could add flexibility. RESTXQ is still pretty young, so just wait and see how the standard evolves.
Best,
Christian
Quoted text · Wendell Piez · 79 lines
On Tue, Feb 26, 2013 at 11:20 PM, Wendell Piez <wapiez at wendellpiez.com> wrote: > Christian, > > Ah, how ... non-obvious. "Path segment." :-> (Expecting more flexible > string-matching behavior, a la Cocoon sitemaps, I guess I didn't even > notice the language saying it wasn't.) > > Thanks! I guess I can live with a little working around, if it makes > life easier for others. > > Cheers, Wendell > > > On Tue, Feb 26, 2013 at 12:30 PM, Christian Grün > <christian.gruen at gmail.com> wrote: >> Dear Wendell, >> >>> declare %restxq:path("test/{$id}.html") >> >> the RESTXQ spec. requires path segments to be either a string (such as >> "test") or a template (such as {$id}) [1]. If you require the .html >> suffix, you’ll have to remove it from the assigned variable within >> your XQuery code: >> >> declare %restxq:path("test/{$id}") ... { >> replace($id, '\.html$', '') >> } >> >> Hope this helps, >> Christian >> >> [1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf >> ____________________________ >> >>> %output:method("xhtml") >>> %output:omit-xml-declaration("no") >>> %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN") >>> %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") >>> function me:testing($id as xs:string) { >>> >>> let $db := db:open("myDB") >>> return >>> <html> >>> <body> >>> <h1>{$id }</h1> >>> </body> >>> </html> >>> >>> Hitting http://localhost:8984/restxq/test/testing.html, I expect to >>> see "testing" big and bold. >>> >>> But I see "testing.html". >>> >>> Any clue as to what I'm doing wrong? >>> >>> Thanks, >>> Wendell >>> >>> -- >>> Wendell Piez | http://www.wendellpiez.com >>> XML | XSLT | electronic publishing >>> Eat Your Vegetables >>> _____oo_________o_o___ooooo____ooooooo_^ >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^ > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
WP
Christian,
Ah, how ... non-obvious. "Path segment." :-> (Expecting more flexible string-matching behavior, a la Cocoon sitemaps, I guess I didn't even notice the language saying it wasn't.)
Thanks! I guess I can live with a little working around, if it makes life easier for others.
Cheers, Wendell
Quoted text · Christian Grün · 54 lines
On Tue, Feb 26, 2013 at 12:30 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Dear Wendell, > >> declare %restxq:path("test/{$id}.html") > > the RESTXQ spec. requires path segments to be either a string (such as > "test") or a template (such as {$id}) [1]. If you require the .html > suffix, you’ll have to remove it from the assigned variable within > your XQuery code: > > declare %restxq:path("test/{$id}") ... { > replace($id, '\.html$', '') > } > > Hope this helps, > Christian > > [1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf > ____________________________ > >> %output:method("xhtml") >> %output:omit-xml-declaration("no") >> %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN") >> %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") >> function me:testing($id as xs:string) { >> >> let $db := db:open("myDB") >> return >> <html> >> <body> >> <h1>{$id }</h1> >> </body> >> </html> >> >> Hitting http://localhost:8984/restxq/test/testing.html, I expect to >> see "testing" big and bold. >> >> But I see "testing.html". >> >> Any clue as to what I'm doing wrong? >> >> Thanks, >> Wendell >> >> -- >> Wendell Piez | http://www.wendellpiez.com >> XML | XSLT | electronic publishing >> Eat Your Vegetables >> _____oo_________o_o___ooooo____ooooooo_^ >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
ML
Hello,
I'd like to add just my two cents to the discussion. We have to implement a specification called hData that stores healthcare data in document oriented way. The specs organizes the documents in a tree structure based on record/section/subsection/subsection/... where subsections can be arbitrarily nested. RestXQ is nearly perfect for this spec the only thing that we miss is the possibility to refer to arbitrary subsections in the path. We have to limit the access to a predefined level of subsections because there's no way AFAIK to refer to an arbitrary path. Is this right? Could this be solved in your opinion with accessing inside the function the path info through the request module (
request:path())?
Thank you,
M.Quoted text · Christian Grün · 94 lines
On 02/26/2013 11:31 PM, Christian Grün wrote: > Hi Wendell, > > in our use case, we never work with file extensions in the URI, so we > didn’t actually felt that this could be a restriction. Still, I agree > that a more powerful path matcher could add flexibility. RESTXQ is > still pretty young, so just wait and see how the standard evolves. > > Best, > Christian > ___________________________ > > On Tue, Feb 26, 2013 at 11:20 PM, Wendell Piez <wapiez at wendellpiez.com> wrote: >> Christian, >> >> Ah, how ... non-obvious. "Path segment." :-> (Expecting more flexible >> string-matching behavior, a la Cocoon sitemaps, I guess I didn't even >> notice the language saying it wasn't.) >> >> Thanks! I guess I can live with a little working around, if it makes >> life easier for others. >> >> Cheers, Wendell >> >> >> On Tue, Feb 26, 2013 at 12:30 PM, Christian Grün >> <christian.gruen at gmail.com> wrote: >>> Dear Wendell, >>> >>>> declare %restxq:path("test/{$id}.html") >>> the RESTXQ spec. requires path segments to be either a string (such as >>> "test") or a template (such as {$id}) [1]. If you require the .html >>> suffix, you’ll have to remove it from the assigned variable within >>> your XQuery code: >>> >>> declare %restxq:path("test/{$id}") ... { >>> replace($id, '\.html$', '') >>> } >>> >>> Hope this helps, >>> Christian >>> >>> [1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf >>> ____________________________ >>> >>>> %output:method("xhtml") >>>> %output:omit-xml-declaration("no") >>>> %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN") >>>> %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") >>>> function me:testing($id as xs:string) { >>>> >>>> let $db := db:open("myDB") >>>> return >>>> <html> >>>> <body> >>>> <h1>{$id }</h1> >>>> </body> >>>> </html> >>>> >>>> Hitting http://localhost:8984/restxq/test/testing.html, I expect to >>>> see "testing" big and bold. >>>> >>>> But I see "testing.html". >>>> >>>> Any clue as to what I'm doing wrong? >>>> >>>> Thanks, >>>> Wendell >>>> >>>> -- >>>> Wendell Piez | http://www.wendellpiez.com >>>> XML | XSLT | electronic publishing >>>> Eat Your Vegetables >>>> _____oo_________o_o___ooooo____ooooooo_^ >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >> -- >> Wendell Piez | http://www.wendellpiez.com >> XML | XSLT | electronic publishing >> Eat Your Vegetables >> _____oo_________o_o___ooooo____ooooooo_^ >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
ML
Yep, you got it exactly the right way.
We are struggling to find a possible solution to that but still no way out and I think that together with yours the questions may converge into a more general "restxq path flexibility" issue.
M.
Quoted text · Wendell Piez · 148 lines
On 02/27/2013 04:58 PM, Wendell Piez wrote: > Hi again, > > Yes, as I understand it Marco's request is the complementary opposite > of mine, where in > > repository/{$path}/resource > > $path could match not only a path segment, but an arbitrary sequence > of segments (which can be decomposed by the function when need be). > > Because it matches on substrings not path segments, Apache Cocoon can > do this and indeed it's very powerful. > > But I understand we're talking about feature requests in RestXQ, not > in BaseX. I'm happy enough for now with the workarounds. :-) > > Cheers, Wendell > > > On Wed, Feb 27, 2013 at 3:11 AM, Marco Lettere <marco.lettere at dedalus.eu> wrote: >> Hello, >> I'd like to add just my two cents to the discussion. We have to implement a >> specification called hData that stores healthcare data in document oriented >> way. The specs organizes the documents in a tree structure based on >> record/section/subsection/subsection/... where subsections can be >> arbitrarily nested. RestXQ is nearly perfect for this spec the only thing >> that we miss is the possibility to refer to arbitrary subsections in the >> path. We have to limit the access to a predefined level of subsections >> because there's no way AFAIK to refer to an arbitrary path. Is this right? >> Could this be solved in your opinion with accessing inside the function the >> path info through the request module (request:path())? >> Thank you, >> M. >> >> >> On 02/26/2013 11:31 PM, Christian Grün wrote: >>> Hi Wendell, >>> >>> in our use case, we never work with file extensions in the URI, so we >>> didn’t actually felt that this could be a restriction. Still, I agree >>> that a more powerful path matcher could add flexibility. RESTXQ is >>> still pretty young, so just wait and see how the standard evolves. >>> >>> Best, >>> Christian >>> ___________________________ >>> >>> On Tue, Feb 26, 2013 at 11:20 PM, Wendell Piez <wapiez at wendellpiez.com> >>> wrote: >>>> Christian, >>>> >>>> Ah, how ... non-obvious. "Path segment." :-> (Expecting more flexible >>>> string-matching behavior, a la Cocoon sitemaps, I guess I didn't even >>>> notice the language saying it wasn't.) >>>> >>>> Thanks! I guess I can live with a little working around, if it makes >>>> life easier for others. >>>> >>>> Cheers, Wendell >>>> >>>> >>>> On Tue, Feb 26, 2013 at 12:30 PM, Christian Grün >>>> <christian.gruen at gmail.com> wrote: >>>>> Dear Wendell, >>>>> >>>>>> declare %restxq:path("test/{$id}.html") >>>>> the RESTXQ spec. requires path segments to be either a string (such as >>>>> "test") or a template (such as {$id}) [1]. If you require the .html >>>>> suffix, you’ll have to remove it from the assigned variable within >>>>> your XQuery code: >>>>> >>>>> declare %restxq:path("test/{$id}") ... { >>>>> replace($id, '\.html$', '') >>>>> } >>>>> >>>>> Hope this helps, >>>>> Christian >>>>> >>>>> [1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf >>>>> ____________________________ >>>>> >>>>>> %output:method("xhtml") >>>>>> %output:omit-xml-declaration("no") >>>>>> %output:doctype-public("-//W3C//DTD XHTML 1.0 >>>>>> Transitional//EN") >>>>>> >>>>>> %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") >>>>>> function me:testing($id as xs:string) { >>>>>> >>>>>> let $db := db:open("myDB") >>>>>> return >>>>>> <html> >>>>>> <body> >>>>>> <h1>{$id }</h1> >>>>>> </body> >>>>>> </html> >>>>>> >>>>>> Hitting http://localhost:8984/restxq/test/testing.html, I expect to >>>>>> see "testing" big and bold. >>>>>> >>>>>> But I see "testing.html". >>>>>> >>>>>> Any clue as to what I'm doing wrong? >>>>>> >>>>>> Thanks, >>>>>> Wendell >>>>>> >>>>>> -- >>>>>> Wendell Piez | http://www.wendellpiez.com >>>>>> XML | XSLT | electronic publishing >>>>>> Eat Your Vegetables >>>>>> _____oo_________o_o___ooooo____ooooooo_^ >>>>>> _______________________________________________ >>>>>> BaseX-Talk mailing list >>>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>> >>>> >>>> -- >>>> Wendell Piez | http://www.wendellpiez.com >>>> XML | XSLT | electronic publishing >>>> Eat Your Vegetables >>>> _____oo_________o_o___ooooo____ooooooo_^ >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^ > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
WP
Hi again,
Yes, as I understand it Marco's request is the complementary opposite of mine, where in
repository/{$path}/resource
$path could match not only a path segment, but an arbitrary sequence of segments (which can be decomposed by the function when need be).
Because it matches on substrings not path segments, Apache Cocoon can do this and indeed it's very powerful.
But I understand we're talking about feature requests in RestXQ, not in BaseX. I'm happy enough for now with the workarounds. :-)
Cheers, Wendell
Quoted text · Marco Lettere · 124 lines
On Wed, Feb 27, 2013 at 3:11 AM, Marco Lettere <marco.lettere at dedalus.eu> wrote: > Hello, > I'd like to add just my two cents to the discussion. We have to implement a > specification called hData that stores healthcare data in document oriented > way. The specs organizes the documents in a tree structure based on > record/section/subsection/subsection/... where subsections can be > arbitrarily nested. RestXQ is nearly perfect for this spec the only thing > that we miss is the possibility to refer to arbitrary subsections in the > path. We have to limit the access to a predefined level of subsections > because there's no way AFAIK to refer to an arbitrary path. Is this right? > Could this be solved in your opinion with accessing inside the function the > path info through the request module (request:path())? > Thank you, > M. > > > On 02/26/2013 11:31 PM, Christian Grün wrote: >> >> Hi Wendell, >> >> in our use case, we never work with file extensions in the URI, so we >> didn’t actually felt that this could be a restriction. Still, I agree >> that a more powerful path matcher could add flexibility. RESTXQ is >> still pretty young, so just wait and see how the standard evolves. >> >> Best, >> Christian >> ___________________________ >> >> On Tue, Feb 26, 2013 at 11:20 PM, Wendell Piez <wapiez at wendellpiez.com> >> wrote: >>> >>> Christian, >>> >>> Ah, how ... non-obvious. "Path segment." :-> (Expecting more flexible >>> string-matching behavior, a la Cocoon sitemaps, I guess I didn't even >>> notice the language saying it wasn't.) >>> >>> Thanks! I guess I can live with a little working around, if it makes >>> life easier for others. >>> >>> Cheers, Wendell >>> >>> >>> On Tue, Feb 26, 2013 at 12:30 PM, Christian Grün >>> <christian.gruen at gmail.com> wrote: >>>> >>>> Dear Wendell, >>>> >>>>> declare %restxq:path("test/{$id}.html") >>>> >>>> the RESTXQ spec. requires path segments to be either a string (such as >>>> "test") or a template (such as {$id}) [1]. If you require the .html >>>> suffix, you’ll have to remove it from the assigned variable within >>>> your XQuery code: >>>> >>>> declare %restxq:path("test/{$id}") ... { >>>> replace($id, '\.html$', '') >>>> } >>>> >>>> Hope this helps, >>>> Christian >>>> >>>> [1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf >>>> ____________________________ >>>> >>>>> %output:method("xhtml") >>>>> %output:omit-xml-declaration("no") >>>>> %output:doctype-public("-//W3C//DTD XHTML 1.0 >>>>> Transitional//EN") >>>>> >>>>> %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") >>>>> function me:testing($id as xs:string) { >>>>> >>>>> let $db := db:open("myDB") >>>>> return >>>>> <html> >>>>> <body> >>>>> <h1>{$id }</h1> >>>>> </body> >>>>> </html> >>>>> >>>>> Hitting http://localhost:8984/restxq/test/testing.html, I expect to >>>>> see "testing" big and bold. >>>>> >>>>> But I see "testing.html". >>>>> >>>>> Any clue as to what I'm doing wrong? >>>>> >>>>> Thanks, >>>>> Wendell >>>>> >>>>> -- >>>>> Wendell Piez | http://www.wendellpiez.com >>>>> XML | XSLT | electronic publishing >>>>> Eat Your Vegetables >>>>> _____oo_________o_o___ooooo____ooooooo_^ >>>>> _______________________________________________ >>>>> BaseX-Talk mailing list >>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >>> >>> >>> -- >>> Wendell Piez | http://www.wendellpiez.com >>> XML | XSLT | electronic publishing >>> Eat Your Vegetables >>> _____oo_________o_o___ooooo____ooooooo_^ >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
LQ
Liam R E Quin27 Feb 2013 18:34 #
Quoted text · Wendell Piez · 3 lines
On Wed, 2013-02-27 at 10:58 -0500, Wendell Piez wrote: > Because it matches on substrings not path segments, Apache Cocoon can > do this and indeed it's very powerful.
This is an area where I once tried to push for some standardization, and I still think defining a portable mechanism to map between URI-space and queries (or XProc pipelines) would be a step forward.
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
CG
Hi all,
if you are interested in improving the RESTXQ spec, you are invited to add your issues to the Adam Retter’s EXQuery issue tracker:
https://github.com/exquery/exquery/issues
The more precise potential proposals are, the better the chances are that it will eventually be added to the spec..
Christian
Quoted text · Marco Lettere · 177 lines
On Wed, Feb 27, 2013 at 5:41 PM, Marco Lettere <marco.lettere at dedalus.eu> wrote: > Yep, you got it exactly the right way. > We are struggling to find a possible solution to that but still no way out > and I think that together with yours the questions may converge into a more > general "restxq path flexibility" issue. > M. > > > On 02/27/2013 04:58 PM, Wendell Piez wrote: >> >> Hi again, >> >> Yes, as I understand it Marco's request is the complementary opposite >> of mine, where in >> >> repository/{$path}/resource >> >> $path could match not only a path segment, but an arbitrary sequence >> of segments (which can be decomposed by the function when need be). >> >> Because it matches on substrings not path segments, Apache Cocoon can >> do this and indeed it's very powerful. >> >> But I understand we're talking about feature requests in RestXQ, not >> in BaseX. I'm happy enough for now with the workarounds. :-) >> >> Cheers, Wendell >> >> >> On Wed, Feb 27, 2013 at 3:11 AM, Marco Lettere <marco.lettere at dedalus.eu> >> wrote: >>> >>> Hello, >>> I'd like to add just my two cents to the discussion. We have to implement >>> a >>> specification called hData that stores healthcare data in document >>> oriented >>> way. The specs organizes the documents in a tree structure based on >>> record/section/subsection/subsection/... where subsections can be >>> arbitrarily nested. RestXQ is nearly perfect for this spec the only thing >>> that we miss is the possibility to refer to arbitrary subsections in the >>> path. We have to limit the access to a predefined level of subsections >>> because there's no way AFAIK to refer to an arbitrary path. Is this >>> right? >>> Could this be solved in your opinion with accessing inside the function >>> the >>> path info through the request module (request:path())? >>> Thank you, >>> M. >>> >>> >>> On 02/26/2013 11:31 PM, Christian Grün wrote: >>>> >>>> Hi Wendell, >>>> >>>> in our use case, we never work with file extensions in the URI, so we >>>> didn’t actually felt that this could be a restriction. Still, I agree >>>> that a more powerful path matcher could add flexibility. RESTXQ is >>>> still pretty young, so just wait and see how the standard evolves. >>>> >>>> Best, >>>> Christian >>>> ___________________________ >>>> >>>> On Tue, Feb 26, 2013 at 11:20 PM, Wendell Piez <wapiez at wendellpiez.com> >>>> wrote: >>>>> >>>>> Christian, >>>>> >>>>> Ah, how ... non-obvious. "Path segment." :-> (Expecting more flexible >>>>> string-matching behavior, a la Cocoon sitemaps, I guess I didn't even >>>>> notice the language saying it wasn't.) >>>>> >>>>> Thanks! I guess I can live with a little working around, if it makes >>>>> life easier for others. >>>>> >>>>> Cheers, Wendell >>>>> >>>>> >>>>> On Tue, Feb 26, 2013 at 12:30 PM, Christian Grün >>>>> <christian.gruen at gmail.com> wrote: >>>>>> >>>>>> Dear Wendell, >>>>>> >>>>>>> declare %restxq:path("test/{$id}.html") >>>>>> >>>>>> the RESTXQ spec. requires path segments to be either a string (such as >>>>>> "test") or a template (such as {$id}) [1]. If you require the .html >>>>>> suffix, you’ll have to remove it from the assigned variable within >>>>>> your XQuery code: >>>>>> >>>>>> declare %restxq:path("test/{$id}") ... { >>>>>> replace($id, '\.html$', '') >>>>>> } >>>>>> >>>>>> Hope this helps, >>>>>> Christian >>>>>> >>>>>> [1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf >>>>>> ____________________________ >>>>>> >>>>>>> %output:method("xhtml") >>>>>>> %output:omit-xml-declaration("no") >>>>>>> %output:doctype-public("-//W3C//DTD XHTML 1.0 >>>>>>> Transitional//EN") >>>>>>> >>>>>>> >>>>>>> %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") >>>>>>> function me:testing($id as xs:string) { >>>>>>> >>>>>>> let $db := db:open("myDB") >>>>>>> return >>>>>>> <html> >>>>>>> <body> >>>>>>> <h1>{$id }</h1> >>>>>>> </body> >>>>>>> </html> >>>>>>> >>>>>>> Hitting http://localhost:8984/restxq/test/testing.html, I expect to >>>>>>> see "testing" big and bold. >>>>>>> >>>>>>> But I see "testing.html". >>>>>>> >>>>>>> Any clue as to what I'm doing wrong? >>>>>>> >>>>>>> Thanks, >>>>>>> Wendell >>>>>>> >>>>>>> -- >>>>>>> Wendell Piez | http://www.wendellpiez.com >>>>>>> XML | XSLT | electronic publishing >>>>>>> Eat Your Vegetables >>>>>>> _____oo_________o_o___ooooo____ooooooo_^ >>>>>>> _______________________________________________ >>>>>>> BaseX-Talk mailing list >>>>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>>> >>>>> >>>>> >>>>> -- >>>>> Wendell Piez | http://www.wendellpiez.com >>>>> XML | XSLT | electronic publishing >>>>> Eat Your Vegetables >>>>> _____oo_________o_o___ooooo____ooooooo_^ >>>>> _______________________________________________ >>>>> BaseX-Talk mailing list >>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>> >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>> >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >> >> -- >> Wendell Piez | http://www.wendellpiez.com >> XML | XSLT | electronic publishing >> Eat Your Vegetables >> _____oo_________o_o___ooooo____ooooooo_^ >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
CG
Hi Marco,
one way to circumvent this limitation is to specify a module with some default RESTXQ paths that only contain templates:
declare function ... %restxq:path("{$a}") ... { do($a) }
declare function ... %restxq:path("{$a}/{$b}") ... { do($a || '/' || $b) }
declare function ... %restxq:path("{$a}/{$b}/{$c}") ... { do($a || '/' ||
$b || '/' || $c) }
...
declare function do($path) { ... }Those functions will be invoked whenever there is no other, more specific function available. But, yes, this is a clear workaround.
As you indicated,
request:path() may also be processed whenever a path operation isn’t natively supported by RESTXQ 1.0.
Hope this helps,
ChristianQuoted text · Marco Lettere · 76 lines
On Wed, Feb 27, 2013 at 9:11 AM, Marco Lettere <marco.lettere at dedalus.eu> wrote: > Hello, > I'd like to add just my two cents to the discussion. We have to implement a > specification called hData that stores healthcare data in document oriented > way. The specs organizes the documents in a tree structure based on > record/section/subsection/subsection/... where subsections can be > arbitrarily nested. RestXQ is nearly perfect for this spec the only thing > that we miss is the possibility to refer to arbitrary subsections in the > path. We have to limit the access to a predefined level of subsections > because there's no way AFAIK to refer to an arbitrary path. Is this right? > Could this be solved in your opinion with accessing inside the function the > path info through the request module (request:path())? > Thank you, > M. > > > On 02/26/2013 11:31 PM, Christian Grün wrote: >> >> Hi Wendell, >> >> in our use case, we never work with file extensions in the URI, so we >> didn’t actually felt that this could be a restriction. Still, I agree >> that a more powerful path matcher could add flexibility. RESTXQ is >> still pretty young, so just wait and see how the standard evolves. >> >> Best, >> Christian >> ___________________________ >> >> On Tue, Feb 26, 2013 at 11:20 PM, Wendell Piez <wapiez at wendellpiez.com> >> wrote: >>> >>> Christian, >>> >>> Ah, how ... non-obvious. "Path segment." :-> (Expecting more flexible >>> string-matching behavior, a la Cocoon sitemaps, I guess I didn't even >>> notice the language saying it wasn't.) >>> >>> Thanks! I guess I can live with a little working around, if it makes >>> life easier for others. >>> >>> Cheers, Wendell >>> >>> >>> On Tue, Feb 26, 2013 at 12:30 PM, Christian Grün >>> <christian.gruen at gmail.com> wrote: >>>> >>>> Dear Wendell, >>>> >>>>> declare %restxq:path("test/{$id}.html") >>>> >>>> the RESTXQ spec. requires path segments to be either a string (such as >>>> "test") or a template (such as {$id}) [1]. If you require the .html >>>> suffix, you’ll have to remove it from the assigned variable within >>>> your XQuery code: >>>> >>>> declare %restxq:path("test/{$id}") ... { >>>> replace($id, '\.html$', '') >>>> } >>>> >>>> Hope this helps, >>>> Christian >>>> >>>> [1]http://www.adamretter.org.uk/papers/restful-xquery_january-2012.pdf >>>> ____________________________ >>>> >>>>> %output:method("xhtml") >>>>> %output:omit-xml-declaration("no") >>>>> %output:doctype-public("-//W3C//DTD XHTML 1.0 >>>>> Transitional//EN") >>>>> >>>>> %output:doctype-system("
Quoted text · Marco Lettere · 52 lines
>>>>> function me:testing($id as xs:string) { >>>>> >>>>> let $db := db:open("myDB") >>>>> return >>>>> <html> >>>>> <body> >>>>> <h1>{$id }</h1> >>>>> </body> >>>>> </html> >>>>> >>>>> Hitting http://localhost:8984/restxq/test/testing.html, I expect to >>>>> see "testing" big and bold. >>>>> >>>>> But I see "testing.html". >>>>> >>>>> Any clue as to what I'm doing wrong? >>>>> >>>>> Thanks, >>>>> Wendell >>>>> >>>>> -- >>>>> Wendell Piez | http://www.wendellpiez.com >>>>> XML | XSLT | electronic publishing >>>>> Eat Your Vegetables >>>>> _____oo_________o_o___ooooo____ooooooo_^ >>>>> _______________________________________________ >>>>> BaseX-Talk mailing list >>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >>> >>> >>> -- >>> Wendell Piez | http://www.wendellpiez.com >>> XML | XSLT | electronic publishing >>> Eat Your Vegetables >>> _____oo_________o_o___ooooo____ooooooo_^ >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 7.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery