Not logged in : Login
(Sponging disallowed)

About: http://demo.openlinksw.com/tutorial/xmlsql/ms_a_4/ms_a_4.vsp     Goto   Sponge   NotDistinct   Permalink

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

AttributesValues
type
Title
content
  • Preliminaries The sql:is-constant annotation can be used to specify a constant element, an element in the XSD schema that does not map to any database table or column. sql:is-constant takes a Boolean value (false, true), 0 and 1 (0 = false, 1 = true). The is-constant annotation can be specified on an element that does not have any attributes. If this annotation is specified on an element with the value true (or 1), that element is not mapped to the database but still appears in the XML document. The sql:is-constant annotation can be added to a <complexType> element. Example. Specifying sql:is-constant to add a container element In this annotated XSD schema, 'CustomerOrders' is defined as a constant element by specifying the sql:is-constant attribute with the value of 1. Therefore, 'CustomerOrders' element is not mapped to any database table or column. This constant element consists of the 'Order' subelements. Although 'CustomerOrders' element does not map to any database table or column, it still appears in the resulting XML as a container element containing the 'Order' subelements. <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" > <xsd:complexType> <xsd:sequence> <xsd:element name="CustomerOrders" sql:is-constant="1" > <xsd:complexType> <xsd:sequence> <xsd:element name="Order" sql:relation="Demo.demo.Orders" sql:relationship="CustOrders" maxOccurs="unbounded" > <xsd:complexType> <xsd:attribute name="OrderID" type="xsd:integer" /> <xsd:attribute name="CustomerID" type="xsd:string" /> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:sequence> <xsd:attribute name="CustomerID" type="xsd:string" /> </xsd:complexType> </xsd:element> </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 'CustOr_constant'] /*[@CustomerID="QUEEN"] the second example will produce a result for the XQuery query: select xquery_eval('<doc>{for $r in xmlview("CustOr_constant")/*[@CustomerID="QUEEN"] return $r}</doc>', xtree_doc('<q/>'))
has container
description
  • Using sql:is-constant for creating constant elements
dcterms:created_at
  • Fri, 27 Dec 2019 14:12:54 GMT
content:encoded
  • Preliminaries The sql:is-constant annotation can be used to specify a constant element, an element in the XSD schema that does not map to any database table or column. sql:is-constant takes a Boolean value (false, true), 0 and 1 (0 = false, 1 = true). The is-constant annotation can be specified on an element that does not have any attributes. If this annotation is specified on an element with the value true (or 1), that element is not mapped to the database but still appears in the XML document. The sql:is-constant annotation can be added to a &lt;complexType&gt; element. Example. Specifying sql:is-constant to add a container element In this annotated XSD schema, &#39;CustomerOrders&#39; is defined as a constant element by specifying the sql:is-constant attribute with the value of 1. Therefore, &#39;CustomerOrders&#39; element is not mapped to any database table or column. This constant element consists of the &#39;Order&#39; subelements. Although &#39;CustomerOrders&#39; element does not map to any database table or column, it still appears in the resulting XML as a container element containing the &#39;Order&#39; subelements. &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; &gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name=&quot;CustomerOrders&quot; sql:is-constant=&quot;1&quot; &gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name=&quot;Order&quot; sql:relation=&quot;Demo.demo.Orders&quot; sql:relationship=&quot;CustOrders&quot; maxOccurs=&quot;unbounded&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: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:complexType&gt; &lt;/xsd:element&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;CustOr_constant&#39;] /*[@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;CustOr_constant&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_git150 as of Jan 20 2025


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.3332 as of Jan 29 2025, on Linux (x86_64-generic-linux-glibc25), Single-Server Edition (378 GB total memory, 33 GB memory in use)
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2025 OpenLink Software