Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix existdb function signatures #149

Merged
merged 4 commits into from
Nov 18, 2021

Conversation

line-o
Copy link
Contributor

@line-o line-o commented Nov 17, 2021

With the releases of exist-db 5.0.0, 5.1.0 and 5.3.0 some function signatures changed, some where deprecated or even removed and new ones added.

This PR attempts to update all of these modules

  • xmldb
  • util
  • lucene

In addition this PR adds new processor versions 5.0, 5.1 and 5.3 (5.2 intentionally left out) and selects a new static XQuery context if version 5.0 or later is selected.

@line-o
Copy link
Contributor Author

line-o commented Nov 17, 2021

I also had a look at the list of module namespaces injected into the XQuery static context and found several ones that were removed in eXist 5+

declare namespace console = "http://exist-db.org/xquery/console";
declare namespace datetime = "http://exist-db.org/xquery/datetime";
declare namespace example = "http://exist-db.org/xquery/example";
declare namespace httpclient = "http://exist-db.org/xquery/httpclient";
declare namespace math-ext = "http://exist-db.org/xquery/math";

But I am unsure how to have separate contexts for different processor versions.

@CanOfBees
Copy link
Contributor

Hi @line-o -

Apologies for the state of the eXist function signatures. I recall wanting to help @rhdunn with updates to the eXist functions but then getting confused trying to determine which functions had been changed after the update to 5.0. I didn't do a very good job exploring in-depth or asking the right questions.

As for getting different processor versions, there are some annotations for that, which can be found in the following annotations.xqy file. For a possible example, see some of them used in the BaseX modules; e.g. admin.xqy.

Hopefully that's helpful.
Best!

@line-o
Copy link
Contributor Author

line-o commented Nov 17, 2021

@CanOfBees Hi!
I puzzled together a possible solution to add a separate static context for existdb versions 5 and up. But this is my first time writing Kotlin so there is very likely a more elegant solution. :)

@duncdrum
Copy link

nice work you might want to update the readme to mention 5.3.0 as well

@@ -17,8 +17,12 @@ declare %a:since("exist", "4.4") %a:deprecated("exist", "4.4") %a:see-also("exis
declare %a:since("exist", "4.4") %a:deprecated("exist", "4.4") %a:see-also("exist", "4.4", "sm:chmod") function xmldb:chmod-resource($collection as xs:string, $resource as xs:string, $mode as xs:integer) as item() external;
declare %a:since("exist", "4.4") function xmldb:clear-lock($collection-uri as xs:string, $resource as xs:string) as xs:string? external;
declare %a:since("exist", "4.4") function xmldb:collection-available($collection-uri as xs:string) as xs:boolean external;
declare %a:since("exist", "4.4") function xmldb:copy($source-collection-uri as xs:string, $target-collection-uri as xs:string) as item() external;
declare %a:since("exist", "4.4") function xmldb:copy($source-collection-uri as xs:string, $target-collection-uri as xs:string, $resource as xs:string) as item() external;
declare %a:deprecated("exist", "5.0") %a:since("exist", "4.4") %a:see-also("exist", "5.0", "xmldb:copyt-resource") %a:see-also("exist", "5.0", "xmldb:copyt-collection") function xmldb:copy($source-collection-uri as xs:string, $target-collection-uri as xs:string) as item() external;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stupid typo here :( xmldb:copy-*
QUESTION: Can the see-also annotation be used multiple times?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the see-also annotation can be used multiple times. Currently, these annotations are not used by my plugin. They are there when I do get that working. I have the data model in place, so I just need to query the annotations and add the corresponding inspection code that checks these annotations.

@rhdunn rhdunn merged commit b86a2d1 into rhdunn:master Nov 18, 2021
@rhdunn
Copy link
Owner

rhdunn commented Nov 18, 2021

Merged. Thanks!

@line-o line-o deleted the fix/existdb-function-signatures branch November 18, 2021 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants