11 Data Service Annotations

This chapter describes the syntax and semantics of annotations in data service documents developed within Eclipse for WebLogic. This chapter contains the following sections:

11.1 Overview

Data service documents define collections of XQuery functions and/or XQSE functions or procedures. Annotations are XML fragments comprising the character content of XQuery pragmas.

There are two types of annotations:

  • Global annotations: these pertain to the entire entity or library data service document. Global annotations are also referred to as XDS or XFL annotations respectively.

  • Local annotations: these pertain to a particular function. Local annotations are also referred to as function annotations.

11.2 XDS Annotations

There is a single XDS ("XQuery Data Service") annotation per entity data service document, which appears before all function annotations. The identifier for the pragma carrying the XDS annotation is xds. The qualified name of the top level element of the XML fragment corresponding to an XDS annotation has the local name xds and the namespace URI:

urn:annotations.ld.oracle.com

Each entity data service is associated with a unique target type. The prime type of the return type of every read function must match its target type. The target type of an entity data service is an element type whose qualified name is specified by the targetType attribute of the xds element. It is defined in a schema file associated with the entity data service.

The contents of the top-level xds element is a sequence of the following blocks of properties:

The following is an example of an XDS annotation. In this case, the target type t:CUSTOMER associates the entity data service with a t:CUSTOMER type in a schema file.

(::pragma xds <x:xds xmlns:x="urn:annotations.ld.oracle.com" 
targetType="t:CUSTOMER" xmlns:t="ld:oracleDS/CUSTOMER">
 
<author>Joe Public</author>
<relationalDB name="OracleDS"/>
 
<field type="xs:string" xpath="FIRST_NAME">
  <extension nativeFractionalDigits="0" nativeSize="64"
    nativeTypeCode="12" nativeType="VARCHAR2"
    nativeXpath="FIRST_NAME"/>
  <properties nullable="false"/>
</field>
 
<field type="xs:string" xpath="LAST_NAME">
  <extension nativeFractionalDigits="0" nativeSize="64"
    nativeTypeCode="12" nativeType="VARCHAR2"
    nativeXpath="LAST_NAME"/>
  <properties nullable="false"/>
</field>
 
<field type="xs:string" xpath="CUSTOMER_ID">
  <extension nativeFractionalDigits="0" nativeSize="64"
    nativeTypeCode="12" nativeType="VARCHAR2"
    nativeXpath="CUSTOMER_ID"/>
  <properties nullable="false" nativeKey="true"/>
</field>
 
<field type="xs:dateTime" xpath="CUSTOMER_SINCE">
  <extension nativeFractionalDigits="0" nativeSize="7"
    nativeTypeCode="93" nativeType="DATE"
    nativeXpath="CUSTOMER_SINCE"/>
  <properties nullable="false"/>
</field>
 
<field type="xs:string" xpath="EMAIL_ADDRESS">
  <extension nativeFractionalDigits="0" nativeSize="32"
    nativeTypeCode="12" nativeType="VARCHAR2"
    nativeXpath="EMAIL_ADDRESS"/>
  <properties nullable="false"/>
</field>
 
<key name="CUSTOMER_ID"/>
 
<relationshipTarget roleName="CUSTOMER_ORDER" roleNumber="2"
  XDS="ld:oracleDS/CUSTOMER_ORDER.xds" minOccurs="0"
  maxOccurs="unbounded" opposite="CUSTOMER"/>
</x:xds>::-)

11.2.1 General Properties

There are two types of general XDS properties:

11.2.1.1 Standard Document Properties

You can specify a set of standard document properties consisting of optional XML elements containing information pertaining to the author, creation date, or version of the document. You can also use the optional element named "documentation" to specify related documentation. The names and types of the elements in the standard document properties block, as well as examples of their use, are shown in Table 11-1.

Table 11-1 Standard Document Properties

Element Name Element Type Optional Example Instance

author

xs:string

Yes

<author>J. Public</author>

creationDate

xs:date

Yes

<creationDate>2004-05-31</creationDate>

version

xs:decimal

Yes

<version>2.2<version>

documentation

xs:string

Yes

<documentation> Models an online Customer </documentation>


11.2.1.2 User-Defined Properties

In addition to the standard properties, you can specify custom properties pertaining to the entire data service document using a sequence of zero (0) or more "property" elements. Each property element must be named using its "name" attribute and may contain any string content. For example:

<property name="data-refresh-rate">week</property>

11.2.2 Data Access Properties

A data service may be used to model access to an external data source or to model a transformation on top of one or more data sources or other transformations. Data services modeling external data sources are referred to as physical. Transformation data services not representing a particular data source are referred to as logical.

The block of data access properties allows each data service to define whether it is physical or not. When a data service is physical, the data access annotation describes the type of the external source being accessed by its external functions (there may be a single external source per data service) and its connection properties. When a data service is logical, the data service is designated as a user-defined view, and no connection information is required.

The following types of physical data services are supported:

  • Relational

  • Web service

  • Java function

  • Delimited content

  • XML content

The following sections describe the data access annotation for the physical data service types, as well as for data services that are designated as user-defined views. You can specify only one of these annotations in each data service. If no annotation is provided, the data service is considered a user-defined view.

11.2.2.1 Relational Data Service Annotations

The data access annotation for a relational data service consists of the element relationalDB with two required attributes, described in Table 11-2:

Table 11-2 Required Attributes for the relationalDB Element

Attribute Description

name

The JNDI name by which the external relational data source has been registered with the application server.

providerId

The identifier of the Oracle Data Service Integrator relational provider in use for the specified relational data source.


<relationalDB name="OracleDS" providerId="Oracle-9"/>

In addition, the relationalDB element can contain the following optional parts:

  • An optional element, "properties", that exposes relational provider-specific attributes, such as the values of specific settings of the Relational Database Management System (RDBMS) represented by the relational source.

  • An optional attribute, sourceBindingProviderClassName, that specifies the transformation used to determine the relational source to be used at system runtime in the place of the statically defined source.

11.2.2.2 Source Binding Provider

The value of the optional sourceBindingProviderClassName attribute should be bound to the fully-qualified name of a user-defined Java class implementing the interface:

com.bea.ld.bindings.SourceBindingProvider

defined by the following:

package com.bea.ld.bindings;
public interface SourceBindingProvider
{
  public String getBinding(String genericLocator, boolean isUpdate);
}

The user-defined implementation should provide the transformation that, given the statically configured relational source name (parameter genericLocator) and a Boolean flag indicating whether the relational source is accessed in query or update mode (parameter isUpdate), determines the name of the relational source name used by the system at runtime.

You can use this transformation mechanism to perform credential mapping. In this case, a single set of query or update operations to be performed in the name of two distinct users U1 and U2 against the same statically-configured relational source R0, is executed against two distinct relational sources R1 and R2 respectively (where all sources R0, R1, R2 represent the same RDBMS and the security policies applied to the connection credentials used for R1 and R2 correspond to the security policies applied to the application credentials of user U1 and U2, respectively).

Note:

Set the source binding provider name uniformly across all relational data services sharing the same relational source JNDI name. Although this restriction is not enforced, its violation could result in unpredictable behavior at runtime.

11.2.2.3 Web Service Data Service Annotations

The data access annotation for a data service based on a Web service consists of the empty element webService with two required attributes, described in Table 11-3:

Table 11-3 Required Attributes for the webService Element

Attribute Description

wsdl

A valid http: or ld: URI pointing to the location of the WSDL file containing the definition of the external Web service source.

Note: You must configure the Eclipse proxy information in order to access the external web service. Refer to the Eclipse documentation for details.

targetNamespace

A valid URI that is identical to the targetNamespace URI of the WSDL.


For example:

<webService targetNamespace="urn:GoogleSearch"
  wsdl="ld:google/GoogleSearch.wsdl"/>

In addition, if the physical data service models an Oracle Service Bus proxy service, the webService element can carry the optional attributes described in Table 11-4:

Table 11-4 Optional Attributes for the webService Element

Attribute Description

sbProxyServiceName

The name of the Oracle Service Bus proxy service.

sbTransportProtocol

The name of the protocol used by the proxy service. Valid values are: t3, iiop, http, t3s, iiops or https.


11.2.2.4 Java Function Data Service Annotations

The data access annotation for a Java function data service consists of the empty element javaFunction with a single required attribute named class, whose value you set to the fully qualified name of the Java class serving as the external source.

For example:

<javaFunction class="com.example.Test"/>

11.2.2.5 Delimited Content Data Service Annotations

The data access annotation for a delimited content data service is the empty element delimitedFile, accepting the optional attributes described in Table 11-5:

Table 11-5 Optional Attributes for the delimitedFile Element

Attribute Description

file

A valid URI pointing to the location of the delimited file.

schema

A valid URI pointing to the location of the XML schema file defining the type (structure) of the delimited contents. If absent, the schema is derived based on the contents.

inferredSchema

Specifies whether the schema was inferred or provided by the user. The default value is false.

delimiter

The string used as the delimiter. If absent, the fixedLength attribute should be present.

fixedLength

The fixed length of the tokens contained in fixed length content. If absent, the delimiter attribute should be present.

hasHeader

A Boolean flag indicating whether the first line of the content should be interpreted as a header. The default value is false.


For example:

<delimitedFile schema="ld:df/schemas/ALL_TYPES.xsd" hasHeader="true"
  delimiter="," file="ld:df/ALL_TYPES.csv"/>

11.2.2.6 XML Content Data Service Annotations

The data access annotation for an XML content data service is the empty element xmlFile accepting the attributes described in Table 11-6.

Table 11-6 Attributes for the xmlFile Element

Attribute Description

file

(Optional) A valid URI pointing to the location of the XML file.

schema

A valid URI pointing to the location of the XML schema file defining the type (structure) of the XML contents.


For example:

<xmlFile schema="ld:xml/somewhere/CUSTOMER.xsd"
  file="ld:xml/CUSTOMER_NESTED.xml"/>

11.2.2.7 User Defined View XDS Annotations

The data access annotation for a user-defined view data service is also known as a logical data service. It consists of the single empty element:

userDefinedView

For example:

<userDefinedView/>

11.2.3 Target Type Properties

The optional block of target type properties enables you to annotate simple valued fields in the target type of the entity data service with native type information pertaining to the following:

  • The type of the corresponding field in the underlying external source (applicable only to data source data services)

  • Information about the field's properties with respect to its update behavior. Each annotated field is represented by the element named "field"with two required attributes, described in Table 11-7:

Table 11-7 Required Attributes for the field Element

Attribute Description

xpath

An XPath value pointing to the field.

type

The qualified name of the field's simple XML schema or XQuery type.


The following is an example of a field element definition:

<field type="xs:string" xpath="FIRST_NAME">
  <extension nativeSize="64" nativeTypeCode="12" nativeType="VARCHAR2"
    nativeXpath="FIRST_NAME"/>
  <properties nullable="false"/>
</field>

11.2.3.1 Native Type Properties

Each "field" element can contain an optional "extension" element that accepts the optional attributes described in Table 11-8:

Table 11-8 Optional Attributes for the extension Element

Attribute Description

nativeXpath

A native XPath value pointing to the corresponding native field in the external source.

nativeType

The native name of the native type of the corresponding native field, as it is known to the external source.

nativeTypeCode

The native type code of the native type of the corresponding native field, as it is known to the external source. In the case of relational sources, this is the type code as reported by JDBC.

nativeSize

The native size of the native type of the corresponding native field, as it is known to the external source. In the case of relational sources, this is the size as reported by JDBC.

nativeFractionalDigits

The native scale of the native type of the corresponding native field, as it is known to the external source. In the case of relational sources, this is the scale as reported by JDBC.

nativeKey

A Boolean value indicating whether the field participates in the native record's key. The default is false.


11.2.3.2 Update-related Type Properties

Each "field" element can also contain an optional "properties" element that accepts the optional attributes described in Table 11-9:

Table 11-9 Optional Attributes for the properties Element

Attribute Description

immutable

A Boolean value specifying whether the field is immutable (read-only) or not. The default value is false.

nullable

A Boolean value specifying whether the field accepts null values or not. The default value is false.


11.2.4 Key Properties

The optional block of key properties enables you to specify an identity constraint (key) on the entity data service target type. An identity constraint for an entity data service is represented by the element "key" along with an XML schema specifying the key type.

The "key" element accepts a required attribute "type", whose value should be bound to the qualified name of the element type defining the locations of the data fields comprising the key. The key type should in turn be specified by an XML schema imported by the data service.

The "key" element may also carry the optional attributes in Table 11-10:

Table 11-10 Optional Attributes for the key Element

Attribute Description

name

Serves as the key alias. Might be used as a user-friendly description of the semantic constraints expressed by the key.

inferred

A Boolean value specifying whether the key was auto-derived or user-defined. The default is true.

inferredSchema

A Boolean value specifying whether the key schema was auto-derived or user-defined. The default is true.


In most cases, the identity constraint refers to the collection of data bindings returned by the entity data service's read functions, with each binding's type being the data service target type. In the case that a data service returns an XML document, the collection on which the identity constraint may be specified is normally defined by some element nested within the document element. In such a case, the "key" element contains an optional "selector" element that is used to specify the collection. The "selector" element carries a required "xpath" attribute, whose value is an XPath value pointing to the nested element defining the collection root. The XPath forms accepted by this attribute are simplified XPaths, using only the element or attribute axes and no predicates.

The following is an example of a "key" element definition:

<key name="CUSTOMER_ID"/>
  <selector xpath="CUSTOMER"/>
</key>

11.2.5 Relationship Properties

The optional block of relationship properties enables you to specify a set of relationship targets. A relationship target of an entity data service is an entity data service with which first service maintains a unidirectional or bidirectional relationship. Unidirectional relationships are realized through one or more navigate functions in the first data service that returns one or more instances of objects of the second service target type. Bidirectional relationships require that reciprocal functions are present in the second data service as well.

A relationship target is represented by the element relationshipTarget that accepts the attributes described in Table 11-11:

Table 11-11 Attributes for the relationshipTarget Element

Attribute Description

roleName

A string that uniquely identifies the relationship target inside the data service.

roleNumber

(Optional) Either 1 or 2 (default is 1). The roleNumber specifies the index of the relationship target within the relationship.

XDS

The Oracle Data Service Integrator URI of the data service serving as the relationship target.

minOccurs

(Optional) The minimum cardinality of relationship target instances participating in this relationship. Possible values are all non-negative integers and the empty string. The default value is the empty string.

maxOccurs

(Optional) The maximum cardinality of relationship target instances participating in this relationship. Possible values are all positive integers, the string unbounded, and the empty string. The default is the empty string.

opposite

(Optional) String attribute that indicates the reciprocal relationship target in the case of bidirectional relationships. The value of this attribute is the identifier used to identify this data service as a relationship target in the data service identified by the value of the XDS attribute.


Additionally, the relationshipTarget element can itself contain the element "relationship" which in turn contains the nested element "description" that contains a human readable description about the relationship.

The following is an example of a relationshipTarget element definition:

<relationshipTarget roleName="CUSTOMER_ORDER" roleNumber="2"
  XDS="ld:oracleDS/CUSTOMER_ORDER.xds" minOccurs="0"
  maxOccurs="unbounded" opposite="CUSTOMER"/>

11.2.6 Update Properties

The optional block of update properties enables you to specify a set of properties that establish certain policies about updating an entity data service's underlying sources. In particular, you can specify the following policies:

11.2.6.1 Optimistic Locking Fields

SDO update assumes optimistic locking transactional semantics. The data service being updated can specify the fields that should be checked for updates during the interim using the empty element optimisticLockingFields that accepts one of the following as its content:

  • An empty element, named updated, to specify only updated fields.

  • An empty element, named projected, to specify all projected fields.

  • One or more elements, named "field", that accept a required string-valued attribute named name to specify user-specified fields.

The following is an example of a functionForDecomposition element definition:

<optimisticLockingFields>
  <updated/>
</optimisticLockingFields>

11.2.6.2 Security Properties

You can use a data service to define one or more user-defined, logical protected resources.

The element secureResources, containing one or more string-valued elements named secureResource, can be used for this purpose.

For example:

<secureResources>
  <secureResource>MyResource</secureResource/>
  <secureResource>MyOtherResource</secureResource/>
</secureResources>

You can link a logical resource defined using this syntax to a user-provided security policy using the Oracle Data Service Integrator Console. Query content can inquire about a user's ability to access a logical resource using the built-in function isAccessAllowed().

11.3 Function Annotations

There is a single function annotation per data service function or procedure, which appears before the function or procedure declaration in the document. The identifier for the pragma carrying the function annotation is "function". The qualified name of the top level element of the XML fragment corresponding to a function annotation has the local name "function" and the namespace URI urn:annotations.ld.oracle.com.

Modeling Kind

Each entity data service function or procedure is classified using one of the following categories:

  • Create procedure

  • Read function

  • Update procedure

  • Delete procedure

  • Navigate function

  • Library function or procedure

The classification of a data service method is determined by the value of the optional attribute "kind" in the function element, which accepts the values create, read, update, delete, navigate, or library to denote the corresponding categories. The default value is library.

Each library data service function or procedure is always of kind library.

The prime type of the return type of a read function must match the target type of the entity data service. In addition, the function element for a navigate function must carry a string-valued attribute returns whose value must match the role name of a relationship target defined in the data service. Moreover, the prime type of the return type of a navigate function must match the target type of the data service serving as the relationship target.

An operation designated as a procedure has in the general case side-effects. In other words, its invocation entails modifications of the state of the affected data sources. Therefore, a procedure may not be referenced by Oracle Data Service Integrator functions.

A library function residing in a relational database function library data service file is always external. It may not be invoked directly by clients. Instead, it should be referenced by other data service functions or ad-hoc queries.

Visibility

Functions or procedures may also be classified based on their visibility using one of the following categories:

  • Public

  • Protected

  • Private

The classification of a data service method is determined by the value of the optional attribute "visibility" in the function element, which accepts the values public, protected, or private to denote the corresponding categories. The default value is protected.

Public methods are accessible by Oracle Data Service Integrator dataspace clients as well as other data services within the dataspace.

Protected methods are not accessible by Oracle Data Service Integrator dataspace clients but can be accessed by other data services within the dataspace.

Private methods may be accessed only by other methods within the data service in which they are defined.

Primary

The optional boolean attribute isPrimary may also be used to classify entity data service methods as primary or non-primary. The default value is false.

This property is applicable only to create, update and delete procedures or read functions.

In the case of a procedure, when this property is set to true, it denotes that the procedure should be the one to be automatically used by the update maps of logical data services directly depending on the data service defining the procedure, in order to perform the corresponding update operation (that is, create, update or delete).

In the case of a read function, when this property is set to true, it denotes that the read function should be the one to be used to infer the data service update map.

There may exist at most one primary method of each kind specified within an entity data service.

URI

Finally, the namespace URIs of the qualified names of all the functions and/or procedures in a data service must specify the location of the data service document in the Oracle Data Service Integrator repository. For example:

ld:{directory path to data service folder}/{data service file name without 
extension}

The function element accepts the additional optional attributes described in Table 11-12.

Table 11-12 Optional Attributes for the function Element

Attribute Description

nativeName

Applicable to data source functions or procedures, nativeName is the name of the function or procedure as it is known to the external source. In the case of relational sources, for example, it corresponds to the table name.

nativeLevel1Container

Applicable to data source functions or procedures that represent external sources employing hierarchical containment schemes; nativeLevel1Container is the name of the top-level native container, as it is known to the external source.In the case of relational sources, for example, it corresponds to the catalog name, whereas, in the case of Web service sources, it corresponds to the service name.

nativeLevel2Container

Applicable to data source functions or procedures that represent external sources employing hierarchical containment schemes; nativeLevel2Containeris the name of the second-level native container, as it is known to the external source. In the case of relational sources, for example, it corresponds to the schema name. In the case of Web service sources, it corresponds to the port name.

nativeLevel3Container

Applicable to data source functions or procedures that represent external sources employing hierarchical containment schemes; nativeLevel3Containeris the name of the top-level native container, as it is known to the external source. In the case of relational sources, for example, it corresponds to the stored procedure package name.

style

Applicable to data source functions or procedures, style is a native qualifier by which the function is known to the external source (e.g. table, view, storedProcedure, or sqlQuery for relational sources; rpc or document for Web services).

roleName

Applicable to navigate functions, roleName should match the value of the roleName attribute of the relationshipTarget implemented by the function.


The content of the top-level function element is a sequence of the following blocks of properties:

The following is an example of a function annotation:

( ::pragma function
<f:function xmlns:f="urn:annotations.ld.oracle.com" kind="read" 
nativeName="CUSTOMER" nativeLevel2Container="RTL" style="table">
<nonCacheable/>
</f:function>::-)

11.3.1 General Properties

All standard document properties and user-defined properties defined in Section 11.2.1.1, "Standard Document Properties" and Section 11.2.1.2, "User-Defined Properties" are applicable to function annotations.

11.3.2 UI Properties

A set of user interface properties may be introduced by the XQuery Editor to persist location information about the graphical components representing the expression in the function body. UI properties are represented by the element uiProperties which accepts a sequence of one or more elements, named component, as its content. Each "component" element accepts the attributes described in Table 11-13.

Table 11-13 Attributes for the component Element

Attribute Description

identifier

An identifier for the UI component.

minimized

A Boolean flag indicating whether the UI component has been minimized or not.

x

The x-coordinate for the UI component.

y

The y-coordinate for the UI component.

w

The width of the UI component.

h

The height of the UI component.

viewPosX

The x-coordinate of the scrollbar position of the component.

viewPosY

The y-coordinate of the scrollbar position of the component.


In addition, each "component" element may optionally contain one or more treeInfo elements containing information about the tree representation of the types pertaining to the component. In the absence of the above property, the query editor uses the default layout.

11.3.3 Cache Properties

You can use the optional block of cache properties to specify whether a function can be cached or not. You should specify a function whose results for the same set of arguments are intrinsically highly volatile as non-cached. On the other hand, you should specify a function whose results for the same set of arguments are either fixed or remain unchanged for a period of time as cacheable.

This property of a function is represented by the empty element nonCacheable. In the absence of the nonCacheable element, a function is considered to be potentially cacheable. The following is an example:

<nonCacheable/>

11.3.4 Transaction Properties

You can use the optional block of transaction properties to specify whether a procedure can participate in a transaction or not. This property is applicable only to physical procedures bound to external data sources of type Java or Oracle Service Bus proxy service. A transactional procedure should rollback its effects if the overall transaction, in which it participates, fails.

This property is represented by the empty element nonTransactional. In the absence of the nonTransactional element, a procedure is considered to be transactional. The following is an example:

<nonTransactional/>

11.3.5 Behavioral Properties

The optional block of behavioral properties allows you to provide information related to known associations between a function's input and its output, or across two or more functions. In particular, you may specify the following:

11.3.5.1 Inverse Functions

Given an XQuery function f, the optional block of inverse functions may be used in order to denote a function g, defined over the range of f, that, when composed with f (that is, g(f)), renders one of the parameters of f. If f has multiple parameters, an inverse function may be defined for each one of its parameters.

The inverse functions block is represented by an optional element, named inverseFunctions, which accepts as its content a sequence of empty elements, named inverseFunction. Each inverseFunction element accepts the following attributes:

  • parameterIndex: optional attribute denoting the index of the parameter for which the inverse function is defined. The index of the first parameter is assumed to be 1. It may be omitted if the function being annotated has a single parameter.

  • name: required attribute denoting the fully-qualified name of the inverse function.

Note:

Both the annotated and the inverse function must be either built-in or external XQuery functions.

The following is an example of an inverseFunctions element definition:

<inverseFunctions>
  <inverseFunction parameterIndex="2" name="p:MyInverse" xmlns:p ="urn:test"/>
</inverseFunctions>

11.3.5.2 Equivalent Transforms

Given an XQuery function: f, the optional block of equivalent transforms may be used in order to denote a pair of functions_C_ and C' with identical signatures and equivalent semantics, that accept f as one of their parameters. In simple terms, the equivalence is perceived to mean that each occurrence of C(...,f,...) may be safely substituted with: C'(...,f,...).

The equivalent transforms block is represented by an optional element, named equivalentTransforms, which accepts as its content a sequence of empty elements, named pair. Each pair element accepts the following required attributes:

  • source: denotes the fully qualified name of the source transform (that is, C).

  • target: denotes the fully qualified name of the target transform (that is, C').

  • arity: denotes the (common) arity of the source and target transforms.

Note:

The source transform may be either a built-in or external function. Both source and target transforms must not be defined as invertible functions.

The following is an example of an equivalentTransforms element definition:

<equivalentTransforms>
  <pair source="p:sourceFunction_1" target="p:targetFunction_1"   arity="1" 
xmlns:p ="urn:test1"/>
  <pair source="q:sourceFunction_2" target="q:targetFunction_2"   arity="3" 
xmlns:q="urn:test2"/>
</equivalentTransforms>

11.3.6 Polymorphic Functions

A library function residing in a relational database function library data service may be designated as polymorphic if its actual return type can be determined from the actual type of one of its parameters. A polymorphic function is annotated by an optional element, isPolymorphic, which accepts as its content an empty element, named parameter. The parameter element accepts the following optional attribute:

  • index: denotes the index of the parameter whose actual type determines the function's actual return type. The index of the first parameter is assumed to be 1. It may be omitted if the function being annotated has a single parameter.

The following is an example of an isPolymorphic element definition:

<isPolymorphic>
  <parameter index = "2"/>
</isPolymorphic>

11.3.7 Signature Properties

You can use the optional block of signature properties to annotate the parameters of a data service function or procedure with additional information to that provided by the function signature. These properties are applicable to physical data service functions or procedures.

The signature properties block is represented by the element params which accepts a sequence of one or more elements, named param, as its content. Each param element is an empty element that accepts the optional attributes described in Table 11-14:

Table 11-14 Optional Attributes for the param Element

Attribute Description

name

The name of the parameter, as it is known to the external source.

nativeType

The native type of the parameter, as it is known to the external source.

nativeTypeCode

The native type code of the parameter, as it is known to the external source.

xqueryType

The qualified name of the XML Schema or XQuery type used for the parameter.

kind

One of the following values: unknown, in, inout, out, return or result (applicable to stored procedures).


The following is an example of a params element definition:

<params>
  <param nativeType="java.lang.String"/>
  <param nativeType="java.lang.int"/>
</params>

11.3.8 Native Properties

You can use native properties to further annotate a data source function or procedure based on the type of the external source that it represents. There are two types of native properties pertaining to relational and Web service sources respectively:

11.3.8.1 SQL Query Properties

The function annotation element of a function that represents a user-defined SQL query has its style attribute set to sqlQuery and accepts a nested element, named sql. The sql element accepts string content that corresponds to the statement of the (possibly parameterized) SQL query that the function represents.

If required, the statement can be escaped inside a CDATA section to account for reserved XML characters (for example: <, >, &). The sql element also accepts the optional attribute isSubquery whose boolean value indicates whether the SQL statement may be used as a nested SQL sub-query. If the attribute is absent, its value defaults to true.

The following is an example of a sqlQuery element definition:

<sql isSubquery="true">
  SELECT t.FIRST_NAME FROM RTLALL.dbo.CUSTOMER t</sql>

11.3.8.2 SOAP Handler Properties

The "function" annotation element of a function or procedure that represents a Web service call accepts a nested element, interceptorConfiguration. The interceptorConfiguration element accepts two required attributes:

Table 11-15 Required Attributes for the interceptorConfiguration Element

Attribute Description

fileName

The location of the file containing the configuration of the SOAP handler chains that are applicable to the Web service.

aliasName

The alias name by which the SOAP handler chain has been configured.


11.3.9 Implementation Properties

You can use implementation properties to specify that an external create, update or delete procedure is implemented by the update map of the data service in which it is defined.

The optional element implementation accepts the required empty element updateTemplate as its content.

For example:

<implementation>
  <updateTemplate/>
</implementation>

11.4 XFL Annotations

There is a single XFL ("XQuery Function Library") annotation per library data service document, which appears before any function annotation in the document. The identifier for the pragma carrying the XFL annotation is xfl. The qualified name of the top level element of the XML fragment corresponding to an XFL annotation has the local name:

xfl

and the namespace URI:

urn:annotations.ld.oracle.com

The contents of the top-level xfl element is a sequence of the following blocks of properties.

The following sections provide detailed descriptions of each block of properties, while the following excerpt provides an example of a XFL annotation, which may serve as a reference.

(::pragma xfl <x:xfl xmlns:x="urn:annotations.ld.oracle.com">
<creationDate>2005-03-09T17:48:58</creationDate>
<webService targetNamespace="urn:GoogleSearch"
  wsdl="ld:google/GoogleSearch.wsdl"/>
</x:xfl>::-)

11.4.1 General Properties

The general properties applicable to an library data service document are identical to the general properties for an entity data service document, as described in Section 11.2.1, "General Properties".

11.4.2 Data Access Properties

Each library data service document defines one or more XQuery functions and/or XQSE functions or procedures that serve as library operations that can be used either inside other entiry or library data service documents.

Since library data service documents do not have a target type, the return types of the library functions found inside these document may differ from each other. In particular, a function inside a library data service document may return a value having a simple type (or any other type). Library data service functions can be external data source functions or user-defined.

The following types of library data service documents are supported:

  • Relational (physical)

  • Web service (physical)

  • Java function (physical)

  • Relational database function (physical)

  • User-defined view (logical)

You can specify only one of the annotations in each library data service. If no annotation is provided, the library data service is considered a user-defined view.

The data access properties for Relational, Web service, Java function, and user-defined view library data service documents are the same as the corresponding properties for entity data service documents, as described above.

A relational database function library data service contains native functions, either database vendor-provided or user-defined in the database, from one or more relational data sources, modeled as external XQuery functions.

The data access annotation for a relational database function library data service comprises an element named customNativeFunctions with a single child element, named relational, whose content is a sequence of one or more elements named dataSource. Each dataSource element contains a single text value, which should be set to the JNDI name by which the external relational source has been registered with the application server.

For example:

<customNativeFunctions>
<relational>
  <dataSource>oracleDS1</dataSource>
  <dataSource>oracleDS2</dataSource>
  </relational>
</customNativeFunctions>

11.4.3 Security Properties

The same as in entity data services.

11.5 Data Service Annotations Schema

This section provides the schema for data service annotations.

<?xml version="1.0"?>
<xs:schema targetNamespace="urn:annotations.ld.oracle.com"
xmlns:tns="urn:annotations.ld.oracle.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" 
attributeFormDefault="unqualified">
  <!--==================-->
  <!--  XDS annotation  -->
  <!--==================-->
  <xs:element name="xds">
    <xs:complexType>
      <xs:sequence>
        <!-- document properties -->
        <xs:element name="author" type="xs:string" minOccurs="0"/>
        <xs:element name="comment" type="xs:string" minOccurs="0"/>
        <xs:element name="creationDate" type="xs:dateTime" minOccurs="0"/>
        <xs:element name="documentation" type="xs:string" minOccurs="0"/>
        <xs:element name="version" type="xs:decimal" minOccurs="0"/>
        <!-- user defined properties -->
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
          <xs:element name="property">
            <xs:complexType>
              <xs:simpleContent>
                <xs:extension base="xs:string">
                  <xs:attribute name="name" type="xs:string"/>
                </xs:extension>
              </xs:simpleContent>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <!-- data access properties -->
        <xs:choice>
          <!-- choice 1: java functions -->
          <xs:element name="javaFunction">
            <xs:complexType>
              <xs:attribute name="class" type="xs:string" use="required"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 2: web services -->
          <xs:element name="webService">
            <xs:complexType>
              <xs:attribute name="wsdl" type="xs:anyURI" use="required"/>
              <xs:attribute name="targetNamespace" type="xs:anyURI" use="required"/>
              <xs:attribute name="sbProxyServiceName" type="xs:string"/>
              <xs:attribute name="sbTransportProtocol" type="tns:SBTransportProtocolType"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 3: relational sources -->
          <xs:element name="relationalDB">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="properties" minOccurs="0">
                  <xs:complexType>
                    <xs:anyAttribute processContents="lax" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
              <xs:attribute name="name" type="xs:string" use="required"/>
              <xs:attribute name="providerId" type="xs:string" />
              <xs:attribute name="dbType" type="xs:string"/>
              <xs:attribute name="dbVersion" type="xs:string"/>
              <xs:attribute name="driver" type="xs:string"/>
              <xs:attribute name="uri" type="xs:string"/>
              <xs:attribute name="username" type="xs:string"/>
              <xs:attribute name="password" type="xs:string"/>
              <xs:attribute name="SID" type="xs:string"/>
              <xs:attribute name="sourceBindingProviderClassName" type="xs:string"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 4: delimited files -->
          <xs:element name="delimitedFile">
            <xs:complexType>
              <xs:attribute name="file" type="xs:anyURI"/>
              <xs:attribute name="schema" type="xs:anyURI"/>
              <xs:attribute name="inferredSchema" type="xs:boolean" default="false"/>
              <xs:attribute name="delimiter" type="xs:string"/>
              <xs:attribute name="fixedLength" type="xs:positiveInteger"/>
              <xs:attribute name="hasHeader" type="xs:boolean" default="false"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 5: XML files -->
          <xs:element name="xmlFile">
            <xs:complexType>
              <xs:attribute name="file" type="xs:anyURI"/>
              <xs:attribute name="schema" type="xs:anyURI" use="required"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 6: user defined view -->
          <xs:element name="userDefinedView" minOccurs="0"/>
          <!-- choice 7: nothing, defaults to userDefinedView -->
          <xs:sequence/>
        </xs:choice>
        <!-- field annotations -->
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
          <xs:element name="field">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="extension" minOccurs="0">
                  <xs:complexType>
                    <xs:sequence minOccurs="0">
                      <xs:element name="autoNumber">
                        <xs:complexType>
                          <xs:attribute name="type" type="tns:autoNumberType" use="required"/>
                          <xs:attribute name="sequenceObjectName" type="xs:string"/>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                    <xs:attribute name="nativeXpath" type="xs:string"/>
                    <xs:attribute name="nativeType" type="xs:string"/>
                    <xs:attribute name="nativeTypeCode" type="xs:int"/>
                    <xs:attribute name="nativeSize" type="xs:int"/>
                    <xs:attribute name="nativeFractionalDigits" type="tns:scaleType"/>
                    <xs:attribute name="nativeKey" type="xs:boolean" default="false"/>
                    <!-- relational: autoNumber -->
                    <!-- relational: native column names and types -->
                  </xs:complexType>
                </xs:element>
                <xs:element name="properties">
                  <xs:complexType>
                    <xs:attribute name="immutable" type="xs:boolean" default="false"/>
                    <xs:attribute name="nullable" type="xs:boolean" default="false"/>
                    <xs:attribute name="transient" type="xs:boolean" default="false"/>
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
              <xs:attribute name="xpath" type="xs:string" use="required"/>
              <xs:attribute name="type" type="xs:string" use="required"/>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <!-- keys -->
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
          <xs:element name="key">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="selector" minOccurs="0">   
<!-- defaults to . -->
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="extension" minOccurs="0">
                        <xs:complexType>
                          <xs:attribute name="nativeXpath" type="xs:string" use="required"/>
                        </xs:complexType>
                      </xs:element>
                    </xs:sequence>
                    <xs:attribute name="xpath" type="xs:string" use="required"/>
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
              <xs:attribute name="name" type="xs:string"/>
              <xs:attribute name="type" type="xs:QName"/>
              <xs:attribute name="inferred" type="xs:boolean" default="true"/>
              <xs:attribute name="inferredSchema" type="xs:boolean" default="true"/>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <!-- relationships -->
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
          <xs:element name="relationshipTarget">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="relationship" minOccurs="0">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="description" type="xs:string" minOccurs="0"/>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
              <xs:attribute name="roleName" type="xs:string" use="required"/>
              <xs:attribute name="roleNumber" type="tns:roleType" default="1"/>
              <xs:attribute name="XDS" type="xs:string" use="required"/>
              <xs:attribute name="minOccurs" type="tns:allNNI" default="1"/>
              <xs:attribute name="maxOccurs" type="tns:allNNI" default="1"/>
              <xs:attribute name="opposite" type="xs:string"/>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <!-- SDO elements -->
        <xs:element name="functionForDecomposition" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="name" type="xs:QName" use="required"/>
            <xs:attribute name="arity" type="xs:int" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="javaUpdateExit" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="className" type="xs:string" use="required"/>
            <xs:attribute name="classFile" type="xs:string"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="optimisticLockingFields" minOccurs="0">
          <xs:complexType>
            <xs:choice>
              <xs:element name="updated">
                <xs:complexType/>
              </xs:element>
              <xs:element name="projected">
                <xs:complexType/>
              </xs:element>
              <xs:element name="field" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="name" type="xs:string" use="required"/>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
        <!-- security -->
        <xs:element name="secureResources" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="secureResource" type="xs:NCName" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="readOnly" minOccurs="0">
          <xs:complexType/>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="targetType" type="xs:QName" use="required"/>
    </xs:complexType>
  </xs:element>
  <!--==================-->
  <!--  XFL annotation  -->
  <!--==================-->
  <xs:element name="xfl">
    <xs:complexType>
      <xs:sequence>
        <!-- document properties -->
        <xs:element name="author" type="xs:string" minOccurs="0"/>
        <xs:element name="comment" type="xs:string" minOccurs="0"/>
        <xs:element name="creationDate" type="xs:dateTime" minOccurs="0"/>
        <xs:element name="documentation" type="xs:string" minOccurs="0"/>
        <xs:element name="version" type="xs:decimal" minOccurs="0"/>
        <!-- user defined properties -->
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
          <xs:element name="property">
            <xs:complexType>
              <xs:simpleContent>
                <xs:extension base="xs:string">
                  <xs:attribute name="name" type="xs:string"/>
                </xs:extension>
              </xs:simpleContent>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
        <!-- data access properties -->
        <xs:choice>
          <!-- choice 1: java functions -->
          <xs:element name="javaFunction">
            <xs:complexType>
              <xs:attribute name="class" type="xs:string" use="required"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 2: web services -->
          <xs:element name="webService">
            <xs:complexType>
              <xs:attribute name="wsdl" type="xs:anyURI" use="required"/>
              <xs:attribute name="targetNamespace" type="xs:anyURI" use="required"/>
              <xs:attribute name="sbProxyServiceName" type="xs:string"/>
              <xs:attribute name="sbTransportProtocol" type="tns:SBTransportProtocolType"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 3: relational sources -->
          <xs:element name="relationalDB">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="properties" minOccurs="0">
                  <xs:complexType>
                    <xs:anyAttribute processContents="lax" />
                  </xs:complexType>
                </xs:element>
              </xs:sequence>
              <xs:attribute name="name" type="xs:string" use="required"/>
              <xs:attribute name="providerId" type="xs:string" />
              <xs:attribute name="dbType" type="xs:string"/>
              <xs:attribute name="dbVersion" type="xs:string"/>
              <xs:attribute name="driver" type="xs:string"/>
              <xs:attribute name="uri" type="xs:string"/>
              <xs:attribute name="username" type="xs:string"/>
              <xs:attribute name="password" type="xs:string"/>
              <xs:attribute name="SID" type="xs:string"/>
              <xs:attribute name="sourceBindingProviderClassName" type="xs:string"/>
            </xs:complexType>
          </xs:element>
          <!-- choice 6: user defined view -->
          <xs:element name="userDefinedView" minOccurs="0"/>
          <!-- choice 7: nothing, defaults to userDefinedView -->
          <xs:sequence/>
          <!-- choice 8: custom native functions -->
          <xs:element name="customNativeFunctions">
            <xs:complexType>
              <xs:choice>
                <xs:element name="relational">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="dataSource" type="xs:string" maxOccurs="unbounded"/>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:choice>
            </xs:complexType>
          </xs:element>
        </xs:choice>
         <!-- field annotations -->
          <xs:sequence minOccurs="0" maxOccurs="unbounded">
            <xs:element name="field">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="extension" minOccurs="0">
                    <xs:complexType>
                      <xs:sequence minOccurs="0">
                        <xs:element name="autoNumber">
                          <xs:complexType>
                            <xs:attribute name="type" type="tns:autoNumberType" use="required"/>
                            <xs:attribute name="sequenceObjectName" type="xs:string"/>
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                      <xs:attribute name="nativeXpath" type="xs:string"/>
                      <xs:attribute name="nativeType" type="xs:string"/>
                      <xs:attribute name="nativeTypeCode" type="xs:int"/>
                      <xs:attribute name="nativeSize" type="xs:int"/>
                      <xs:attribute name="nativeFractionalDigits" type="tns:scaleType"/>
                      <!-- relational: autoNumber -->
                      <!-- relational: native column names and types -->
                    </xs:complexType>
                  </xs:element>
                  <xs:element name="properties">
                    <xs:complexType>
                      <xs:attribute name="immutable" type="xs:boolean" default="false"/>
                      <xs:attribute name="nullable" type="xs:boolean" default="false"/>
                      <xs:attribute name="transient" type="xs:boolean" default="false"/>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
                <xs:attribute name="xpath" type="xs:string" use="required"/>
                <xs:attribute name="type" type="xs:string" use="required"/>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
 
      <xs:element name="secureResources" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="secureResource" type="xs:NCName" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <!--=======================-->
  <!--  function annotation  -->
  <!--=======================-->
  <xs:element name="function">
    <xs:complexType>
      <xs:sequence>
 
        <!-- standard properties -->
        <xs:element name="author" type="xs:string" minOccurs="0"/>
        <xs:element name="comment" type="xs:string" minOccurs="0"/>
        <xs:element name="version" type="xs:decimal" minOccurs="0"/>
        <xs:element name="documentation" type="xs:string" minOccurs="0"/>
 
        <!-- user defined properties -->
        <xs:sequence minOccurs="0" maxOccurs="unbounded">
          <xs:element name="property">
            <xs:complexType>
              <xs:simpleContent>
                <xs:extension base="xs:string">
                  <xs:attribute name="name" type="xs:string"/>
                </xs:extension>
              </xs:simpleContent>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
 
        <!-- UI properties -->
        <xs:element name="uiProperties" minOccurs="0">
          <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
              <xs:element name="component">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="treeInfo" minOccurs="0" maxOccurs="unbounded">
                      <xs:complexType>
                        <xs:sequence>
                            <xs:element name="collapsedNodes" minOccurs="0">
                            <xs:complexType>
                              <xs:sequence>
                                    <xs:element name="collapsedNode" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                        <xs:attribute name="id" type="xs:string"/>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="identifier" type="xs:string"/>
                  <xs:attribute name="minimized" type="xs:boolean" default="false"/>
                  <xs:attribute name="x" type="xs:int"/>
                  <xs:attribute name="y" type="xs:int"/>
                  <xs:attribute name="w" type="xs:int"/>
                  <xs:attribute name="h" type="xs:int"/>
                  <xs:attribute name="viewPosX" type="xs:int"/>
                  <xs:attribute name="viewPosY" type="xs:int"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
 
        <!-- sql statement -->
        <xs:element name="sql" minOccurs="0">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="isSubquery" type="xs:boolean" default="true"/>
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
 
        <!-- cache -->
        <xs:element name="nonCacheable" minOccurs="0">
          <xs:complexType/>
        </xs:element>
 
        <!-- transactions -->
        <xs:element name="nonTransactional" minOccurs="0">
          <xs:complexType/>
        </xs:element>
 
        <!-- optimization -->
        <xs:element name="outputIsOrderedBy" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <!-- absent for parameters whose order in the function signature
                   coincides with their order in the order by list -->
              <xs:element name="parameter" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <!-- 1, 2, ... -->
                  <xs:attribute name="index" type="xs:int" use="required"/>
                  <!-- overrides default -->
                  <xs:attribute name="mode" type="tns:orderingModeType"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="mode" type="tns:orderingModeType" use="required"/>
          </xs:complexType>
        </xs:element>
 
        <xs:element name="inverseFunctions" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="inverseFunction" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <!-- 1, 2, ... -->
                  <xs:attribute name="parameterIndex" type="xs:int"/>
                  <xs:attribute name="name" type="xs:QName" use="required"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="equivalentTransforms" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="pair" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:attribute name="source" type="xs:QName" use="required"/>
                  <xs:attribute name="target" type="xs:QName" use="required"/>
                  <xs:attribute name="arity"  type="xs:int"   use="required"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
 
        <!-- polymorphism -->
        <xs:element name="isPolymorphic" minOccurs="0">
          <xs:complexType>
            <xs:choice>
              <xs:element name="parameter">
                <xs:complexType>
                  <xs:sequence/>
                  <!-- optional: defaults to 1 -->
                  <xs:attribute name="index" type="xs:nonNegativeInteger"/>
                </xs:complexType>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
 
        <!-- signature: used by java functions and stored procedures -->
        <xs:element name="params" minOccurs="0">
          <xs:complexType>
            <xs:sequence maxOccurs="unbounded">
              <xs:element name="param">
                <xs:complexType>
                  <xs:attribute name="name" type="xs:string"/>
                  <xs:attribute name="nativeType" type="xs:string"/>
                  <xs:attribute name="nativeTypeCode" type="xs:int"/>
                  <xs:attribute name="xqueryType" type="xs:QName"/>
                  <xs:attribute name="kind" type="tns:paramKindType"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <!-- interceptor configuration: used by webservice SOAP interceptors -->
        <xs:element name="interceptorConfiguration" minOccurs="0">
          <xs:complexType>
            <xs:attribute name="aliasName" type="xs:string" use="required"/>
            <xs:attribute name="fileName" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
 
        <!-- implementation -->
        <xs:element name="implementation" minOccurs="0">
          <xs:complexType>
            <xs:choice>
              <xs:element name="updateTemplate">
                <xs:complexType/>
              </xs:element>
            </xs:choice>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
 
      <xs:attribute name="visibility" type="tns:functionVisibilityType" default="protected"/>
      <xs:attribute name="kind" type="tns:functionKindType" default="library"/>
      <xs:attribute name="isPrimary" type="xs:boolean" default="false"/>
      <xs:attribute name="roleName" type="xs:string"/>
      <xs:attribute name="nativeName" type="xs:string"/>
      <xs:attribute name="nativeLevel1Container" type="xs:string"/>
      <xs:attribute name="nativeLevel2Container" type="xs:string"/>
      <xs:attribute name="nativeLevel3Container" type="xs:string"/>
      <xs:attribute name="style" type="tns:functionStyleType"/>
    </xs:complexType>
  </xs:element>
  <!--================-->
  <!--  common types  -->
  <!--================-->
  <xs:simpleType name="functionVisibilityType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="public"/>
      <xs:enumeration value="protected"/>
      <xs:enumeration value="private"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="functionKindType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="read"/>
      <xs:enumeration value="navigate"/>
      <xs:enumeration value="create"/>
      <xs:enumeration value="update"/>
      <xs:enumeration value="delete"/>
      <xs:enumeration value="library"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="functionStyleType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="table"/>
      <xs:enumeration value="view"/>
      <xs:enumeration value="storedProcedure"/>
      <xs:enumeration value="sqlQuery"/>
      <xs:enumeration value="document"/>
      <xs:enumeration value="rpc"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- used by stored procedures -->
  <xs:simpleType name="paramKindType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="unknown"/>
      <xs:enumeration value="in"/>
      <xs:enumeration value="inout"/>
      <xs:enumeration value="out"/>
      <xs:enumeration value="return"/>
      <xs:enumeration value="result"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- used by maxOccurs in relationship -->
  <xs:simpleType name="allNNI">
    <xs:union memberTypes="xs:nonNegativeInteger">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="unbounded"/>
          <xs:enumeration value=""/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  <!-- used by relationships -->
  <xs:simpleType name="roleType">
    <xs:restriction base="xs:nonNegativeInteger">
      <xs:enumeration value="1"/>
      <xs:enumeration value="2"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="autoNumberType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="identity"/>
      <xs:enumeration value="sequence"/>
      <xs:enumeration value="userComputed"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="nullSortOrderType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="high"/>
      <xs:enumeration value="low"/>
      <xs:enumeration value="unknown"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="scaleType">
    <xs:union memberTypes="xs:int">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="null"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:union>
  </xs:simpleType>
  <xs:simpleType name="orderingModeType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="ascending"/>
      <xs:enumeration value="descending"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="stringListType">
    <xs:list itemType="xs:string"/>
  </xs:simpleType>
  <xs:simpleType name="dataSourcesType">
    <xs:restriction base="tns:stringListType">
       <xs:minLength value="1"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="SBTransportProtocolType">
      <xs:restriction base="xs:string">
          <xs:enumeration value="t3"/>
          <xs:enumeration value="iiop"/>
          <xs:enumeration value="http"/>
          <xs:enumeration value="t3s"/>
          <xs:enumeration value="iiops"/>
          <xs:enumeration value="https"/>
      </xs:restriction>
  </xs:simpleType>
</xs:schema>