Fail to import ttl vocabularies

Hi, I’m recently trying to import vocabularies from VRA Core and LIDO. Here are the xml xsd and example files that I found on their websites:

LIDO.zip (59.9 KB)

I asked ChatGPT and it just told me to convert them into ttl using the toolbox provided by lido-rdf-converter. And I did as ChatGPT told me and Here are the ttl files that I got:

LIDO 2.zip (15.5 KB)

And here are the ttl files provided on VRA-RDF-Project:

ttl.zip (5.4 KB)

Then I attempted to import the ttl files generated. However, it seems that nothing was successfully imported. In comparison, the schema n3 file that I downloaded from LOV can be imported without any issues.

Actually, I have no idea about what was happening and what’s on earth a ttl or an n3 file. Could you please tell me how to solve this issue, I would highly highly appreciate it, thank you so much!

Could you try using the vra2rdf tool to serialize the vocabulary using the n3 format? That’s the format used by Tropy and will hopefully work. If not, please post the n3 files here and we’ll take a look.

1 Like

Thank you for the reply! I remember that turtle format is also supported by Tropy. So do you mean ttl format actually does not work for Tropy or it’s because there seems to be some problems with my ttl files?

TTL should also work in most cases, but N3 is the preferred format so that’s the one I’d use for debugging purposes (to rule out potential issues caused by the conversion).

For VRA, I tried running by following the setup instructions provided on its readme file but got an error warning:

(base) yutang@MacBook-Air VRA-RDF-Project % vra2rdf -i data/sample/xml/record1.xml -s nt
Traceback (most recent call last):
  File "/opt/miniconda3/bin/vra2rdf", line 33, in <module>
    sys.exit(load_entry_point('python-vra2rdf==0.1', 'console_scripts', 'vra2rdf')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/python_vra2rdf-0.1-py3.12.egg/vra2rdf/__main__.py", line 50, in main
  File "/opt/miniconda3/lib/python3.12/site-packages/python_vra2rdf-0.1-py3.12.egg/vra2rdf/__main__.py", line 43, in rdf
  File "/opt/miniconda3/lib/python3.12/site-packages/rdflib/graph.py", line 1518, in parse
    source = create_input_source(
             ^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/lib/python3.12/site-packages/rdflib/parser.py", line 761, in create_input_source
    raise RuntimeError(f"parse data can only str, or bytes. not: {type(data)}")
RuntimeError: parse data can only str, or bytes. not: <class 'lxml.etree._XSLTResultTree'>

As I actually have no knowledge about rdf, I really don’t know what’s happening.

As to lido, I also tried out but it seems that the formats supported by lido-rdf-converter do not include n3 (ttl,nt,json,xml only, according its instructions). I did tried running (.venv) (base) yutang@MacBook-Air lido-rdf-converter % ./lido2rdf.py example1.xml -o example1.n3 . The n3 file generated, however, cannot be successfully imported into Tropy.

It would be so nice if you could please help me out! Thank you a lot with lots of love and gratitude!!!

lido-rdf-converter-example1.zip (6.2 KB)

So for VRA Core, is there any reason why you don’t want to use the file provided by LOV? That one seems to import just fine.

As for LIDO, I looked at the files you posted. These are n3 / ttl files, but they don’t look like ‘vocabulary’ files, so Tropy will import them but won’t find any useful information. Tropy mainly uses the properties defined by a vocabulary, so you’ll need to use a n3 or ttl file with property definitions (classes and datatypes will also be imported).

Did you actually succeed in getting the VRA Core n3 file on LOV? If this is what you mean, could you please consider sending me these files? I did try several times but it seems to me that its page for VRA Core is lost.

As to LIDO, if the situation is as what you said, then it seems that all the files they provide cannot be leveraged directly. So do you mean I actually need to create a n3 file myself according to their xml schema file?

This VRA Core vocab imports fine for me.

As for LIDO I am not suggesting to create the vocabulary by hand. You can convert it from an existing file if such a file exists. The purpose of the tool you linked to above is to convert LIDO XML files to RDF not the vocabulary itself. What you need to look for, instead, is a RDF vocabulary defining all the properties used by the LIDO schema. I don’t know if the LIDO project has this file. If not, you could try creating one based on the schema XSD, perhaps using tool that can generically convert XSD to RDF or something like OWL.

1 Like

I apologise for my utter ignorance about RDF :smiling_face_with_tear:. LIDO does provide a schema XSD. And here is all the related resources listed on their website. However, the fact is that I have no idea how to convert it into a n3 file. I asked ChatGPT and it helped nothing :rofl:

I’m not familiar with LIDO myself, so I can only make some general observations. The LIDO XML schema is not something you use directly with Tropy. It describes how LIDO XML files look like. To make this work with Tropy, you would add an export plugin to Tropy that saves your items in LIDO XML. Such a plugin would likely require a mapping template to define how your item’s properties should be mapped to LIDO elements. However, you could also skip such a mapping template if you could use the LIDO vocabulary directly – if I am not mistaken, this is what you’re intending to do. For this you’d need an N3 file defining all the properties used by LIDO. It’s possible that this vocabulary file already exists as part of the LIDO terminology project. The main purpose of the terminology vocabularies seem to define values, not properties. Currently, Tropy doesn’t support value vocabularies though this is something we’d be interested adding in the future.

Thank you for your detailed response!!! Yes, I would like to import all the properties defined by LIDO so that I can better manage items using this metadata standard. I understand that I would need a n3 file to do this, however, because I didn’t know about the differences between LIDO schema XSD and its example RDF, I just confused them, as I have got really no concepts about all the related stuffs.

But as far as I know, LIDO’s project doesn’t include an ad-hoc n3 file that contains all its vocabularies. So could you please tell me how can I generate such an n3 file that can be imported into Tropy as new vocabularies according to its schema XSD or anything else. Thank you so so much for your kindness and patience!!!