Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Fixing an Dangling Reference
Fixing an Dangling Reference [message #421965] Tue, 19 August 2008 17:11 Go to next message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 71
Registered: July 2009
Member
All,
All,

I'm getting a dangling reference error when I attempt to save my model. I
know how to address this problem by recording, discarding, etc.--no good.
I need a fix so I can save everything.

The question is how do I write my xsd so the dangling is eliminated.

I've included a fragment from my schema. In this, a given DiseaseStage
may occur in any number of Diseases hence the use of xs:anyURI coupled
with ecore:reference. I'm not using ecore:opposite because I don't need
bi-directionality. I do need to save the DiseaseStages so discard and its
ilk is not an option.

Thanks in advance.

<xs:complexType name="Disease">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="stages" type="xs:anyURI" maxOccurs="unbounded"
ecore:reference="DiseaseStage"/>
<xs:element name="R0" type="xs:double"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="DiseaseStage">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="population" type="xs:double"/>
</xs:complexType>
Re: Fixing an Dangling Reference [message #421968 is a reply to message #421965] Tue, 19 August 2008 17:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Geoffry,

Comments below.

Geoffry Roberts wrote:
> All,
> All,
>
> I'm getting a dangling reference error when I attempt to save my
> model. I know how to address this problem by recording, discarding,
> etc.--no good. I need a fix so I can save everything.
> The question is how do I write my xsd so the dangling is eliminated.
It's not typically a problem with the model itself...
>
> I've included a fragment from my schema. In this, a given
> DiseaseStage may occur in any number of Diseases hence the use of
> xs:anyURI coupled with ecore:reference. I'm not using ecore:opposite
> because I don't need bi-directionality. I do need to save the
> DiseaseStages so discard and its ilk is not an option.
>
> Thanks in advance.
>
> <xs:complexType name="Disease">
> <xs:sequence>
> <xs:element name="title" type="xs:string"/>
> <xs:element name="stages" type="xs:anyURI" maxOccurs="unbounded"
> ecore:reference="DiseaseStage"/>
> <xs:element name="R0" type="xs:double"/>
> </xs:sequence>
> </xs:complexType>
>
> <xs:complexType name="DiseaseStage">
> <xs:sequence>
> <xs:element name="title" type="xs:string"/>
> <xs:element name="population" type="xs:double"/>
> </xs:complexType>
Where is DiseaseStage itself contained? There will need to be some
complex type with an element of this type, or a global element of this
type, that will act as a container for the instances that the different
Diseases all share.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Fixing a Dangling Reference [message #421971 is a reply to message #421968] Tue, 19 August 2008 19:17 Go to previous messageGo to next message
Geoffry Roberts is currently offline Geoffry RobertsFriend
Messages: 71
Registered: July 2009
Member
Ed Merks wrote:

> Geoffry,

> Comments below.

> Geoffry Roberts wrote:
>> All,
>> All,
>>
>> I'm getting a dangling reference error when I attempt to save my
>> model. I know how to address this problem by recording, discarding,
>> etc.--no good. I need a fix so I can save everything.
>> The question is how do I write my xsd so the dangling is eliminated.
> It's not typically a problem with the model itself...
>>
>> I've included a fragment from my schema. In this, a given
>> DiseaseStage may occur in any number of Diseases hence the use of
>> xs:anyURI coupled with ecore:reference. I'm not using ecore:opposite
>> because I don't need bi-directionality. I do need to save the
>> DiseaseStages so discard and its ilk is not an option.
>>
>> Thanks in advance.
>>
>> <xs:complexType name="Disease">
>> <xs:sequence>
>> <xs:element name="title" type="xs:string"/>
>> <xs:element name="stages" type="xs:anyURI" maxOccurs="unbounded"
>> ecore:reference="DiseaseStage"/>

So, the above element as it is doesn't suffice as a container? If I were
to make it a global element would it suffice then? Disease, after all, is
a complexType. If i were to make the stages element of type DiseaseStage,
then I would not be able to have the same stages in multi Diseases. Are
we talking some kind of container within a container?

Thanks in advance.

>> <xs:element name="R0" type="xs:double"/>
>> </xs:sequence>
>> </xs:complexType>
>>
>> <xs:complexType name="DiseaseStage">
>> <xs:sequence>
>> <xs:element name="title" type="xs:string"/>
>> <xs:element name="population" type="xs:double"/>
>> </xs:complexType>
> Where is DiseaseStage itself contained? There will need to be some
> complex type with an element of this type, or a global element of this
> type, that will act as a container for the instances that the different
> Diseases all share.
Re: Fixing a Dangling Reference [message #421972 is a reply to message #421971] Tue, 19 August 2008 19:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Geoffry,

Comments below.

Geoffry Roberts wrote:
> Ed Merks wrote:
>
>> Geoffry,
>
>> Comments below.
>
>> Geoffry Roberts wrote:
>>> All,
>>> All,
>>>
>>> I'm getting a dangling reference error when I attempt to save my
>>> model. I know how to address this problem by recording, discarding,
>>> etc.--no good. I need a fix so I can save everything. The question
>>> is how do I write my xsd so the dangling is eliminated.
>> It's not typically a problem with the model itself...
>>>
>>> I've included a fragment from my schema. In this, a given
>>> DiseaseStage may occur in any number of Diseases hence the use of
>>> xs:anyURI coupled with ecore:reference. I'm not using
>>> ecore:opposite because I don't need bi-directionality. I do need to
>>> save the DiseaseStages so discard and its ilk is not an option.
>>>
>>> Thanks in advance.
>>>
>>> <xs:complexType name="Disease">
>>> <xs:sequence>
>>> <xs:element name="title" type="xs:string"/>
>>> <xs:element name="stages" type="xs:anyURI"
>>> maxOccurs="unbounded" ecore:reference="DiseaseStage"/>
>
> So, the above element as it is doesn't suffice as a container?
You've explicitly made it not be a containment reference and if it were
a containment reference, you'd not be able to share DiseaseStage
instances across Diseases. So you can't have your cake and eat it to.
> If I were to make it a global element would it suffice then?
You need an element of type DiseaseStage, either a global one or one in
some other complex type so that a DiseaseStage can either be in the root
of some other resource or be contained by some other object in already
in resource.
> Disease, after all, is a complexType.
Yes, but it doesn't have a containment reference to allow it to act as a
container.
> If i were to make the stages element of type DiseaseStage, then I
> would not be able to have the same stages in multi Diseases. Are we
> talking some kind of container within a container?
Perhaps the thing that contains the Diseases out to also have an element
to contains the DiseaseStages. Just think of how similar what you want
to do is to the Library model where the Library contains the Books and
the Writers....
>
> Thanks in advance.
>
>>> <xs:element name="R0" type="xs:double"/>
>>> </xs:sequence>
>>> </xs:complexType>
>>>
>>> <xs:complexType name="DiseaseStage">
>>> <xs:sequence>
>>> <xs:element name="title" type="xs:string"/>
>>> <xs:element name="population" type="xs:double"/>
>>> </xs:complexType>
>> Where is DiseaseStage itself contained? There will need to be some
>> complex type with an element of this type, or a global element of
>> this type, that will act as a container for the instances that the
>> different Diseases all share.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Which (kind of) template for *Impl.java customization
Next Topic:How to implement derived and volatile getters?
Goto Forum:
  


Current Time: Fri Apr 26 12:54:42 GMT 2024

Powered by FUDForum. Page generated in 0.03412 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top