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

return signature of apputil:resolve and apputil:resolve-abbrev : #16

Open
christophe-g opened this issue Apr 14, 2015 · 0 comments
Open

Comments

@christophe-g
Copy link
Contributor

Tiny modification in apputil.xql:
As apputil:resolve and apputil:resolve-abbrev can return an empty sequence, the signature should be xs:string? instead of just xs:string as it is now.
Cheers,
C.

(:~
 : Try to find an application by its unique name and return the relative path to which it
 : has been deployed inside the database.
 : 
 : @param $pkgURI unique name of the application
 : @return database path relative to the collection returned by repo:get-root() 
 : or the empty sequence if the package could not be found or is not deployed into the db
 :)
declare function apputil:resolve($uri as xs:string) as xs:string **?** {
    let $path := collection(repo:get-root())//expath:package[@name = $uri]
    return
        if ($path) then
            substring-after(util:collection-name($path), repo:get-root())
        else
            ()
};

(:~
 : Try to find an application by its abbreviated name and return the relative path to which it
 : has been deployed inside the database.
 : 
 : @param $pkgURI unique name of the application
 : @return database path relative to the collection returned by repo:get-root() 
 : or the empty sequence if the package could not be found or is not deployed into the db
 :)
declare function apputil:resolve-abbrev($abbrev as xs:string) as xs:string **?** {
    let $path := $apputil:PACKAGES($abbrev)
    return
        if ($path) then
            substring-after($path, repo:get-root())
        else
            ()
};
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

No branches or pull requests

1 participant