Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generates invalid dot for structs #7

Closed
SevereOverfl0w opened this issue Dec 11, 2020 · 3 comments
Closed

Generates invalid dot for structs #7

SevereOverfl0w opened this issue Dec 11, 2020 · 3 comments

Comments

@SevereOverfl0w
Copy link

Clojure 1.10.1
user=> (require '[cljol.dig9 :as d])
nil
user=> (defstruct foo ::a)
#'user/foo
user=> (d/view [(struct foo 1)])
nil
user=> (d/write-dot-file [(struct foo 1)] "/tmp/myfile.dot")
nil

is invalid dot, on line 44:

Error: /tmp/myfile.dot: syntax error in line 44 near 'node'
@SevereOverfl0w
Copy link
Author

"30507711832" -> "30507711768" ["field-name"=node,label=node]; should be "30507711832" -> "30507711768" ["field-name"="node",label="node"];

@jfingerh
Copy link

I find it odd that

(a) the dot line numbers are often way off on what a standard text editor considers the line number in the dot file. Unfortunate, and I have no time/interest to pursue improving on that, but it would be nice for problems like this.

(b) there are many other lines in the dot file produced that have ["field-name"=some_string,label=some_string] that give no such error. It seems that the line you point out in the previous comment is an error for dot because node is some kind of reserved or key word in its syntax.

It might be safe to change the code doing the writing of the dot file to always put double quotes around string values. As you mentioned in a private message, it is probably the Dorothy library doing the actual writing here, so a couple of libraries down the call stack from cljol. I may find some time to dig into ubergraph and dorothy to see if there is a small change to one or both of them that would fix this, but it might be that changing cljol's code alone cannot fix this.

@jafingerhut
Copy link
Owner

jafingerhut commented Dec 13, 2020

I have created a forked version of the dorothy lib with a proposed fix:

https://github.com/jafingerhut/dorothy/tree/andy-fixes1

At least, it avoids the problem you were seeing with the use case in this issue. The latest README of this project now gives a new commit SHA that is recommended to use, which depends upon this forked version of the dorothy lib, and also a forked version of ubergraph that uses the forked version of dorothy.

If dorothy is updated with the proposed fix, or something else just as good, and a new release is created, then we can see whether ubergraph will update to use it, too, and then I won't need the forked versions any more. You can track the dorothy issue here: daveray/dorothy#18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants