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

Prevent multiple hierarchies being added to XML #1

Closed
aljoshakoecher opened this issue Jun 28, 2022 · 0 comments
Closed

Prevent multiple hierarchies being added to XML #1

aljoshakoecher opened this issue Jun 28, 2022 · 0 comments

Comments

@aljoshakoecher
Copy link
Member

aljoshakoecher commented Jun 28, 2022

There is a nasty problem which results from the fact we want use XPath to both find AND create containers.
Let's assume the SPARQL query of a mapping returns two values for a variable ?var:

?var
"abc"
"def"

Now let's also assume the XML document the mapping is written to doesn't exist and we have a container string characters/{?var}. With the given variable values, we get two interpreted container strings:

  1. characters/abc
  2. characters/def

As the document is empty, XPath won't find anything and we would instead use the two interpreted strings to create two new nodes:
1:

<characters>
    <abc></abc>
</characters>

2:

<characters>
    <def></def>
</characters>

These two nodes would be added into the DOM, which is invalid as there cannot be two root nodes. We have to make sure that whenever we create new nodes, multiple container strings do not lead to invalid parallel hierarchies. Instead of creating two nodes, we have to create a tree structure. For the above example, this should look something like:

<characters>
    <abc></abc>
    <def></def>
</characters>
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