\hypertarget{element}{}\subsection{element}\label{element}
Elements map to RDF properties. An instance of an element maps to an RDF statement. A qualified element is defined in the target namespace of the schema, as is the corresponding RDF property. Where an element has a complex type we define a corresponding OWL Object\-Property. Where an attribute or element has an RDF recommended simple type we define a corresponding OWL Datatype\-Property. Attribute and elements of non-recommended simple types form a grey zone with literal types (any\-Simple\-Type and ENTITY) still requiring a Datatype\-Property, but the URI (QName, NOTATION, IDREF) and structured types (duration, ENTITIES, IDREFS, NMTOKENS) switch; demanding an Object\-Property. Where content has a named type (or if there is an explicit xsi:type) this is represented by an rdf:type statement on the node.

e.g. for target namespace \href{http://example.org/}{\tt http://example.org/} and element named 'foo', the RDF property name is \href{http://example.org/foo}{\tt http://example.org/foo}



\begin{DocInclude}\begin{verbatim}<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org/">
        <xs:element name="foo" type="xs:string" />
</xs:schema>
\end{verbatim}
\end{DocInclude}


The OWL mapping was produced with lang=N3. This shows the property definition for 'foo'. It is a datatype property ranging over xs:string.



\begin{DocInclude}\begin{verbatim}# Base: http://example.org/element1.owl
@prefix ns1:     <http://example.org/def/> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix ns2:     <http://example.org/> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix daml:    <http://www.daml.org/2001/03/daml+oil#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .

<>    a       owl:Ontology .

ns2:foo
      a       owl:DatatypeProperty , rdf:Property ;
      rdfs:range xs_:string .
\end{verbatim}
\end{DocInclude}


Where the target namespace ends with an alphanumeric character, a fragment separator is introduced. e.g. for target namespace \href{http://example.org}{\tt http://example.org} and element named 'foo', the RDF property name is \href{http://example.org#foo}{\tt http://example.org\#foo}



\begin{DocInclude}\begin{verbatim}<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.org">
        <xs:element name="foo" type="xs:string" />
</xs:schema>
\end{verbatim}
\end{DocInclude}


This OWL was produced with lang=N3



\begin{DocInclude}\begin{verbatim}# Base: http://example.org/element2.owl
@prefix ns1:     <http://example.org/def/> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix ns2:     <http://example.org#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix daml:    <http://www.daml.org/2001/03/daml+oil#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .

<>    a       owl:Ontology .

ns2:foo
      a       owl:DatatypeProperty , rdf:Property ;
      rdfs:range xs_:string .
\end{verbatim}
\end{DocInclude}


Unqualified elements are not defined in the target namespace, but the mapping to RDF requires an absolute URI. Unqualified elements occur if no target namespace is defined, or if an element is declared locally and its form is unqualified. The properties corresponding to unqualified elements will be declared in the user-defined default namespace (xmlns) of the schema. This is a command line parameter (not the xmlns defined on the document element).

e.g. for default namespace \href{http://example.com/def/}{\tt http://example.com/def/} and unqualified element named 'foo', the RDF property name is \href{http://example.org/def/foo}{\tt http://example.org/def/foo}



\begin{DocInclude}\begin{verbatim}<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="foo" type="xs:string" />
</xs:schema>
\end{verbatim}
\end{DocInclude}


The OWL mapping was produced with lang=N3 and xmlns=http://example.com/def/



\begin{DocInclude}\begin{verbatim}# Base: http://example.org/element3.owl
@prefix ns1:     <http://example.org/def/> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix daml:    <http://www.daml.org/2001/03/daml+oil#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .

ns1:foo
      a       owl:DatatypeProperty , rdf:Property ;
      rdfs:range xs_:string .

<>    a       owl:Ontology .
\end{verbatim}
\end{DocInclude}


In xml schema, elements have their own symbol space, distinct from other components such as attributes and types. If there are overlaps between these symbol spaces, it is advisable to introduce a symbolic prefix to keep them distinct.

e.g. the element named 'foo' and type named 'foo' in the target namespace \href{http://example.org/}{\tt http://example.org/} will clash. Introducing a symbolic prefix '$\sim$' (at the command line) for elements resolves the clash giving us an RDF property name \href{http://example.org/~foo.}{\tt http://example.org/$\sim$foo.}

The OWL mapping below was generated from the first schema above, but with element=$\sim$



\begin{DocInclude}\begin{verbatim}# Base: http://example.org/element4.owl
@prefix ns1:     <http://example.org/def/> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix ns2:     <http://example.org/> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix daml:    <http://www.daml.org/2001/03/daml+oil#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .

<http://example.org/~foo>
      a       owl:DatatypeProperty , rdf:Property ;
      rdfs:range xs_:string .

<>    a       owl:Ontology .
\end{verbatim}
\end{DocInclude}
\hypertarget{element_Type}{}\subsubsection{Type}\label{element_Type}
An element may have a simple or complex type. On the whole, simple typed elements map to OWL datatype properties (exceptions include most of the datatypes that don't have a clean mapping into RDF); while complex typed elements map to object properties.

The schema below defines a simple typed property 'foo' and a complex type property 'bar'.



\begin{DocInclude}\begin{verbatim}<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        targetNamespace="http://example.org/" xmlns="http://example.org/">
        
        <xs:element name="foo" type="xs:string" />
        
        <xs:element name="bar">
                <xs:complexType mixed="true" />
        </xs:element>

</xs:schema>
\end{verbatim}
\end{DocInclude}


With a corresponding OWL mapping:



\begin{DocInclude}\begin{verbatim}# Base: http://example.org/element5.owl
@prefix ns1:     <http://example.org/> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix ns2:     <http://example.org/def/> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix daml:    <http://www.daml.org/2001/03/daml+oil#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .

ns1:bar
      a       owl:ObjectProperty .

ns1:foo
      a       owl:DatatypeProperty , rdf:Property ;
      rdfs:range xs_:string .

<>    a       owl:Ontology .
\end{verbatim}
\end{DocInclude}


An element may reference or directly include a simple type declaration.\hypertarget{element_elementChildren}{}\subsubsection{Child components}\label{element_elementChildren}
\begin{itemize}
\item \hyperlink{simpletype}{simple\-Type}\item \hyperlink{complextype}{complex\-Type}\item \hyperlink{annotation}{annotation} \end{itemize}
