command line/tools (how) to convert RDF to OWL in python - python-2.7

I have an ontology in RDF format and i will need to convert it into an owl format. what libraries are available for use in python? Thanks

What's the distinction? It's the same file with a different filename appended (.rdf vs .owl)?
Have you tried RDF2RDF? It's a jar, but that means it can be called from the command line---or within a python script.

Related

Why can't I load a simple CSV into Python 2.7 32 bit?

enter image description here
I am reading an e-book on machine-learning by Dr. Joseph Brownlee.
This is the code from the book, and this is what I am getting. ( I do have the CSV. )
It may be my computer, because I haven't been able to load a CSV from any version of Python 3.
Why?
Josh, your python-interpreter is not using the same installation as Jason uses.
First: check, where is the Jason's CSV-file actually located ( python did not find it in his location )
Next: get that file moved/copied into your python-interpreter's directory.
In case: you may load the "classical" ML-dataset from here, just put it into the same directory, as your python is located and rename the file to match your .csv CSV-example
If all fails: ask Jason, where is the missing file, if it was some modified version of the "classic" ML-dataset.
Python 2.7 will make it. Do not panic. There is no need to worry about any Py3 remarks. Except for some printing issues to fix, the course will work for you in Py27 either.
You need to start the Python interpreter in the same folder as your csv file. Best way to do that would be write a Python script in the same folder, then just execute it
or give the full path to the file. open(r"C:\Users\username\files\blah.csv")
Also, you're using Python27, not Python3, and both will work, so it's recommended nowadays to use Python3

How do I convert dub.sdl into dub.json?

Since MonoD doesn't let me add use dub libraries natively I need to write dub.json myself. A good start would be to use an already existing template produced by e.g. dub init, but unfortunately this command produces a project that uses a competing dub.sdl and for some reason I cannot find any option to tell it to create a dub.json instead.
How do I convert a dub.sdl into dub.json so I can use it with MonoD?
As said by dub init --help, there is an option for generating JSON file instead of SDL:
-f --format=VALUE
Sets the format to use for the package description file. Possible values: sdl, json
So, try dub init --format=json.
DUB package of DUB is good for you.
It contains first hand library code it takes to
load,
manipulate and
save
packages (be it in SDL or JSON format).
Of course you've got to get your hand dirty to do the appropriate plumbing (writing a package converter command line utility in your case for instance).

making a subdirectory of static dir a python module?

I'm using a python file as a data (because it is easier to use constant defined in python file this way).
Since my other data files are organized under a static directory, I'd like to make those data directories as a python module (putting __init__.py) so that I can use data.py under those directories as a python module.
Would you advise against it?
According to your last comment, you probably want to use json fixtures : https://docs.djangoproject.com/en/1.5/howto/initial-data/#providing-initial-data-with-fixtures

Reading Django documentation with restview

I am using Fedora 18 on Virtual Box on my Windows XP desktop to learn Django. After going through the .txt documentation files, I discovered these files were written using restructuredText. I've been spending the last day or so trying to figure out how to convert the files into something readable (HTML, Latex, PDF, etc.). First thing I did, was install docutils (from source - download page) and used rst2html.py to convert the files to HTML to be readable.
When I used this tool, I was getting the Unknown interpreted text role "doc", Unknown interpreted text role "ref", Unknown interpreted text role "term" errors, and more when opening the docs/intro/index.txt, docs/intro/install.txt and docs/intro/tutorial01.txt files. I was able to find very little on Google describing the exact problem I was having so I tried to use a different option.
Naively thinking the errors were native to docutils I decided to search for another tool and found this page and installed restview. Well, I didn't realize restview used docutils so I ended up back at square one.
How do I get rid of these and other errors? Did I install docutils and restview correctly?
Please tell me if I need to add more info
You need to use Sphinx. This tool is used by the Django project and it defines additional reStructuredText constructs to complement those defined by docutils. Such as
http://sphinx-doc.org/markup/inline.html#role-doc
http://sphinx-doc.org/markup/inline.html#role-ref
http://sphinx-doc.org/markup/inline.html#role-term

Embedding Lua: how to programatically save a script to a folder, how to compile a script?

I am embedding Lua in a C++ application, and I am using luaL_dofile to load a script
However, I cannot seem to find documentation on the functions to use to:
Compile a script (and save byte stream to a specified folder)
Save a script to a specified folder
last but not the least, when I use luaL_dofile to load a script into the Lua engine, if the loaded script has a line that loads a module for example:
require 'strict'
which directory would the script.lua (or its compiled version) be loaded from?
Look up luaL_loadfile and lua_dump. See also test/luac.lua.
For the question about where Lua looks for modules require'd: It depends on package.path and package.cpath variables, which can be influenced by the environment variables LUA_PATH and LUA_CPATH.