Not logged in : Login
(Sponging disallowed)

About: http://demo.openlinksw.com/tutorial/xmlsql/ms_a_2/ms_a_2.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 The sql:relation annotation maps an XML node in the XSD schema to a database table. The name of a table (view) is specified as the value of the sql:relation annotation. When sql:relation is specified on an element, the scope of this annotation applies to all attributes and subelements that are described in the complex type definition of that element, therefore, providing a shortcut in writing annotations. The sql:relation annotation also may be used if identifiers that are valid in SQL are not valid in XML. For example, 'Order Details' is a valid table name in SQL, but not in XML. In such cases, the sql:relation annotation can be used to specify the mapping, for example: <xsd:element name="OrderDetails" sql:relation="Order Details"> ... The sql:field annotation maps an XML node in the schema to a database column. It's not allowed to specify sql:field on an empty content element. Example In this example, the XSD schema consists of an 'Emp' element of complex type with 'FirstName', 'LastName' and 'title' child elements and the 'EmpID' attribute. The sql:relation annotation maps the 'Emp' element to the Demo.demo.Employees table. The sql:field annotation maps the 'title' element to the 'Title' column and the 'EmpID' attribute to the "EmployeeID" column. No annotations are specified for the 'FirstName' and 'LastName' elements. This results in a default mapping of the elements to the columns with the same names. <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema"> <xsd:element name="Emp" sql:relation="Demo.demo.Employees" > <xsd:complexType> <xsd:sequence> <xsd:element name="FirstName" type="xsd:string" /> <xsd:element name="LastName" type="xsd:string" /> <xsd:element name="title" sql:field="Title" type="xsd:string" /> </xsd:sequence> <xsd:attribute name="EmpID" sql:field="EmployeeID" type="xsd:integer" /> </xsd:complexType> </xsd:element> </xsd:schema> Let the schema is written to the file 'EmpSchema.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 'EmpSchema'] /* the second example will produce a result for the XQuery query: select xquery_eval('<doc>{for $r in xmlview("EmpSchema")/* return $r}</doc>', xtree_doc('<q/>')); <doc> is necessary for serialization (any name instead 'doc' is possible)
has container
description
  • Using sql:relation and sql:field
dcterms:created_at
  • Fri, 27 Dec 2019 14:12:54 GMT
content:encoded
  • Preliminaries The sql:relation annotation maps an XML node in the XSD schema to a database table. The name of a table (view) is specified as the value of the sql:relation annotation. When sql:relation is specified on an element, the scope of this annotation applies to all attributes and subelements that are described in the complex type definition of that element, therefore, providing a shortcut in writing annotations. The sql:relation annotation also may be used if identifiers that are valid in SQL are not valid in XML. For example, &#39;Order Details&#39; is a valid table name in SQL, but not in XML. In such cases, the sql:relation annotation can be used to specify the mapping, for example: &lt;xsd:element name=&quot;OrderDetails&quot; sql:relation=&quot;Order Details&quot;&gt; ... The sql:field annotation maps an XML node in the schema to a database column. It&#39;s not allowed to specify sql:field on an empty content element. Example In this example, the XSD schema consists of an &#39;Emp&#39; element of complex type with &#39;FirstName&#39;, &#39;LastName&#39; and &#39;title&#39; child elements and the &#39;EmpID&#39; attribute. The sql:relation annotation maps the &#39;Emp&#39; element to the Demo.demo.Employees table. The sql:field annotation maps the &#39;title&#39; element to the &#39;Title&#39; column and the &#39;EmpID&#39; attribute to the &quot;EmployeeID&quot; column. No annotations are specified for the &#39;FirstName&#39; and &#39;LastName&#39; elements. This results in a default mapping of the elements to the columns with the same names. &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:element name=&quot;Emp&quot; sql:relation=&quot;Demo.demo.Employees&quot; &gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name=&quot;FirstName&quot; type=&quot;xsd:string&quot; /&gt; &lt;xsd:element name=&quot;LastName&quot; type=&quot;xsd:string&quot; /&gt; &lt;xsd:element name=&quot;title&quot; sql:field=&quot;Title&quot; type=&quot;xsd:string&quot; /&gt; &lt;/xsd:sequence&gt; &lt;xsd:attribute name=&quot;EmpID&quot; sql:field=&quot;EmployeeID&quot; type=&quot;xsd:integer&quot; /&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:schema&gt; Let the schema is written to the file &#39;EmpSchema.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;EmpSchema&#39;] /* the second example will produce a result for the XQuery query: select xquery_eval(&#39;&lt;doc&gt;{for $r in xmlview(&quot;EmpSchema&quot;)/* return $r}&lt;/doc&gt;&#39;, xtree_doc(&#39;&lt;q/&gt;&#39;)); &lt;doc&gt; is necessary for serialization (any name instead &#39;doc&#39; is possible)
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