Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6048405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:27:35+00:00 2026-05-23T07:27:35+00:00

I store my entities in the eXist XML database and I use a file

  • 0

I store my entities in the eXist XML database and I use a file name (resource id) as an ID of an entity.

Example:

String xquery = "for $movie in collection('/db/movie')//movie "
    + "return $movie";

After executing this query I retrieve org.xmldb.api.base.Resource instance whose content I use to create an entity. When I want to set an id of this entity, I do it like this:

dvd.setId(rs.getId());

The problem is that if I execute query like this:

String xquery = "for $dvd in collection('/db/dvd')//dvd "
        + "return <dvd>"
        + "{$dvd/title}"
        + "{$dvd/type}"
        + "{"
        + "<content>"
        + " {"
        + " for $movie in $dvd/content//movie"
            + "     let $movieIn := doc(concat(\"/db/movie/\", $movie/@id))/movie"
        + "     return "
            + "                    <movie id=\"{$movie/@id}\">"
            + "                          {$movieIn/name}"
            + "                          {$movieIn/director}"
            + "                          {$movieIn/year}"
            + "                          {$movieIn/country}"
            + "                          {$movieIn/actors}"
            + "                          {$movieIn/genres}"
            + "                    </movie>"
        + " }"
        + "</content>"
        + "}"
        + "</dvd>";

rs.getId() returns null. I also tried method getDocumentId() from this class, but it returns null as well. Is there a way of making it return the id of the resource (which is the name of the file which the entity is stored in) ?

If it’s not possible, is there a way (function or something) of getting the file name of the file which I’m working with (I mean, the database retrieves data from) with an XQuery query ?

I tried replacing this line:

+ "return <dvd>"

with this:

+ "return <dvd id=\"{$dvd}\">"

(so that I could get the name of the file from the attribute) but it doesn’t return the file name.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:27:35+00:00Added an answer on May 23, 2026 at 7:27 am

    You might be looking for fn:base-uri(). See here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are several approaches how to store entities hierarchy in relation database For example
I am using eXist xml database now.Normally, I just store regular xml files in
I store some time values in sqlite in %H:%M string format (for example 15:43),
I am working on an application which will store some entities which have name,
For example I have data model like this Entity: Store Entity: Inventory Entity:Product Attribute:
I need to store localized entities in a database (for instance a Product, which
I'm dealing with a large group of entities that store locations. They are displayed
In my program I have two classes: Collector and Entity. Collector stores Entities in
I store various user details in my MySQL database. Originally it was set up
The major shortcomings with Entity-Attribute-Value database designs in SQL all seem to be related

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.