title: Duration comparison in prolog
body: <p>I made an OWL ontology with some xsd:duration datatype. Then I converted it into prolog facts using Thea.</p>
  <p>I have the following xsd:duration structure <a href="https://www.w3schools.com/xml/schema_dtypes_date.asp" rel="nofollow noreferrer">PnYnMnDTnHnMnS</a>. How can I write prolog rules to compare two durations, in order to establish which one is greater?</p>
  <p>When I retrieve data from my prolog facts, it has this form:</p>
  <p><code>literal(type('http://www.w3.org/2001/XMLSchema#duration', Value))</code></p>
  <p>I managed to extract Value using:</p>
  <pre><code>extractDuration(Literal, Result):-arg(1,Literal,Out1),arg(2,Out1,Result).
  </code></pre>
  <p>Which leads to (for example):</p>
  <pre><code>'P5D', 'PT10H', or 'P3DT15H32M'
  </code></pre>
  <p>Still have no idea how to compare them.</p>