Hi Luke,
Here’s some information to get you started. There’s a multitude of ways to link
documents together in Marklogic, some of them are:
*using a separate rdf structure
–pros: easily extendable, can link to others resources
–cons: it’s a separate structure you will need to have your code query for
those relations.
*using embedded rdf
–pros: more connected to the document
–cons: you have rdf in the document that your standard may or may not allow
*Using an envelope structure, enveloping your xml as part of a little bigger
xml document in which you put all required metadata including parent child
document relations (xlink).
-pros: metadata connected to each document
-cons: using the xml as a whole always involves
grabbing the content within the document.
*Adding the link information to the document, preferably using the xlink
namespace. Marklogic have functions for expanding xlinks (
https://docs.marklogic.com/xinc )
-pros: all links in the document itself where they
logically links to the other resource, easy to do node expansion if you want
the whole document with children.
-cons: maintainability can be harder as you can
have links scattered around your content. You have to modify your content.
For more information on some of the different ways have a look at
http://www.marklogic.com/resources/slides-moving-from-relational-modeling-to-xml-and-marklogic-data-models/resource_download/recordings/
From you question it sounds like your into the xlink idea.
To insert all links during ingestion with mlcp you should be able to write a
transform that extends mlcp (see
https://docs.marklogic.com/guide/mlcp/import#id_82518 ) in which you can add
the id and relations. The question is if you have that data available in that
stage (in the document or in a separate file uploaded before the actual
ingestion).
Another way is to create the xlinks before ingestion, using any method you like.
I hope this was of some use ☺
Regards
Erik
Från: [email protected]
[mailto:[email protected]] För Lucas Davenport
Skickat: den 5 juni 2017 16:16
Till: [email protected]
Ämne: [MarkLogic Dev General] Cross-document links via IDs
We are exploring the options of incorporating ML as our document storage engine
for our application. Currently our data is stored in an RDBMS, but we can
easily export the data in XML format. One issue that we're currently having
while developing the model is the need to keep some relational integrity
between some documents (parent-child). I know from the limited research I've
done that cross-document links are available with ML. However, I do not know if
it is possible to create auto-generated ids in ML for such documents. Can ML
create/generate id values for parent/child documents on-the-fly during
ingestion (we'll likely use mlcp)? If so, can anyone point me in the right
direction for more info on how these are created and/or the configuration
required.
Thanks in advance!
Best Regards,
Luke
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general