Export vector graphics from OntoGraf plugin in Protege - semantic-web

Is there any way to export Scalable Vector Graphics (SVG) from OntoGraf plugin in Protege? Or is there a similar plugin, from which SVG can be exported?

This can be achieved the following way:
Inside Protege and in the OntoGraph tab, click the button Export Graph to DOT (before last icon). Save it as onto.dot somewhere on your machine.
Then open a terminal and convert the .dot file into SVG: dot -Tsvg onto.dot > output.svg
The file output.svg is the SVG version of your graph.

Related

Using mathtext parser to output a svg file

Context
I'm looking for a simple way to import properly typeset mathematics (with LaTeX) into blender. A solution for this has already been given. But that means getting out of blender, using multiple tools and then going back to blender and importing the whole thing.
Blender comes with Python and can import svg
I'd like to find an other way and blender has a set of powerful tools based on Python. I was thinking: can I make Python parse some TeX input and then generate a svg (virtual) file inside blender. That would solve the problem.
matplotlib "emulates" TeX
It is possible to install any Python library and use it inside blender. So this made me think of a possible "hack" of matplotlib.
mathtext is a module that provides a parser for strings with TeX-like syntax for mathematical expressions. svg is one of the available "backends".
Consider the following snippet.
import matplotlib.mathtext as mathtext
parser = mathtext.MathTextParser('svg')
t = parser.parse(r'$\int_{0}^{t} x^2 dx = \frac{t^3}{3}$')
t is a tuple that has all the information needed. But I can't find a way (in the backend api) to convert it to a (virtual) svg file.
Any ideas?
Thanks
Matplotlib needs a figure (and currently also a canvas) to actually be able to render anything. So in order to produce an svg file whose only content is a text (a mathtext formula) you still need a figure and a canvas and the text needs to actually reside inside the figure, which can be achieved by fig.text(..).
Then you can save the figure to svg via fig.savefig(..). Using the bbox_inches="tight" option ensures the figure to be clipped to the extent of the text. And setting the facecolor to a transparent color removes the figure's background patch.
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
fig = Figure(figsize=(5, 4), dpi=100)
canvas = FigureCanvasAgg(fig)
fig.text(.5, .5, r'$\int_{0}^{t} x^2 dx = \frac{t^3}{3}$', fontsize=40)
fig.savefig("output.svg", bbox_inches="tight", facecolor=(1,1,1,0))

Blender collada export multiple animations

I want to export a model with multiple actions to Collada file to use it in openGL ES2, the collada exporter exports only the selected or active action, after many researches I did not find a solution but get idea which is making actions in the same animation in different frames and separate them by the code so I added custom properties to the object to define each action start and end frame but the exporter does not export these properties too, I find a patch which enable the exporter to add custom properties but I can not build from source code because I do not have experience in visual C++ and python, so I appreciate any solution to achieve exporting multiple animations in one dae file.
There is no way with the builtin Blender Collada exporter. I wrote my own Python exporter with the ability to grab animations from the NLA Editor and output multiple animations as elements in Collada. https://github.com/gregeryb/Better-Collada-1.5-DAE-export-plugin-for-Blender

JavaFX Fontawesomefx - main app icon

I am trying to set up my main app icon using Fontawesomefx:
I'm using IntelliJ 2016 and I have imported the Maven libraries for Fontawesomefx 8.9 and Controlsfx 8.40.12 library (as it was stated it helps Fontawesomefx).
I am tying to get this very simple thing working:
I tried to cast it into Image, I tried to convert from Text to Image, I tried other types of casting and conversion yet unsuccessful so far.
Some aditional info:
FontAwesomeIconView extends GlyphIcon<FontAwesomeIcon> //Fontawesome lib
GlyphIcon<T extends Enum<T> & GlyphIcons> extends Text //Fontawesome lib
Text extends Shape //Java lib
Shape extends Node //Java lib
There are plenty links setting up an icon/text/label inside the app, but I couldn't find anything which sets the main app icon.
Any links, any help is much apreciated!
I don't think you will be able to do this directly.
FontAwesome is a set of Unicode characters in the private use area. When you use FontAwesomeFX to create an icon what you actually get is a Text node containing a single unicode character.
The application toolbar icon is set on the Stage as a list of Image objects (you can have icons of multiple sizes). An image must be a GIF, PNG, BMP or JPEG.
You would need to convert the Text node into an Image node to achieve what you want. You could just write a one-off app to render the icon you want into a label on a panel, screenshot that, and save it into a PNG resource that you then use as your app icon.
Or you could load the icon into a node, and use the snapshot() method to create an image from the rendered representation.

Exporting animations from blender to use with Assimp

I noticed that if I export my blender project as a obj-file I have the option to toggle "Export Animation" which will make alot of files, one for each frame.
I wanted to use the Collada (.dae) format to export my animations. Problem is, when I load my Collada file it says that NumAnimations == 0!
1) Why does a file that is supposed to store animation say 0 animation?
2) When I do get it to work, how to I swap between frames in Assimp?
1) Animation import should work, your problem is probably the export. Have you tried reading through your collada file? Watch for <library_animations> and the like.
2) Assimp has no notion of frames. aiAnimation consists of multiple channels (aiNodeAnim) which define transformations (keyframes) for nodes at specific ticks/time. To compute all transformations one needs to interpolate the correct keyframes depending on the current playback time and mTicksPerSecond of aiAnimation.

Transparent inline matplotlibs in IPython

I'd like the background of my matplotlib plots to be transparent in my IPython notebook. This may sound silly because the notebook itself defaults to a white background but:
1) I use a solarized background and
2) more importantly, I want them to be transparent for when I embed the notebook directly into my blog via nbconvert.
It's easy enough to use something like savefig('file', transparent=True) , but I'm not saving the figures, I am displaying them inline (by calling IPython with ipython notebook --matplotlib inline.
I've been playing around with the IPython notebook configuration file, especially with c.InlineBackend.rc. For example, I upgraded to the dev version of matplotlib to get access to its new savefig.transparent rcParam, and tried configuring that with c.InlineBackend.rc = {'savefig.transparent': True}, but as expected it only affects plots saved with savefig.
Note that I am using the recent IPython 2.0 release. This must be possible somehow, right? Any light that you can shed would be appreciated.
Just to follow up, the issue opened on Github by tillsten has been patched so something like this:
rcParams['figure.facecolor'] = (0,0,0,0)
should work now after you update IPython. Three cheers for open source.
The inline plots are html objects (<img>) with class ui-resizable. So you can change their default behavior by customizing the CSS for your notebooks:
locate your settings for notebooks: in a terminal, type
ipython locate
in the indicated directory, go to subdir profile_default\static\custom (or any profile you want to use instead)
edit or create a CSS file named custom.css
put this in it:
img.ui-resizable
{
opacity:0.4;
}
Close your notebooks, kill IPython and restart it (so that it recreates the served files).
It should work with exported notebooks, as long as you export them as html and you change the css there too.
It's not exactly what you want, but it does the job.