Probblem with XSD generated model editor [message #68485] |
Tue, 27 June 2006 12:27  |
Eclipse User |
|
|
|
I have an XSD which contains the following.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
<xs:element name="triple" substitutionGroup="rng:pattern">
<xs:complexType>
<xs:sequence>
<xs:element ref="ccs:term-exp"/>
<xs:element ref="ccs:term-exp"/>
<xs:element ref="ccs:term-exp"/>
</xs:sequence>
<xs:attribute name="row"/>
</xs:complexType>
</xs:element>
<xs:element name="term-exp" abstract="true"/>
<xs:element name="var" substitutionGroup="ccs:term-exp" type="xs:NCName"/>
<xs:element name="term" substitutionGroup="ccs:term-exp"
type="xs:anyURI"/>
<xs:element name="literal" substitutionGroup="ccs:term-exp"
type="xs:string"/>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++
I have created an EMF plugin from it in the textbook way.
However, when I use the generated model editor,
it tries to force each of the three children of triple to be a different
type (var/term/literal).
If I make the first child <term>, then the Term Type option is greyed out in
the menu for the next child.
If I edit a model in the text editor:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++
<?xml version="1.0" encoding="UTF-8"?>
<ccs:triple xmlns:ccs="http://www.rightscom.com/ns/ccs">
<ccs:term>a</ccs:term>
<ccs:term>b</ccs:term>
<ccs:term>c</ccs:term>
</ccs:triple>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
and then open it with the model editor
then I only see (with folding fully expanded)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
* platform ...
* Document Root
* <triple> Triple Type
* <term> c
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++
and I do not seem to be able to get at the
<ccs:term>b</ccs:term>
<ccs:term>c</ccs:term>
components
I do not understand why the model editor wants to make the childerent
distinct.
To my best understanding the schema does not imply the constraint.
thanks
Daniel
|
|
|
|
Re: Probblem with XSD generated model editor [message #68541 is a reply to message #68510] |
Wed, 28 June 2006 05:26  |
Eclipse User |
|
|
|
--nextPart1238085.uX967fOFb9
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
Hi Ed,
Thanks a lot. Your suggested fix does the job.
A complete real world schema that exhibits this problem is TRiX:
http://www.w3.org/2004/03/trix/
The schema as published does not even load,
but the modified version attached does,
and illustrates my problem.
This problem is likely to be frequent for schemas
generated from relax-ng schemas since relax-ng does not use maxOccurs,
So it would be great if something could be done about this.
cheers
Daniel
Ed Merks wrote:
> Daniel,
>
> I'd need a complete example to see this in action, but I can well
> imagine that EMF will not be thrilled with the several uses of the same
> element within one type. Unless the parser is made smarter (using a
> state machine approach like the one being prototyped in
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210) it will be confused
> about which feature to populate.
>
> Could you change the schema to this so that there will only be one
> feature?
>
> <xs:element name="triple" substitutionGroup="rng:pattern">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="ccs:term-exp" maxOccurs="3"/>
> </xs:sequence>
> <xs:attribute name="row"/>
> </xs:complexType>
> </xs:element>
>
>
>
> dmahler@gmail.com wrote:
>
>>I have an XSD which contains the following.
>>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
>> <xs:element name="triple" substitutionGroup="rng:pattern">
>> <xs:complexType>
>> <xs:sequence>
>> <xs:element ref="ccs:term-exp"/>
>> <xs:element ref="ccs:term-exp"/>
>> <xs:element ref="ccs:term-exp"/>
>> </xs:sequence>
>> <xs:attribute name="row"/>
>> </xs:complexType>
>> </xs:element>
>>
>> <xs:element name="term-exp" abstract="true"/>
>> <xs:element name="var" substitutionGroup="ccs:term-exp"
>> type="xs:NCName"/> <xs:element name="term"
>> substitutionGroup="ccs:term-exp"
>>type="xs:anyURI"/>
>> <xs:element name="literal" substitutionGroup="ccs:term-exp"
>>type="xs:string"/>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++
>>
>>I have created an EMF plugin from it in the textbook way.
>>However, when I use the generated model editor,
>>it tries to force each of the three children of triple to be a different
>>type (var/term/literal).
>>If I make the first child <term>, then the Term Type option is greyed out
>>in the menu for the next child.
>>
>>If I edit a model in the text editor:
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++
>><?xml version="1.0" encoding="UTF-8"?>
>><ccs:triple xmlns:ccs="http://www.rightscom.com/ns/ccs">
>> <ccs:term>a</ccs:term>
>> <ccs:term>b</ccs:term>
>> <ccs:term>c</ccs:term>
>></ccs:triple>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
>>
>>and then open it with the model editor
>>then I only see (with folding fully expanded)
>>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
>>* platform ...
>>
>> * Document Root
>>
>> * <triple> Triple Type
>>
>> * <term> c
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++
>>
>>and I do not seem to be able to get at the
>>
>> <ccs:term>b</ccs:term>
>> <ccs:term>c</ccs:term>
>>
>>components
>>
>>I do not understand why the model editor wants to make the childerent
>>distinct.
>>To my best understanding the schema does not imply the constraint.
>>
>>thanks
>>Daniel
>>
>>
--nextPart1238085.uX967fOFb9
Content-Type: text/html; name="trix-1.0.xsd"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="trix-1.0.xsd"
<?xml version="1.0" encoding="UTF-8"?>
<!-- TriX: RDF Triples In XML -->
<schema xmlns = "http://www.w3.org/2001/XMLSchema"
xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
xmlns:trix = "http://www.w3.org/2004/03/trix/trix-1/"
targetNamespace = "http://www.w3.org/2004/03/trix/trix-1/">
<element name="trix">
<complexType>
<sequence>
<element ref="trix:graph" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="graph">
<complexType>
<sequence>
<element ref="trix:uri" minOccurs="1" maxOccurs="1"/>
<element ref="trix:triple" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="triple">
<complexType>
<sequence>
<choice>
<element ref="trix:id"/>
<element ref="trix:uri"/>
<element ref="trix:plainLiteral"/>
<element ref="trix:typedLiteral"/>
</choice>
<element ref="trix:uri"/>
<choice>
<element ref="trix:id"/>
<element ref="trix:uri"/>
<element ref="trix:plainLiteral"/>
<element ref="trix:typedLiteral"/>
</choice>
</sequence>
</complexType>
</element>
<element name="id" type="string"/>
<element name="uri" type="anyURI"/>
<element name="plainLiteral">
<complexType>
<simpleContent>
<extension base="xsd:string">
<!-- <attribute ref="xml:lang"/> -->
</extension>
</simpleContent>
</complexType>
</element>
<element name="typedLiteral">
<complexType>
<simpleContent>
<extension base="xsd:string">
<attribute name="datatype" type="anyURI" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>
</schema>
--nextPart1238085.uX967fOFb9--
|
|
|
Re: Probblem with XSD generated model editor [message #598294 is a reply to message #68485] |
Tue, 27 June 2006 14:48  |
Eclipse User |
|
|
|
Daniel,
I'd need a complete example to see this in action, but I can well
imagine that EMF will not be thrilled with the several uses of the same
element within one type. Unless the parser is made smarter (using a
state machine approach like the one being prototyped in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210) it will be confused
about which feature to populate.
Could you change the schema to this so that there will only be one feature?
<xs:element name="triple" substitutionGroup="rng:pattern">
<xs:complexType>
<xs:sequence>
<xs:element ref="ccs:term-exp" maxOccurs="3"/>
</xs:sequence>
<xs:attribute name="row"/>
</xs:complexType>
</xs:element>
dmahler@gmail.com wrote:
>I have an XSD which contains the following.
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
> <xs:element name="triple" substitutionGroup="rng:pattern">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="ccs:term-exp"/>
> <xs:element ref="ccs:term-exp"/>
> <xs:element ref="ccs:term-exp"/>
> </xs:sequence>
> <xs:attribute name="row"/>
> </xs:complexType>
> </xs:element>
>
> <xs:element name="term-exp" abstract="true"/>
> <xs:element name="var" substitutionGroup="ccs:term-exp" type="xs:NCName"/>
> <xs:element name="term" substitutionGroup="ccs:term-exp"
>type="xs:anyURI"/>
> <xs:element name="literal" substitutionGroup="ccs:term-exp"
>type="xs:string"/>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++
>
>I have created an EMF plugin from it in the textbook way.
>However, when I use the generated model editor,
>it tries to force each of the three children of triple to be a different
>type (var/term/literal).
>If I make the first child <term>, then the Term Type option is greyed out in
>the menu for the next child.
>
>If I edit a model in the text editor:
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++
><?xml version="1.0" encoding="UTF-8"?>
><ccs:triple xmlns:ccs="http://www.rightscom.com/ns/ccs">
> <ccs:term>a</ccs:term>
> <ccs:term>b</ccs:term>
> <ccs:term>c</ccs:term>
></ccs:triple>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
>
>and then open it with the model editor
>then I only see (with folding fully expanded)
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
>* platform ...
>
> * Document Root
>
> * <triple> Triple Type
>
> * <term> c
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++
>
>and I do not seem to be able to get at the
>
> <ccs:term>b</ccs:term>
> <ccs:term>c</ccs:term>
>
>components
>
>I do not understand why the model editor wants to make the childerent
>distinct.
>To my best understanding the schema does not imply the constraint.
>
>thanks
>Daniel
>
>
|
|
|
Re: Probblem with XSD generated model editor [message #598315 is a reply to message #68510] |
Wed, 28 June 2006 05:26  |
Eclipse User |
|
|
|
--nextPart1238085.uX967fOFb9
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
Hi Ed,
Thanks a lot. Your suggested fix does the job.
A complete real world schema that exhibits this problem is TRiX:
http://www.w3.org/2004/03/trix/
The schema as published does not even load,
but the modified version attached does,
and illustrates my problem.
This problem is likely to be frequent for schemas
generated from relax-ng schemas since relax-ng does not use maxOccurs,
So it would be great if something could be done about this.
cheers
Daniel
Ed Merks wrote:
> Daniel,
>
> I'd need a complete example to see this in action, but I can well
> imagine that EMF will not be thrilled with the several uses of the same
> element within one type. Unless the parser is made smarter (using a
> state machine approach like the one being prototyped in
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=51210) it will be confused
> about which feature to populate.
>
> Could you change the schema to this so that there will only be one
> feature?
>
> <xs:element name="triple" substitutionGroup="rng:pattern">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="ccs:term-exp" maxOccurs="3"/>
> </xs:sequence>
> <xs:attribute name="row"/>
> </xs:complexType>
> </xs:element>
>
>
>
> dmahler@gmail.com wrote:
>
>>I have an XSD which contains the following.
>>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
>> <xs:element name="triple" substitutionGroup="rng:pattern">
>> <xs:complexType>
>> <xs:sequence>
>> <xs:element ref="ccs:term-exp"/>
>> <xs:element ref="ccs:term-exp"/>
>> <xs:element ref="ccs:term-exp"/>
>> </xs:sequence>
>> <xs:attribute name="row"/>
>> </xs:complexType>
>> </xs:element>
>>
>> <xs:element name="term-exp" abstract="true"/>
>> <xs:element name="var" substitutionGroup="ccs:term-exp"
>> type="xs:NCName"/> <xs:element name="term"
>> substitutionGroup="ccs:term-exp"
>>type="xs:anyURI"/>
>> <xs:element name="literal" substitutionGroup="ccs:term-exp"
>>type="xs:string"/>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++
>>
>>I have created an EMF plugin from it in the textbook way.
>>However, when I use the generated model editor,
>>it tries to force each of the three children of triple to be a different
>>type (var/term/literal).
>>If I make the first child <term>, then the Term Type option is greyed out
>>in the menu for the next child.
>>
>>If I edit a model in the text editor:
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++
>><?xml version="1.0" encoding="UTF-8"?>
>><ccs:triple xmlns:ccs="http://www.rightscom.com/ns/ccs">
>> <ccs:term>a</ccs:term>
>> <ccs:term>b</ccs:term>
>> <ccs:term>c</ccs:term>
>></ccs:triple>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
>>
>>and then open it with the model editor
>>then I only see (with folding fully expanded)
>>
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++
>>* platform ...
>>
>> * Document Root
>>
>> * <triple> Triple Type
>>
>> * <term> c
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++
>>
>>and I do not seem to be able to get at the
>>
>> <ccs:term>b</ccs:term>
>> <ccs:term>c</ccs:term>
>>
>>components
>>
>>I do not understand why the model editor wants to make the childerent
>>distinct.
>>To my best understanding the schema does not imply the constraint.
>>
>>thanks
>>Daniel
>>
>>
--nextPart1238085.uX967fOFb9
Content-Type: text/html; name="trix-1.0.xsd"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="trix-1.0.xsd"
<?xml version="1.0" encoding="UTF-8"?>
<!-- TriX: RDF Triples In XML -->
<schema xmlns = "http://www.w3.org/2001/XMLSchema"
xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
xmlns:trix = "http://www.w3.org/2004/03/trix/trix-1/"
targetNamespace = "http://www.w3.org/2004/03/trix/trix-1/">
<element name="trix">
<complexType>
<sequence>
<element ref="trix:graph" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="graph">
<complexType>
<sequence>
<element ref="trix:uri" minOccurs="1" maxOccurs="1"/>
<element ref="trix:triple" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="triple">
<complexType>
<sequence>
<choice>
<element ref="trix:id"/>
<element ref="trix:uri"/>
<element ref="trix:plainLiteral"/>
<element ref="trix:typedLiteral"/>
</choice>
<element ref="trix:uri"/>
<choice>
<element ref="trix:id"/>
<element ref="trix:uri"/>
<element ref="trix:plainLiteral"/>
<element ref="trix:typedLiteral"/>
</choice>
</sequence>
</complexType>
</element>
<element name="id" type="string"/>
<element name="uri" type="anyURI"/>
<element name="plainLiteral">
<complexType>
<simpleContent>
<extension base="xsd:string">
<!-- <attribute ref="xml:lang"/> -->
</extension>
</simpleContent>
</complexType>
</element>
<element name="typedLiteral">
<complexType>
<simpleContent>
<extension base="xsd:string">
<attribute name="datatype" type="anyURI" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>
</schema>
--nextPart1238085.uX967fOFb9--
|
|
|
Powered by
FUDForum. Page generated in 0.04143 seconds