Thanks, Joe! I guess I'd glossed over the "funky" example ;-) Regarding the
arrow operator, I was wondering whether something like this was possible:

json-doc(" http://lae.princeton.edu/catalog/0bp35.jsonld";)("@context") =>
json-doc()("@context")

which throws an error: [XPST0003] Unexpected end of query: '("@context")'.

Tim

On Sat, Jan 9, 2016 at 3:53 PM, Joe Wicentowski <[email protected]> wrote:

> Hi Tim,
>
> For your first question, I think your example falls into what the spec
> calls "funky looking" keys.  See the 3rd bullet point example under
> http://www.w3.org/TR/xquery-31/#id-lookup:
>
> > funky / <looking @string") is equivalent to .("$funky / <looking
> @string"), an appropriate lookup for a map with rather odd conventions for
> keys.
>
> In other words, I think you're stuck with the ("@context") approach.
>
> As to your second question, it looks like what you're proposing should
> work - but am I reading you as saying you get an error with your proposed
> approach?  If so, what's the error?
>
> Joe
>
> Sent from my iPad
>
> _____________________________
> From: Tim Thompson <[email protected]>
> Sent: Saturday, January 9, 2016 3:11 PM
> Subject: [basex-talk] Lookups and arrows
> To: BaseX <[email protected]>
>
>
>
> Hello,
>
> I'm testing some XQuery 3.1 features against a JSON-LD[1] document and had
> a few questions. In the JSON-LD format, the "@" symbol has special
> semantics in key names, but seems to cause problems with the 3.1 lookup
> operator.
>
> For example:
>
> json-doc(" http://lae.princeton.edu/catalog/0bp35.jsonld";)("@context")
>
> works as expected, but
>
> json-doc(" http://lae.princeton.edu/catalog/0bp35.jsonld";)?@context
>
> throws an error: [XPST0003] No specifier after lookup operator: '@'.
>
> Also, when using the "=>" operator, should it be possible to perform a
> lookup on the last expression in a chain, if that expression returns a map?
>
> For example:
>
> json-doc(" http://lae.princeton.edu/catalog/0bp35.jsonld";)("@context")
> evaluates to " http://iiif.io/api/presentation/2/context.json";
>
> and
>
> json-doc(" http://lae.princeton.edu/catalog/0bp35.jsonld";)("@context") =>
> json-doc()
>
> returns another map object. So, how would one achieve this:
>
> json-doc(json-doc(" 
> http://lae.princeton.edu/catalog/0bp35.jsonld";)("@context"))("@context")
>
>
> using the arrow operator?
>
> Thanks,
> Tim
>
>
> [1] http://www.w3.org/TR/json-ld/
>
>
> --
> Tim A. Thompson
> Metadata Librarian (Spanish/Portuguese Specialty)
> Princeton University Library
>
>
>
>

Reply via email to