Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » (no subject)
(no subject) [message #687507] Fri, 17 June 2011 04:16 Go to next message
Mark Tippetts is currently offline Mark TippettsFriend
Messages: 25
Registered: July 2009
Junior Member
In the schema listed below, there are several lines of the form,

<xs:attribute ecore:reference="Topic" name="reifier" type="xs:anyURI" />

When importing the schema, this produces an unexpected result: The attribute is mapped to an EReference of type EObject, instead of the identified type. I've tried the following permutations, all with the same result:
ecore:reference="Topic"
ecore:reference="topic"
ecore:reference="xtm:Topic"
ecore:reference="xtm:topic"
ecore:reference="xtm2:Topic"
ecore:reference="xtm2:topic"

Am I doing it wrong, or is this a bug, or has the behavior changed from what's documented in the PDF at http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchemaToEcoreMapping.pdf

Thanks,

Mark Tippetts


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- ............................................................. -->
<!-- XML Topic Map Schema ....................................... -->
<!-- XML Topic Map (XTM) Schema, Version 2.0 This is XTM 2.0, an XML interchange
syntax for ISO 13250 Topic Maps, defined by ISO 13250-3. See http://www.isotopicmaps.org/sam/sam-xtm/ -->
<xs:schema
xmlns="http://www.topicmaps.org/xtm/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
ecore:package="net.golemware.topicmaps.xtm2" elementFormDefault="qualified"
targetNamespace="http://www.topicmaps.org/xtm/">
<xs:annotation>
<xs:appinfo>
<dc:title>W3C XML Schema for XTM 2.0</dc:title>
<dc:owner>ISO/IEC JTC1 SC34</dc:owner>
<dc:contributor>Max Voskob</dc:contributor>
<dc:contributor>Lars Marius Garshol</dc:contributor>
<dc:contributor>Ann Wrightson</dc:contributor>
</xs:appinfo>
</xs:annotation>

<!-- any-markup ................................................ -->
<xs:complexType mixed="true" name="any-markup">
<xs:complexContent mixed="true">
<xs:restriction base="xs:anyType">
<xs:sequence>
<xs:any maxOccurs="unbounded" minOccurs="0" namespace="##other"
processContents="lax" />
</xs:sequence>
<xs:attribute name="datatype" type="xs:anyURI" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>

<!-- topicMap .................................................. -->
<xs:element name="topicMap">
<xs:complexType ecore:name="TopicMap">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
ref="itemIdentity" />

<xs:element maxOccurs="unbounded" minOccurs="0" ref="mergeMap" />
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element ref="topic" />
<xs:element ref="association" />
</xs:choice>
</xs:sequence>
<xs:attribute ecore:reference="Topic" name="reifier"
type="xs:anyURI" />
<xs:attribute fixed="2.0" name="version" />
</xs:complexType>
</xs:element>

<!-- topic ..................................................... -->
<xs:element name="topic">
<xs:complexType ecore:name="Topic">
<xs:sequence>
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element ref="itemIdentity" />
<xs:element ref="subjectLocator" />
<xs:element ref="subjectIdentifier" />
</xs:choice>
<xs:element maxOccurs="1" minOccurs="0" ref="instanceOf" />
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element ref="name" />
<xs:element ref="occurrence" />
</xs:choice>
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required" />
</xs:complexType>
</xs:element>

<!-- itemIdentity .............................................. -->
<xs:element name="itemIdentity">
<xs:complexType ecore:name="ItemIdentity">
<xs:attribute name="href" type="xs:anyURI" use="required" />
</xs:complexType>
</xs:element>

<!-- subjectLocator ............................................ -->
<xs:element name="subjectLocator">
<xs:complexType ecore:name="SubjectLocator">
<xs:attribute name="href" type="xs:anyURI" use="required" />
</xs:complexType>
</xs:element>

<!-- subjectIdentifier ......................................... -->
<xs:element name="subjectIdentifier">
<xs:complexType ecore:name="SubjectIdentifier">
<xs:attribute name="href" type="xs:anyURI" use="required" />
</xs:complexType>
</xs:element>

<!-- name ...................................................... -->
<xs:element name="name">
<xs:complexType ecore:name="Name">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
ref="itemIdentity" />
<xs:element minOccurs="0" ref="type" />
<xs:element minOccurs="0" ref="scope" />
<xs:element ref="value" />
<xs:element maxOccurs="unbounded" minOccurs="0" ref="variant" />
</xs:sequence>
<xs:attribute ecore:reference="Topic" name="reifier"
type="xs:anyURI" />
</xs:complexType>
</xs:element>

<!-- value ..................................................... -->
<xs:element name="value" type="xs:string" />

<!-- variant ................................................... -->
<xs:element name="variant">
<xs:complexType ecore:name="Variant">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
ref="itemIdentity" />
<xs:element ref="scope" />
<xs:choice>
<xs:element ref="resourceData" />
<xs:element ref="resourceRef" />
</xs:choice>
</xs:sequence>
<xs:attribute ecore:reference="Topic" name="reifier"
type="xs:anyURI" />
</xs:complexType>
</xs:element>

<!-- scope ..................................................... -->
<xs:element name="scope">
<xs:complexType ecore:name="Scope">
<xs:choice>
<xs:element maxOccurs="unbounded" ref="topicRef" />
</xs:choice>
</xs:complexType>
</xs:element>

<!-- instanceOf ................................................ -->
<xs:element name="instanceOf">
<xs:complexType ecore:name="InstanceOf">
<xs:choice>
<xs:element maxOccurs="unbounded" ref="topicRef" />
</xs:choice>
</xs:complexType>
</xs:element>

<!-- type ...................................................... -->
<xs:element name="type">
<xs:complexType ecore:name="Type">
<xs:choice>
<xs:element ref="topicRef" />
</xs:choice>
</xs:complexType>
</xs:element>

<!-- occurrence ................................................ -->
<xs:element name="occurrence">
<xs:complexType ecore:name="Occurrence">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
ref="itemIdentity" />
<xs:element ref="type" />
<xs:element minOccurs="0" ref="scope" />
<xs:choice>
<xs:element ref="resourceRef" />
<xs:element ref="resourceData" />
</xs:choice>
</xs:sequence>
<xs:attribute ecore:reference="Topic" name="reifier"
type="xs:anyURI" />
</xs:complexType>
</xs:element>

<!-- resourceData .............................................. -->
<xs:element name="resourceData" type="any-markup" />

<!-- association ............................................... -->
<xs:element name="association">
<xs:complexType ecore:name="Association">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
ref="itemIdentity" />
<xs:element ref="type" />
<xs:element minOccurs="0" ref="scope" />
<xs:element maxOccurs="unbounded" ref="role" />
</xs:sequence>
<xs:attribute ecore:reference="Topic" name="reifier"
type="xs:anyURI" />
</xs:complexType>
</xs:element>

<!-- role ...................................................... -->
<xs:element name="role">
<xs:complexType ecore:name="Role">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0"
ref="itemIdentity" />
<xs:element ref="type" />
<xs:element ref="topicRef" />
</xs:sequence>
<xs:attribute ecore:reference="Topic" name="reifier"
type="xs:anyURI" />
</xs:complexType>
</xs:element>

<!-- topicRef .................................................. -->
<xs:element name="topicRef">
<xs:complexType ecore:name="TopicRef">
<xs:attribute ecore:reference="Topic" name="href" type="xs:anyURI"
use="required" />
</xs:complexType>
</xs:element>

<!-- resourceRef ............................................... -->
<xs:element name="resourceRef">
<xs:complexType ecore:name="ResourceRef">
<xs:attribute name="href" type="xs:anyURI" use="required" />
</xs:complexType>
</xs:element>

<!-- mergeMap .................................................. -->
<xs:element name="mergeMap">
<xs:complexType ecore:name="MergeMap">
<xs:attribute name="href" type="xs:anyURI" use="required"
ecore:reference="TopicMap" />
</xs:complexType>
</xs:element>
</xs:schema>
Re: Trouble with ecore:reference in XSD import [message #687517 is a reply to message #687507] Fri, 17 June 2011 13:53 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Mark,

The resolution of ecore:reference depends on a complex type with the
given QName being visible in the schema itself. But you most have
anonymous types and definitely don't have a named complex typed for
"topic". Hopefully you're in a position to change the schema.


Mark Tippetts wrote:
> In the schema listed below, there are several lines of the form,
>
> <xs:attribute ecore:reference="Topic" name="reifier" type="xs:anyURI" />
>
> When importing the schema, this produces an unexpected result: The
> attribute is mapped to an EReference of type EObject, instead of the
> identified type. I've tried the following permutations, all with the
> same result:
> ecore:reference="Topic"
> ecore:reference="topic"
> ecore:reference="xtm:Topic"
> ecore:reference="xtm:topic"
> ecore:reference="xtm2:Topic"
> ecore:reference="xtm2:topic"
>
> Am I doing it wrong, or is this a bug, or has the behavior changed
> from what's documented in the PDF at
> http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchemaToEcoreMapping.pdf
>
>
> Thanks,
>
> Mark Tippetts
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!-- ............................................................. -->
> <!-- XML Topic Map Schema ....................................... -->
> <!-- XML Topic Map (XTM) Schema, Version 2.0 This is XTM 2.0, an XML
> interchange syntax for ISO 13250 Topic Maps, defined by ISO
> 13250-3. See http://www.isotopicmaps.org/sam/sam-xtm/ -->
> <xs:schema xmlns="http://www.topicmaps.org/xtm/"
> xmlns:dc="http://purl.org/dc/elements/1.1/"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> ecore:package="net.golemware.topicmaps.xtm2"
> elementFormDefault="qualified"
> targetNamespace="http://www.topicmaps.org/xtm/">
> <xs:annotation>
> <xs:appinfo>
> <dc:title>W3C XML Schema for XTM 2.0</dc:title>
> <dc:owner>ISO/IEC JTC1 SC34</dc:owner>
> <dc:contributor>Max Voskob</dc:contributor>
> <dc:contributor>Lars Marius Garshol</dc:contributor>
> <dc:contributor>Ann Wrightson</dc:contributor>
> </xs:appinfo>
> </xs:annotation>
>
> <!-- any-markup ................................................ -->
> <xs:complexType mixed="true" name="any-markup">
> <xs:complexContent mixed="true">
> <xs:restriction base="xs:anyType">
> <xs:sequence>
> <xs:any maxOccurs="unbounded" minOccurs="0"
> namespace="##other"
> processContents="lax" />
> </xs:sequence>
> <xs:attribute name="datatype" type="xs:anyURI" />
> </xs:restriction>
> </xs:complexContent>
> </xs:complexType>
>
> <!-- topicMap .................................................. -->
> <xs:element name="topicMap">
> <xs:complexType ecore:name="TopicMap">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="itemIdentity" />
>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="mergeMap" />
> <xs:choice maxOccurs="unbounded" minOccurs="0">
> <xs:element ref="topic" />
> <xs:element ref="association" />
> </xs:choice>
> </xs:sequence>
> <xs:attribute ecore:reference="Topic" name="reifier"
> type="xs:anyURI" />
> <xs:attribute fixed="2.0" name="version" />
> </xs:complexType>
> </xs:element>
>
> <!-- topic ..................................................... -->
> <xs:element name="topic">
> <xs:complexType ecore:name="Topic">
> <xs:sequence>
> <xs:choice maxOccurs="unbounded" minOccurs="0">
> <xs:element ref="itemIdentity" />
> <xs:element ref="subjectLocator" />
> <xs:element ref="subjectIdentifier" />
> </xs:choice>
> <xs:element maxOccurs="1" minOccurs="0"
> ref="instanceOf" />
> <xs:choice maxOccurs="unbounded" minOccurs="0">
> <xs:element ref="name" />
> <xs:element ref="occurrence" />
> </xs:choice>
> </xs:sequence>
> <xs:attribute name="id" type="xs:ID" use="required" />
> </xs:complexType>
> </xs:element>
>
> <!-- itemIdentity .............................................. -->
> <xs:element name="itemIdentity">
> <xs:complexType ecore:name="ItemIdentity">
> <xs:attribute name="href" type="xs:anyURI" use="required" />
> </xs:complexType>
> </xs:element>
>
> <!-- subjectLocator ............................................ -->
> <xs:element name="subjectLocator">
> <xs:complexType ecore:name="SubjectLocator">
> <xs:attribute name="href" type="xs:anyURI" use="required" />
> </xs:complexType>
> </xs:element>
>
> <!-- subjectIdentifier ......................................... -->
> <xs:element name="subjectIdentifier">
> <xs:complexType ecore:name="SubjectIdentifier">
> <xs:attribute name="href" type="xs:anyURI" use="required" />
> </xs:complexType>
> </xs:element>
>
> <!-- name ...................................................... -->
> <xs:element name="name">
> <xs:complexType ecore:name="Name">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="itemIdentity" />
> <xs:element minOccurs="0" ref="type" />
> <xs:element minOccurs="0" ref="scope" />
> <xs:element ref="value" />
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="variant" />
> </xs:sequence>
> <xs:attribute ecore:reference="Topic" name="reifier"
> type="xs:anyURI" />
> </xs:complexType>
> </xs:element>
>
> <!-- value ..................................................... -->
> <xs:element name="value" type="xs:string" />
>
> <!-- variant ................................................... -->
> <xs:element name="variant">
> <xs:complexType ecore:name="Variant">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="itemIdentity" />
> <xs:element ref="scope" />
> <xs:choice>
> <xs:element ref="resourceData" />
> <xs:element ref="resourceRef" />
> </xs:choice>
> </xs:sequence>
> <xs:attribute ecore:reference="Topic" name="reifier"
> type="xs:anyURI" />
> </xs:complexType>
> </xs:element>
>
> <!-- scope ..................................................... -->
> <xs:element name="scope">
> <xs:complexType ecore:name="Scope">
> <xs:choice>
> <xs:element maxOccurs="unbounded" ref="topicRef" />
> </xs:choice>
> </xs:complexType>
> </xs:element>
>
> <!-- instanceOf ................................................ -->
> <xs:element name="instanceOf">
> <xs:complexType ecore:name="InstanceOf">
> <xs:choice>
> <xs:element maxOccurs="unbounded" ref="topicRef" />
> </xs:choice>
> </xs:complexType>
> </xs:element>
>
> <!-- type ...................................................... -->
> <xs:element name="type">
> <xs:complexType ecore:name="Type">
> <xs:choice>
> <xs:element ref="topicRef" />
> </xs:choice>
> </xs:complexType>
> </xs:element>
>
> <!-- occurrence ................................................ -->
> <xs:element name="occurrence">
> <xs:complexType ecore:name="Occurrence">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="itemIdentity" />
> <xs:element ref="type" />
> <xs:element minOccurs="0" ref="scope" />
> <xs:choice>
> <xs:element ref="resourceRef" />
> <xs:element ref="resourceData" />
> </xs:choice>
> </xs:sequence>
> <xs:attribute ecore:reference="Topic" name="reifier"
> type="xs:anyURI" />
> </xs:complexType>
> </xs:element>
>
> <!-- resourceData .............................................. -->
> <xs:element name="resourceData" type="any-markup" />
>
> <!-- association ............................................... -->
> <xs:element name="association">
> <xs:complexType ecore:name="Association">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="itemIdentity" />
> <xs:element ref="type" />
> <xs:element minOccurs="0" ref="scope" />
> <xs:element maxOccurs="unbounded" ref="role" />
> </xs:sequence>
> <xs:attribute ecore:reference="Topic" name="reifier"
> type="xs:anyURI" />
> </xs:complexType>
> </xs:element>
>
> <!-- role ...................................................... -->
> <xs:element name="role">
> <xs:complexType ecore:name="Role">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0"
> ref="itemIdentity" />
> <xs:element ref="type" />
> <xs:element ref="topicRef" />
> </xs:sequence>
> <xs:attribute ecore:reference="Topic" name="reifier"
> type="xs:anyURI" />
> </xs:complexType>
> </xs:element>
>
> <!-- topicRef .................................................. -->
> <xs:element name="topicRef">
> <xs:complexType ecore:name="TopicRef">
> <xs:attribute ecore:reference="Topic" name="href"
> type="xs:anyURI"
> use="required" />
> </xs:complexType>
> </xs:element>
>
> <!-- resourceRef ............................................... -->
> <xs:element name="resourceRef">
> <xs:complexType ecore:name="ResourceRef">
> <xs:attribute name="href" type="xs:anyURI" use="required" />
> </xs:complexType>
> </xs:element>
>
> <!-- mergeMap .................................................. -->
> <xs:element name="mergeMap">
> <xs:complexType ecore:name="MergeMap">
> <xs:attribute name="href" type="xs:anyURI" use="required"
> ecore:reference="TopicMap" />
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Model browser ala MacOSX' finder
Next Topic:Model browser ala MacOSX' finder
Goto Forum:
  


Current Time: Fri Apr 26 21:29:18 GMT 2024

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

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

Back to the top