Query diagram objects in markup of XWiki pages


I have created a diagram here:

The page source is as follows:

<mxGraphModel dx="458" dy="501" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" background="#ffffff" math="0" shadow="0">
    <mxCell id="0"/>
    <mxCell id="1" parent="0"/>
    <mxCell id="2" value="" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
      <mxGeometry x="200" y="150" width="120" height="80" as="geometry"/>
    <mxCell id="3" value="Untitled Layer" parent="0"/>

How can I make reference to a particular object in this diagram from another page?

For example, I might want to make reference to the ellipse on line 5:

<mxCell id="2" value="" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">

I might want to say, on another page:

The place is located as shown by the ellipse here.

How would I go about this?

What do you expect to happen when the user clicks on the link?

I see the problem. Unless the diagram linked to has the ability to highlight the ellipse then the exercise is in vain. However, I was thinking more of a semantic link, such that the effect of clicking the link is not so important as the information contained in the link, i.e. the relation between the linking page and the linked “ellipse object.”

Our integration doesn’t support this ATM but https://about.draw.io/interactive-diagrams-with-custom-links-and-actions/ seem to suggest that the library we use has support for highlighting shapes so it should be possible to implement this on our side also.

The most common way to reference an XML element is using:

  • an identifier
  • a CSS selector
  • an XPath selector

So you could write:

The place is located as shown by the ellipse [[here>>Path.To.Diagram||anchor="put ellipse selector here"]]

But it won’t have any effect ATM when the link is clicked and there’s no guarantee that the selector you use is the selector we’re going to support when we’re going to implement this feature in the Diagram Application.

That answers my question. Thanks very much for your help. I guess the ideal situation would be to be able to construct a SPARQL query to insert a link dynamically, referencing the ellipse using whatever semantic property information is already available in the XWiki.

My initial thought was to add RDFa attributes to the diagram

   <mxCell .style="ellipse.." ... value="/wiki-pages/My Place" property="/wiki-pages/Shows location of">
. ..

Which creates the RDF triple (subject-property-object):

<> </wiki-pages/Has location> </wiki-pages/My Place>

Then link to this from the “My Place” page by querying for the property “Shows location of” with the specific value “My Place.”

I find Wiki semantics restrictive. In RDFa, you can use the “about” attribute to specify a relation between two external resources. In wiki software, you are usually restricted to specifying a link between the current page and an external resource.

I have come across subobjects in Semantic Mediawiki. It would be great if I could specify the direct link between that ellipse and the “My Place” page but I have no idea how to do that, even in Mediawiki with its subobjects.

I guess the problem is that once you introduce markup that is not wiki markup, you have to give it the same ability to be marked up semantically as ordinary wiki text.