> Thank you Dave for your help…
> 
> Please find enclosed the file myOntology.xml… The file has been
> validated against OWL schema…
> 

Thanks for providing myOntology.xml.  That made it much easier for
me to locate the problem.

And, I believe that I have a fix.  With this fixed version, I can
generate a module that can parse and export myOntology.xml.

You can find this patched version at Bitbucket:

    https://bitbucket.org/dkuhlman/generateds

Here is some explanation about why the OWL schema gave us this
problem  and also what I did to fix it.  It's a fairly twisted case,
actually, although I can understand how XML docs used to encode
ontological information might contain the kind of containment and
recursion that produced this problem.

So here is our problem -- We have a complex class that contains
an element where the name of the element and the name of the class
that contains it are the same name:
Specifically, we have:

    <xsd:complexType name="ObjectAllValuesFrom">

which contains a reference to a group (a complexType):

    <xsd:group ref="owl:ClassExpression"/>

And that complexType,

    <xsd:complexType name="ClassExpression" abstract="true">

contains:

    <xsd:element ref="owl:ObjectAllValuesFrom"/>

which means that the generated class ObjectAllValuesFrom is going to
contain a member variable named ObjectAllValuesFrom.

And, my solution, roughly, is to check, during generation of the
constructor, whether a child of an element has the same name as the
element that contains it.  If it does, then modify the name of the
child in the constructor of that class.  You can search your
generated file for "_member" to see this change.

If/when you try this, please let me know whether it works for you
and also any other comments you have.

Dave

> Regards,
> 
> Frederic.
> 
> > Le 3 déc. 2014 à 05:16, Dave Kuhlman <dkuhl...@davekuhlman.org> a écrit :
> > 
> > On Tue, Dec 02, 2014 at 02:28:48PM +0100, Fr??d??ric Bertrand wrote:
> >> Hi,
> >> 
> >> I’m trying to generate an XML parser for this schema :
> >> 
> >> http://www.w3.org/2009/09/owl2-xml.xsd
> >> 
> >> I have followed the tutorial and I used generateDS with these commands :
> >> 
> >> ./generateDS.py -o owl_api.py -s owl_app.py --super=owl_api owl2-xml.xsd 
> >> 
> >> python owl_app.py myOntology.xml
> >> 
> >> And I got this runtime error :
> >> 
> >> Traceback (most recent call last):
> >>  File "owl_app.py", line 812, in <module>
> >>    main()
> > 
> > [snip]
> > 
> >>  File "/Users/fred/Downloads/generateDS-2.14a/owl_api.py", line 6056, in 
> >> __init__
> >>    super(ObjectAllValuesFrom, self).__init__(lang, base, id, space, )
> >> TypeError: must be type, not None
> >> 
> >> 
> >> I think there is something in the OWL ontology not supported by generateDS 
> >> but I don’t know what…
> >> Any help would be appreciated…
> >> 
> > 
> > Frédéric,
> > 
> > I'll take a look.
> > 
> > Thanks for the traceback and the owl2-xml.xsd schema.  That should
> > make this bug easier to track down.  I've been able to generate
> > modules from owl2-xml.xsd.
> > 
> > It would also help if you could send me myOntology.xml, or any other
> > file that would enable me to generate the same exception.
> > 
> > Thanks.
> > 
> > Dave
> > 
> > 
> > -- 
> > 
> > Dave Kuhlman
> > http://www.davekuhlman.org
-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to