Schema object references

Hello,
i am tryimg to make working example of schema object reference for few days but no success… i started with example described in documentation - collaboration…
(…taminodoc/advconc/DocumentComposition.htm)
Since the schema editor shipped with tamino needs a lot of patience to use, i downloaded last XML spy from altova. But even after enabling tamino there is no trace of collectionRef or nodeRefoperator propreties… so i have to use shipped editor or even worse - regular text editor…
So as a first step i tried to make the working collaboration schema.
in the doc there is only small fragment, so i tried this:

<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “XML Schema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “collaboration”>
<tsd:collection name = “encyclopedia”></tsd:collection>
<tsd:doctype name = “collaboration”>
tsd:logical
tsd:contentclosed</tsd:content>
</tsd:logical>
</tsd:doctype>
tsd:adminInfo
tsd:created2004-09-01T11:11:32.232+01:00</tsd:created>
tsd:modified2004-09-01T11:11:32.232+01:00</tsd:modified>
tsd:versionTSD4</tsd:version>
tsd:server4.1.4.1</tsd:server>
</tsd:adminInfo>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name = “collaboration”>
xs:complexType
xs:sequence
<xs:element name = “name” type = “xs:NMTOKEN”></xs:element>
xs:choice
<xs:element name = “performedAt”>
xs:complexType
xs:all
<xs:element name = “location” type = “xs:normalizedString”></xs:element>
<xs:element name = “time” type = “xs:dateTime”></xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name = “period”>
xs:complexType
xs:sequence
<xs:element name = “from” type = “xs:date”></xs:element>
<xs:element name = “to” type = “xs:date”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:element name = “jazzMusician”>
<xs:attribute name = “ID” type = “xs:NMTOKEN” use = “required”>
tsd:physical
tsd:native
tsd:index
</tsd:standard/>
</tsd:index>
tsd:objectRef
tsd:collectionRefencyclopedia</tsd:collectionRef>
<tsd:accessPredicate operator = “=”>
tsd:nodeRefjazzMusician/@ID</tsd:nodeRef>
</tsd:accessPredicate>
</tsd:objectRef>
</tsd:native>
</tsd:physical>
</xs:attribute>
</xs:element>
<xs:element name = “result” type = “xs:NMTOKEN” minOccurs = “0” maxOccurs = “unbounded”></xs:element>
</xs:sequence>
<xs:attribute name = “type” use = “required”>
xs:simpleType
<xs:restriction base = “xs:NMTOKEN”>
<xs:enumeration value = “jamSession”></xs:enumeration>
<xs:enumeration value = “project”></xs:enumeration>
<xs:enumeration value = “band”></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

When trying to validate schema i get error:
s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than xs:appinfo and xs:documentation. Saw ‘encyclopedia’.
s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than xs:appinfo and xs:documentation. Saw ‘jazzMusician/@ID’.
s4s-elt-must-match: The content of ‘jazzMusician’ must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)).

The screen for physycal propreties in docs is also bit different than the one in schema editor…

Does anyone has some experience of using this approach (static references) especialy concerning updates (i should do this by the mid tier app.)
and maintaing the consistency of ID-s through in an application?

Regards, Pavel



va-s!

Ok, now i finaly have valid schema (found in the docs collRef section working spec.), but the reference stil does not work, that means i get no referenced data, even if both docs are valid…

My os is Linux and Tamino 4.1.4.5.


current schema for collaboration:

<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “XML Schema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name = “collaboration”>
<tsd:collection name = “encyclopedia”></tsd:collection>
<tsd:doctype name = “collaboration”>
tsd:logical
tsd:contentclosed</tsd:content>
</tsd:logical>
</tsd:doctype>
tsd:adminInfo
tsd:created2004-09-01T14:08:55.854+01:00</tsd:created>
tsd:modified2004-09-01T14:08:55.854+01:00</tsd:modified>
tsd:versionTSD4</tsd:version>
tsd:server4.1.4.1</tsd:server>
</tsd:adminInfo>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name = “collaboration”>
xs:complexType
xs:sequence
<xs:element name = “name” type = “xs:NMTOKEN”></xs:element>
xs:choice
<xs:element name = “performedAt”>
xs:complexType
xs:all
<xs:element name = “location” type = “xs:normalizedString”></xs:element>
<xs:element name = “time” type = “xs:dateTime”></xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name = “period”>
xs:complexType
xs:sequence
<xs:element name = “from” type = “xs:date”></xs:element>
<xs:element name = “to” type = “xs:date”></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:element name = “jazzMusician” type = “xs:NMTOKEN” minOccurs = “0” maxOccurs = “unbounded”>
xs:annotation
xs:appinfo
tsd:elementInfo
tsd:physical
tsd:native
tsd:objectRef
tsd:collectionRefencyclopedia</tsd:collectionRef>
<tsd:accessPredicate operator = “=”>
tsd:nodeRefjazzMusician/@ID</tsd:nodeRef>
</tsd:accessPredicate>
</tsd:objectRef>
</tsd:native>
</tsd:physical>
</tsd:elementInfo>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name = “result” type = “xs:NMTOKEN” minOccurs = “0” maxOccurs = “unbounded”></xs:element>
</xs:sequence>
<xs:attribute name = “type” use = “required”>
xs:simpleType
<xs:restriction base = “xs:NMTOKEN”>
<xs:enumeration value = “jamSession”></xs:enumeration>
<xs:enumeration value = “project”></xs:enumeration>
<xs:enumeration value = “band”></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

and schema for musicians:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault=“unqualified” elementFormDefault=“unqualified” ino:docname=“encyclopedia/jazzMusician” ino:id=“33” xmlns:tsd=“http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs=“XML Schema”>
xs:annotation
xs:appinfo
<tsd:schemaInfo name=“jazzMusician”>
<tsd:collection name=“encyclopedia”/>
<tsd:doctype name=“jazzMusician”>
tsd:logical
tsd:contentopen</tsd:content>
</tsd:logical>
</tsd:doctype>
tsd:adminInfo
tsd:server4.1.4.1</tsd:server>
tsd:versionTSD4</tsd:version>
tsd:created2004-09-01T10:58:15.466+01:00</tsd:created>
tsd:modified2004-09-01T10:58:15.466+01:00</tsd:modified>
</tsd:adminInfo>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name=“jazzMusician”>
<xs:complexType mixed=“false”>
<xs:sequence maxOccurs=“1” minOccurs=“1”>
<xs:element maxOccurs=“1” minOccurs=“1” name=“name”>
<xs:complexType mixed=“false”>
<xs:sequence maxOccurs=“1” minOccurs=“1”>
<xs:element maxOccurs=“1” minOccurs=“1” name=“first” type=“xs:normalizedString”/>
<xs:element maxOccurs=“1” minOccurs=“0” name=“middle” type=“xs:normalizedString”/>
<xs:element maxOccurs=“1” minOccurs=“1” name=“last” type=“xs:normalizedString”/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs=“1” minOccurs=“1” name=“birthDate” type=“xs:date”/>
<xs:element maxOccurs=“unbounded” minOccurs=“0” name=“instrument” type=“xs:string”/>
</xs:sequence>
<xs:attribute name=“type” use=“optional”>
xs:simpleType
<xs:restriction base=“xs:NMTOKEN”>
<xs:enumeration value=“instrumentalist”/>
<xs:enumeration value=“jazzSinger”/>
<xs:enumeration value=“jazzComposer”/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name=“ID” type=“xs:NMTOKEN” use=“required”/>
</xs:complexType>
</xs:element>
</xs:schema>

and queryes:
musicians:

declare namespace tf = “http://namespaces.softwareag.com/tamino/TaminoFunction
for $q in input()/jazzMusician
return $q

returns:

<?xml version="1.0"?>



Charlie
Parker

1920-08-19
saxophone



Dizzy
Gillespie

1917-10-21
trumpet





there we see that musitians data is missing…
declare namespace tf = “http://namespaces.softwareag.com/tamino/TaminoFunction
for $q in input()/collaboration
return $q
returns:
<?xml version="1.0"?>


post-election-jam

Blues House
1945-10-21T20:00:00

GillespieDizzy
ParkerCharlie
BGJ-47



Any idea whats wrong??

regards, Paul

Hello Paul,

I could be wrong, but I think that “Composition by object reference” (as described in DocumentComposition.htm) only works with the older X-Query language, not with XQuery.

I would recommend that you use XQuery for both joins and updates. You probably already saw that there is an example of how to do a join with XQuery in the “Dynamic joins with Tamino XQuery 4” section of the DocumentComposition.htm document.

I hope that helps,
Trevor.