1

E.g.:

<test>
    <parties>
        <party>
            <partid>1</partid>
            <partyname>abc</partyname>
            <partylocation>edf</partylocation>
        </party>
        <party>
            <partid>2</partid>
            <partyname>sdc</partyname>
            <partylocation>wed</partylocation>
        </party>
        <party>
            <partid>3</partid>
            <partyname>rfg</partyname>
            <partylocation>tgh</partylocation>
        </party>
    </parties>
</test>

If we have multiple child element with the same name. How to handle it in TDE for triples?

How to get triples out of this xml for all the child and sub child element.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
AKG
  • 31
  • 2
  • I don't understand what you're asking. For what do you use TDE? All I can see is an XML document, so far so good, and now? If you want to convert XML to RDF, use an XSLT script or nay other XML to RDF tool. Indeed, you have to define some mapping. – UninformedUser Jun 25 '19 at 08:47

1 Answers1

1

You probably want separate triples per party element. That is just a matter of using that element as context, for instance by using a context path like /test/parties/party.

In case you have optional element, and would like to generate triples for those only if they exist: add sub-templates with their own context path, relative to the main one, pointing to the optional element.

Below a link to documentation about nested templates. It speaks of creating views, but the same trick of nesting templates works on triples as well:

https://docs.marklogic.com/guide/sql/creating-template-views#id_28999

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35
  • I gave an example using sub-templates for triples here: https://stackoverflow.com/a/56789109/918496 – grtjn Jun 27 '19 at 10:32