Extract BPMN elements via XPath/XQuery
Our company has begun using Visio 2013 to create BPMN 2.0 models. I want to be able to extract some of the key BPMN elements (Lanes, Pools, Activities/Tasks) as text so I can put in an Excel file to essentially have 2 lists - 1 for Current State and 1 for Future State.
I believe I'm read all the Visio 2013 documentation regarding the file layout and use of .Net. So, I have the correct Visio page's XML but using .Net isn't an option for me. Instead, I've been trying to learn enough Xpath and XQuery to get out what I need.
So far, I have a working XQuery (below with results) which lists the BPMN elements note above but the XQuery is obviously deficient as Activities/Tasks are not listed as XML elements under their respective lanes/pools. Ideally, I'd like to get the results shown as a hierarchy like this: Lane=>Pool=>Activity=Task but clearly there's connectivity info in the Visio XML file I'm not taking into account.
Could a Visio 2013 XQuery expert please help me...or better the community, by posting some common BPMN XQuery examples, including up/downstream connectivity? I would really, really appreciate it!
Joe
==============================
let $doc := .
for $s in $doc//a:PageContents/a:Shapes/a:Shape/a:Section[@N = "Property"]
let $r := $s/a:Row [@N="BpmnName"]
let $c := $r/a:Cell
let $rs := $s/a:Row [@N="BPMNLanes" or @N="BpmnPoolElementType" or @N="BpmnTaskType" or @N="BpmnActivityType"]
where exists($r) and exists($rs)
return if ($rs/@N = "BPMNLanes")
then <Lane>{data($c/@V)}</Lane>
else if ($rs/@N = "BpmnPoolElementType")
then <Pool>{data($c/@V)}</Pool>
else <Activity>{data($c/@V)}</Activity>
==========================================
<Lane>Event Management</Lane>
<Pool>Customer</Pool>
<Pool>Notification</Pool>
<Pool>Outage</Pool>
<Activity>Outage Recorded</Activity>
<Activity>Notify</Activity>
<Activity>Customer Information Saved</Activity>
<Activity>Update Outage Information</Activity>
<Activity>Notify the Customer</Activity>
<Activity>Submit Outage Ticket</Activity>
<Activity>Get Updates on their service disruption</Activity>
<Activity>Login</Activity>
<Activity>Submit Information</Activity>
<Activity>Submit Events</Activity>
<Activity>Enter email &amp; mobile information</Activity>
<Activity>Provide Information</Activity>
October 21st, 2013 7:00pm

Without a diagram (test case) to work with, it could be difficult. I'd start over here for developer tips

http://blogs.office.com/b/visio/archive/2013/01/29/10-tips-for-developers-working-with-the-visio-vsdx-file-format.aspx

and over here for an example of taking a drawing apart

http://pkgvisio.codeplex.com/documentation

My personal choice would be to use the Visio API first rather than go via XML. If you're using the XML path you should really consider LINQ.

al edlund

Free Windows Admin Tool Kit Click here and download it now
October 21st, 2013 9:33pm

Al, I appreciate the reply.  I had previously reviewed the Visio 2013 file format article (http://msdn.microsoft.com/en-us/library/office/jj684209.aspx) but I'm not a developer so API and .Net recommendations are not possible.  XPath and XQuery are at least tools within the realm of use for me.

While the Visio 2013 schema is well documented, I see very little, outside of a couple examples, of what the data means and how the data relates to other data within the file.  That is what I'm looking for.

It seems that Microsoft would have such information and likely many XPath/XQuery files to quickly pull information as they test BPMN development. 

Anyway, if neither the documenation nor code samples are available, I'd be happy to send a BPMN 2.0 Visio 2013 file as a sample to anyone who can help crack the Visio BPMN XPath/XQuery nut.  I really believe this could help a lot of non-developers get information out of Visio for use with other tools (ex. Excel, Access, Word, etc.) - i.e. mine data from the diagram.

Regards, Joe

October 28th, 2013 1:41pm

Hi,

Extract the BPMN elements via XPath is a key feature for me and I'm about to try Visio for my company's BPMN processes. Will I get the same issue with the last version of the bpmn software (2013) ?

Thank you

Free Windows Admin Tool Kit Click here and download it now
May 15th, 2015 5:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics