siqueirarenan / shacl-jsonschema-converter

3 stars 0 forks source link

Converting ttl fails on missing property #2

Open lemoustachiste opened 1 year ago

lemoustachiste commented 1 year ago

Hi,

I'm trying to convert this TTL: https://github.com/european-commission-empl/European-Learning-Model/blob/master/rdf/ap/edc/EDC-generic-full.ttl to a json schema, and your package seems to offer that option.

But as I set up the code to parse the ttl and run, I am getting this error:

targetClass is required in model

The actual error is:

TypeError: Cannot read properties of undefined (reading 'trim')
    at getShapeName (/Users/julien/work/shacl-research/node_modules/shacl-jsonschema-converter/dist/converter.js:259:13)

because it seems to expect to have this property defined:

.find(x => x.trim().startsWith('<http://www.w3.org/ns/shacl#targetClass>'))

Which is not present in the TTL file from the EU. I have 0 knowledge of SHACL format, this is the first time I am confronted to it, so I don't exactly know what's correct or not. The EU team has the document published as XML here: https://publications.europa.eu/resource/authority/snb/model/ap/edc-generic-full so I expect it to be somewhat valid? Should the targetClass definition be made optional?

Thanks for your help

siqueirarenan commented 1 year ago

Hi @lemoustachiste , this package definitely does not cover all the specifications of SHACL. I published it because I couldn't find any other converter and I needed that for an specific project. As I see, I was using the target class field to define the field "title" of the model in the schema. If I remember right, this was more about documentation purposes. You may branch the repo and do this adjustment yourself.