Venn diagram generation software from RCC(8) specification or similar

后端 未结 3 519
暗喜
暗喜 2021-02-02 10:41

Please note: While the bounty is no longer available, I\'m still keen for anyone with an answer to this question to contribute; I\'m still watching it, and I\'m

3条回答
  •  温柔的废话
    2021-02-02 11:06

    I don't know of any software that can generate such diagrams. However, If I had to tackle your problem I would probably explore the possibility of using Scalable Vector Graphics (SVG). I think you can translate your DSL for RCC into SVG XML, and then you can render it (maybe in a Web browser). You can easily find examples on the Web by searching for "svg venn diagram". A nice one is here: here's a diagram that I generate from that website

    enter image description here

    and here's the corresponding SVG code (also from the website):

    
    
        
    WIBR Venn diagram
        
        
    
    

    There's also an Apache toolkit for SVG called Batik, which should support display, generation or manipulation of SVGs.

    Another option is to use TikZ & PGF with LaTeX: there you have powerful macros that let you programmatically place shapes, and the rendering is done by LaTeX. Here's an example:

    \documentclass[a4paper,10pt]{article}
    
    \usepackage{tikz}
    \usetikzlibrary{shapes,calc}
    
    \begin{document}
    
    \pagestyle{empty}
    
    \begin{tikzpicture}
    
        \node (TPP) {X TPP Y};
    
        \node
            [ circle,
                draw,
                minimum width=2cm,
                label={[label distance=-0.7cm]145:X},
            ] (X) [right of=TPP,xshift=1cm] {};
    
        \node
            [ circle,
                draw,
                minimum width=1cm,
                anchor=south east,
            ] (Y) at (X.south east) {Y}; 
    
    \end{tikzpicture}
    
    \end{document}
    

    which produces the following (i.e. the RCC8 TPP relation):

    enter image description here

    You can see from the LaTeX code that you can draw the Y circle at south west of X (X.south west) saying that Y's anchor is also at south west (anchor=south west). You can find a more complex example here, and some additional discussion here.

    Although this is not yet a layout algorithm that draws RCC8 relation for you, I think you can define LaTeX macro that translate RCC8 relations into PGF/TikZ macros. The drawback is that you must then compile the LaTeX code.

    I hope this helps and good luck!

提交回复
热议问题