On Thursday, January 27, 2022 at 1:08:05 AM UTC Graham Higgins wrote:

> the output is...a bit messy, but it's RDF and thus programmatically 
>> accessible to me for alteration/repair. Thank you!
>>
> Yes, that remains an issue. Doesn't even import into Protege.
>

Further to this and to Donny's original question ... After some more 
extensive fossicking around, I found a few efforts pursuing an RDFLib 
XSD-to-OWL solution and some more Python utilities for handling XSD. I'll 
deal with the latter first ...

I found xsdflatten <https://github.com/esunder/xsdflatten> which combined 
the split-into-several-file Datacite XSD spec into a single file of xsd and 
then generateDS <https://github.com/ricksladkey/generateDS> produced some 
useful-looking classes from that flattened file and the result (an API in 
Python) does appear to be reasonably tractable.

I modified this tutorial example 
<https://github.com/mwaaas/GenerateXsdTutorial> to:
> python generateDS.py -o datacite_api.py -s datacite_sub.py 
--super=datacite_api datacite.xsd
Looks like the "-s datacite_sub.py" is unnecessary in this case, the 
contents of that Python file don't seem useful to this specific task.

I also found this EOL'd PyXB <https://github.com/pabigot/pyxb> ("a pure 
Python package that generates Python source code for classes that 
correspond to data structures defined by XMLSchema") and its Python3 fork 
PyXB-X <https://github.com/renalreg/PyXB-X> which is an alternative 
approach to processing XSD content. It worked but without actually getting 
deeper into pyxb, whether the results are *useful* is another matter.

As regards Python/RDFLib/XSD->OWL, there is a Python implementation using 
RDFLib contained in a gist 
<https://gist.githubusercontent.com/pebbie/5704765/raw/6bce2670f349e57645f14b39782f0995c77d53f0/xsd2owl.py>
 
- which is referenced in this further, partly-functional refinement XSD2OWL 
by TB Huy <https://github.com/tbhuy/XSD2OWL> which also uses RDFLib.

In the end, I managed to get an approximation of a conversion to RDFLib 
(clearly more work is required) with the flattened Datacite XSD and a 
handful of "get-it-working" changes 
<https://gist.github.com/gjhiggins/cb2ec955470734961b1e63c425fc18ab/revisions> 
to Pebbie's gist which I forked.

(fwiw, I'm viewing this as a potential "Cookbook" item)

Cheers,
Graham

-- 
http://github.com/RDFLib
--- 
You received this message because you are subscribed to the Google Groups 
"rdflib-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rdflib-dev/c9f2ba19-ba5d-4b98-b64b-132c8140c597n%40googlegroups.com.

Reply via email to