Not logged in : Login
(Sponging disallowed)

About: http://demo.openlinksw.com/tutorial/xmlsql/ms_a_3/ms_a_3.vsp     Goto   Sponge   Distinct   Permalink

An Entity of Type : foaf:Document, within Data Space : linkeddata.uriburner.com:28898 associated with source document(s)

AttributesValues
type
Title
content
  • Preliminaries In the annotated XSD schema, the sql:relationship annotation is used to nest the schema elements hierarchically, on the basis of primary key and foreign key relationships among the underlying tables to which the elements map. In specifying the sql:relationship annotation, you must identify: The parent table (Customers) and the child table (Orders). The necessary join condition. (CustomerID in Orders is a child key that refers to the CustomerID parent key in the Customers table.) This information is used in generating the proper hierarchy. (For each parent element, the related child elements appear as subelements.) To provide the table names and the necessary join information, the following attributes are specified on the sql:relationship annotation: 'name' specifies the unique name of the relationship; 'parent' specifies the parent relation (table). This is an optional attribute; if the attribute is not specified, the parent table name is obtained from information in the child hierarchy in the document. If the schema specifies two parent-child hierarchies that use the same <sql:relationship> but different parent elements, you do not specify the parent attribute in <sql:relationship>. This information is obtained from the hierarchy in the schema. 'parent-key' specifies the parent key of the parent. If the parent key is composed of multiple columns, values are specified with a space between them. There is a positional mapping between the values that are specified for the multicolumn key and for the corresponding child key. 'child' specifies the child relation (table). 'child-key' specifies the child key in the child referring to parent-key in parent. If the child key is composed of multiple attributes (columns), the child-key values are specified with a space between them. There is a positional mapping between the values that are specified for the multicolumn key and for the corresponding parent key. These attributes are valid only with the <sql:relationship> element. Example. Specifying the sql:relationship annotation on an element. The following annotated XSD schema includes 'Customer' and 'Order' elements. The 'Order' element is a subelement of the 'Customer' element. In the schema, the sql:relationship annotation is specified on the 'Order' subelement. The relationship itself is defined in the 'appinfo' element. The 'relationship' element identifies CustomerID in the Orders table as a foreign key that refers to the CustomerID primary key in the Customers table. Therefore, orders that belong to a customer appear as a subelement of that 'Customer' element. <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema"> <xsd:annotation> <xsd:appinfo> <sql:relationship name="CustOrders" parent="Demo.demo.Customers" parent-key="CustomerID" child="Demo.demo.Orders" child-key="CustomerID" /> </xsd:appinfo> </xsd:annotation> <xsd:element name="Customer" sql:relation="Demo.demo.Customers" type="CustomerType" /> <xsd:complexType name="CustomerType" > <xsd:sequence> <xsd:element name="Order" sql:relation="Demo.demo.Orders" sql:relationship="CustOrders" > <xsd:complexType> <xsd:attribute name="OrderID" type="xsd:integer" /> <xsd:attribute name="CustomerID" type="xsd:string" /> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name="CustomerID" type="xsd:string" /> <xsd:attribute name="ContactName" type="xsd:string" /> </xsd:complexType> </xsd:schema> Let the schema is written to the file 'CustOr_constant.xsd', then after loading this file by xml_load_mapping_schema_decl function, the first example will produce a result for the XPath query: XPATH [__view 'Customer_Order'] /Customer[@CustomerID="QUEEN"]; the second example will produce a result for the XQuery query: select xquery_eval('<doc>{for $r in xmlview("Customer_Order")/*[@CustomerID="QUEEN"] return $r}</doc>', xtree_doc('<q/>'))
has container
description
  • Using sql:relationship to Specify Relationships
dcterms:created_at
  • Fri, 27 Dec 2019 14:12:54 GMT
content:encoded
  • Preliminaries In the annotated XSD schema, the sql:relationship annotation is used to nest the schema elements hierarchically, on the basis of primary key and foreign key relationships among the underlying tables to which the elements map. In specifying the sql:relationship annotation, you must identify: The parent table (Customers) and the child table (Orders). The necessary join condition. (CustomerID in Orders is a child key that refers to the CustomerID parent key in the Customers table.) This information is used in generating the proper hierarchy. (For each parent element, the related child elements appear as subelements.) To provide the table names and the necessary join information, the following attributes are specified on the sql:relationship annotation: &#39;name&#39; specifies the unique name of the relationship; &#39;parent&#39; specifies the parent relation (table). This is an optional attribute; if the attribute is not specified, the parent table name is obtained from information in the child hierarchy in the document. If the schema specifies two parent-child hierarchies that use the same &lt;sql:relationship&gt; but different parent elements, you do not specify the parent attribute in &lt;sql:relationship&gt;. This information is obtained from the hierarchy in the schema. &#39;parent-key&#39; specifies the parent key of the parent. If the parent key is composed of multiple columns, values are specified with a space between them. There is a positional mapping between the values that are specified for the multicolumn key and for the corresponding child key. &#39;child&#39; specifies the child relation (table). &#39;child-key&#39; specifies the child key in the child referring to parent-key in parent. If the child key is composed of multiple attributes (columns), the child-key values are specified with a space between them. There is a positional mapping between the values that are specified for the multicolumn key and for the corresponding parent key. These attributes are valid only with the &lt;sql:relationship&gt; element. Example. Specifying the sql:relationship annotation on an element. The following annotated XSD schema includes &#39;Customer&#39; and &#39;Order&#39; elements. The &#39;Order&#39; element is a subelement of the &#39;Customer&#39; element. In the schema, the sql:relationship annotation is specified on the &#39;Order&#39; subelement. The relationship itself is defined in the &#39;appinfo&#39; element. The &#39;relationship&#39; element identifies CustomerID in the Orders table as a foreign key that refers to the CustomerID primary key in the Customers table. Therefore, orders that belong to a customer appear as a subelement of that &#39;Customer&#39; element. &lt;xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:sql=&quot;urn:schemas-microsoft-com:mapping-schema&quot;&gt; &lt;xsd:annotation&gt; &lt;xsd:appinfo&gt; &lt;sql:relationship name=&quot;CustOrders&quot; parent=&quot;Demo.demo.Customers&quot; parent-key=&quot;CustomerID&quot; child=&quot;Demo.demo.Orders&quot; child-key=&quot;CustomerID&quot; /&gt; &lt;/xsd:appinfo&gt; &lt;/xsd:annotation&gt; &lt;xsd:element name=&quot;Customer&quot; sql:relation=&quot;Demo.demo.Customers&quot; type=&quot;CustomerType&quot; /&gt; &lt;xsd:complexType name=&quot;CustomerType&quot; &gt; &lt;xsd:sequence&gt; &lt;xsd:element name=&quot;Order&quot; sql:relation=&quot;Demo.demo.Orders&quot; sql:relationship=&quot;CustOrders&quot; &gt; &lt;xsd:complexType&gt; &lt;xsd:attribute name=&quot;OrderID&quot; type=&quot;xsd:integer&quot; /&gt; &lt;xsd:attribute name=&quot;CustomerID&quot; type=&quot;xsd:string&quot; /&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;xsd:attribute name=&quot;CustomerID&quot; type=&quot;xsd:string&quot; /&gt; &lt;xsd:attribute name=&quot;ContactName&quot; type=&quot;xsd:string&quot; /&gt; &lt;/xsd:complexType&gt; &lt;/xsd:schema&gt; Let the schema is written to the file &#39;CustOr_constant.xsd&#39;, then after loading this file by xml_load_mapping_schema_decl function, the first example will produce a result for the XPath query: XPATH [__view &#39;Customer_Order&#39;] /Customer[@CustomerID=&quot;QUEEN&quot;]; the second example will produce a result for the XQuery query: select xquery_eval(&#39;&lt;doc&gt;{for $r in xmlview(&quot;Customer_Order&quot;)/*[@CustomerID=&quot;QUEEN&quot;] return $r}&lt;/doc&gt;&#39;, xtree_doc(&#39;&lt;q/&gt;&#39;))
is container of of
Faceted Search & Find service v1.17_git144 as of Jul 26 2024


Alternative Linked Data Documents: iSPARQL | ODE     Content Formats:   [cxml] [csv]     RDF   [text] [turtle] [ld+json] [rdf+json] [rdf+xml]     ODATA   [atom+xml] [odata+json]     Microdata   [microdata+json] [html]    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 08.03.3331 as of Aug 25 2024, on Linux (x86_64-ubuntu_noble-linux-glibc2.38-64), Single-Server Edition (378 GB total memory, 62 GB memory in use)
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2024 OpenLink Software