Florian,
As is said in my previous mail, element scheme with ID references is not well implemented. element(//*[@Id='sid-D453B3D6-0EA6-4607-A413-C6332ABE9F32']) will not be resolved.
You have to determine identified node paths, and replace ids with those paths (element(/1/n1/n2/n3...)
BTW, you have to add a fallback element in your <include/> tags
You will obtain sthg like:
<Links xmlns:xi="http://www.w3.org/2001/XInclude">
<Link>
<xi:include href="process-db.xml" xpointer="element(/1/nx1/nx2/.../nxn)">
xi:fallback...</xi:fallback> </xi:include>
<xi:include href="requirements.xml" xpointer="element(/1/ny1/ny2/.../nyn)"> xi:fallback...</xi:fallback> </xi:include>
</Link>
</Links>
That's not a very satisfactory solution - I know - but it works...
Jérôme
Le 27/04/2015 17:18, Eckey, Florian a écrit :
Hi Jérôme,
i tried to load following xml document (linking-test.xml) in basex (with deactivated internal parser and activated xinclude option) as you mentioned:
<Links xmlns:xi="http://www.w3.org/2001/XInclude">
<Link>
<xi:include href="process-db.xml" xpointer="element(//*[@Id='sid-D453B3D6-0EA6-4607-A413-C6332ABE9F32'])"/>
<xi:include href="requirements.xml" xpointer="element(//*[@Id='11cc0940-c8fb-4b81-920a-1ab5aea30037'])"/>
</Link>
</Links>
The answer form basex is:
„basex/linking-test.xml" (Zeile 3): "include" mit href "process-db.xml" nicht erfolgreich, und es wurde kein "fallback"-Element gefunden.
(I use the german version J; translated: „include“ with href „process-db.xml“ was not successful, and there is no “fallback”-Element found.)
It seems, there is no document with path “process-db.xml”, but it is! If I try: db:path(doc(“process-db”)) it returns “process-db.xml”
Have you any idea, what’s my mistake? Maybe the documents to link have to be stored in a different way?
Thanks and Regards
Florian
*Von:*Jérôme Chauveau [mailto:jerome.chauveau@unicaen.fr] *Gesendet:* Montag, 27. April 2015 16:18 *An:* Eckey, Florian *Cc:* basex-talk@mailman.uni-konstanz.de *Betreff:* Re: AW: [basex-talk] XLink and XPointer
Florian,
When the XINCLUDE option is enabled, xpointers are automatically executed.
/xpointer/ attribute has to be used on an /<include/>/ element (/href/ one is required to point on the xml document)
With this xml contents: in *yourdb/linking.xml:*
<Links*xmlns:xi="http://www.w3.org/2001/XInclude" http://www.w3.org/2001/XInclude*>
<Link> (linking activities with requirements)
<*xi:include href=*”requirements-db.xml” x*pointer=”element(/path/to/activity/with/activity-id-node)”*/> *
<*xi:include href*=”bpmn-db.xml”
*xpointer=”element*(*/path/to/requirement/with/requirement-id-node)*”/> *
</Link>
</Links>
- Unfortunately, element scheme with node IDs is not well implemented
(according to my tests) unless your documents are validating against a DTD (link http://www.w3.org/TR/xptr-framework/#term-ddi).
When you'll execute this query (on the REST interface for example):
doc('yourdb/linking.xml')/links/link[1]
will returned:
<Link> (linking activities with requirements) <Activity Id=”activity-id”>
…
</Activity> <Requirement Id=”requirement-id”>
…
</Requirement>
</Link>
Hope this helps,
Jérôme.
Le 27/04/2015 15:35, Eckey, Florian a écrit :
Hi Jérôme, thanks for your input. Following situation: I have two documents in different xml databases (basex). On the one side a business process model document (bpmn 2.0) and on the other side a requirements specification document. These documents have to be consistent. One approach to handle consistency is linking specific elements of both documents with each other. In my approach, i need to link activities (xml nodes) and specific requirements (xml nodes) with each other. So the second approach seems to fit best. I understand the syntax of this approach, but one time I have to evaluate this xpointer expressions. Is the evaluation implemented anywhere? Or how can I do this? Maybe I even don’t need xinclude, but rather something like this (more similar to xlink; linking in an external document): Business process document (xml database in basex): <Package> … <Activity Id=”activity-id”> … </Activity> … </Package> Business process document (xml database in basex): <Requirements> … <Requirement Id=”requirement-id”> … </Requirement> … </Requirements > Linking: <Links> <Link> (linking activities with requirements) <Locator href=”requirements-db” xpointer=”element(Activity[@Id=$activity-id])”/> (use xinclude here feels wrong) <Locator href=”bpmn-db” xpointer=”element(Requirement[@Id=$requirement-id])”/> </Link> </Links> Is there something similar? Especially to execute xpointer? Or do I have to implement it on my own? Thanks for your answers. Regards. Florian *Von:*basex-talk-bounces@mailman.uni-konstanz.de <mailto:basex-talk-bounces@mailman.uni-konstanz.de> [mailto:basex-talk-bounces@mailman.uni-konstanz.de] *Im Auftrag von *Jérôme Chauveau *Gesendet:* Montag, 27. April 2015 15:07 *An:* basex-talk@mailman.uni-konstanz.de <mailto:basex-talk@mailman.uni-konstanz.de> *Betreff:* Re: [basex-talk] XLink and XPointer Hi Florian, The XINCLUDE Option is enabled in the default BaseX configuration. Which kind of xpointer link do you need? Those 2 inclusion types seems to be well-implemented is the Java XInclude support (xinclude implementation used in BaseX): 1 - full document inclusion: <xi:include href='myDocument.xml'/> 2 - Fragment inclusion: <xi:include href='myDocument.xml' xpointer='element(/1/path/to/fragment' /> Hope this helps, Regards. Jérôme Le 27/04/2015 13:29, Eckey, Florian a écrit : Hello, i am actually writing my master thesis using basex for xml processing. I need to create consistency links between two xml documents, especially basex databases and its content. So I am certainly looking for xlink and xpointer implementations in basex. Are there any examples to do this with basex or if not, has anyone implemented an xquery version to execute it? I recoginzed that there are capabilities with xinclude. But I does not find any references of xinclude in basex, unless this: http://docs.basex.org/wiki/Options#XINCLUDE So has anyone ideas or experiences using xlink and especially xpointer with basex or xquery? Regards, Florian ------------------------------------------------------- >>> business. people. technology. <<< ------------------------------------------------------- adesso AG mit Sitz in Dortmund Vorstand: Michael Kenfenheuer (Co-Vors.), Dr. Rüdiger Striemer (Co-Vors.), Christoph Junge, Andreas Prenneis Vorsitzender des Aufsichtsrates: Prof. Dr. Volker Gruhn Amtsgericht Dortmund HRB 20663 -- Jérôme Chauveau - CERTIC-DSI - Campus I Université de Caen Basse-Normandie
-- Jérôme Chauveau - CERTIC-DSI - Campus I Université de Caen Basse-Normandie