\hypertarget{elementDuration}{}\subsection{Example xs:duration}\label{elementDuration}
The duration \char`\"{}P2M26DT14H18M\char`\"{} is split into two separate values \char`\"{}P2M\char`\"{} and \char`\"{}P26DT14H18M\char`\"{}. Notice the missing year and seconds components, any component is optional. Whereas the value space of duration is partially ordered, the spaces of these year/month and day/time types are totally ordered.



\begin{DocInclude}\begin{verbatim}<?xml version="1.0" encoding="UTF-8"?>
<duration xmlns="http://example.org/">P2M26DT14H18M</duration>
\end{verbatim}
\end{DocInclude}


The xml schema for this is as follows:



\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="duration" type="xs:duration" />
</xs:schema>
\end{verbatim}
\end{DocInclude}


The object of the 'duration' statement is now a bnode with a pair of rdf:values, representing the two components of the original duration. These values may be distinguished by their type. The base is \href{http://example.org/base.}{\tt http://example.org/base.}



\begin{DocInclude}\begin{verbatim}# Base: http://example.org/elementDuration.xml
@prefix ns1:     <http://example.org/def/> .
@prefix xs:      <http://www.w3.org/2001/XMLSchema> .
@prefix ns2:     <http://example.org/> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xs_:     <http://www.w3.org/2001/XMLSchema#> .
@prefix :        <#> .

<>    ns2:duration
              [ rdf:value "P26DT14H18M"^^xs_:dayTimeDuration , "P2M"^^xs_:yearMonthDuration
              ] .
\end{verbatim}
\end{DocInclude}


Mapping back to XML, we make use of the fact that these year/month and day/time types are sub-classes of duration. Durations are added component-wise, so we needn't be concerned with (indeterminate) carry from days to months. 